solved payment problems
This commit is contained in:
parent
5885c68bda
commit
f8df6ea06d
|
@ -7,7 +7,7 @@
|
|||
<key>BaseLibrary.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>Verdnaturaventas.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
|
Binary file not shown.
|
@ -166,8 +166,10 @@ class ControllerPedido: NSObject {
|
|||
let order = getPedido()
|
||||
|
||||
order.customer_id = order.cliente!.Id_Cliente
|
||||
order.delivery_method_id = order.agencia!.Vista
|
||||
order.agency_id = order.agencia!.Id_Agencia
|
||||
if order.agencia != nil {
|
||||
order.delivery_method_id = order.agencia!.Vista
|
||||
order.agency_id = order.agencia!.Id_Agencia
|
||||
}
|
||||
order.address_id = order.consignatarioActivo?.Id_Consigna
|
||||
order.source_app = "IOS"
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wpn-Qt-7HE">
|
||||
<rect key="frame" x="15" y="0.0" width="290" height="30"/>
|
||||
<rect key="frame" x="15" y="0.0" width="290" height="29.5"/>
|
||||
<fontDescription key="fontDescription" name="Roboto-Regular" family="Roboto" pointSize="20"/>
|
||||
<color key="textColor" red="0.62860941889999999" green="0.62909907099999995" blue="0.62868529559999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
|
|
@ -20,7 +20,9 @@ class ParserOrder: Parser {
|
|||
let order = Order()
|
||||
order.parseJson(jsonDictionary)
|
||||
order.consignatarioActivo = ParserConsignatario().parse(jsonDictionary["consignatarioActivo"]! as AnyObject)
|
||||
order.agencia = ParserAgencias().parseAgencia(jsonDictionary["agencia"] as! NSDictionary)
|
||||
if jsonDictionary["agencia"] != nil {
|
||||
order.agencia = ParserAgencias().parseAgencia(jsonDictionary["agencia"] as! NSDictionary)
|
||||
}
|
||||
order.PedidoSplitado = (jsonDictionary["PedidoSplitado"] as AnyObject).boolValue
|
||||
if let cliente = jsonDictionary["cliente"]
|
||||
{
|
||||
|
|
Binary file not shown.
|
@ -43,23 +43,21 @@ class ViewNavegador: MyViewVentas, UIWebViewDelegate {
|
|||
@IBAction func clickBack(_ sender: AnyObject) {
|
||||
back()
|
||||
}
|
||||
|
||||
|
||||
func generateWebView()
|
||||
{
|
||||
|
||||
let url = URL(string: datos!.Url!)
|
||||
let mutableURL = NSMutableURLRequest(url:url!)
|
||||
mutableURL.httpMethod = "POST"
|
||||
let data = generateData().data(using: String.Encoding.utf8)
|
||||
mutableURL.httpBody = data
|
||||
webView.loadRequest(mutableURL as URLRequest)
|
||||
/*Request*/
|
||||
var request = URLRequest(url: URL(string:datos!.Url!)!)
|
||||
request.httpMethod = "POST"
|
||||
request.httpBody = generateData().data(using:String.Encoding.ascii, allowLossyConversion: false)
|
||||
webView.loadRequest(request)
|
||||
|
||||
}
|
||||
|
||||
func generateData() -> String
|
||||
{
|
||||
let data = "Ds_SignatureVersion=\(datos!.DSSignature!)&Ds_MerchantParameters=\(datos!.EncodedParams!)&Ds_Signature=\(datos!.Signature!)"
|
||||
|
||||
let data = "Ds_SignatureVersion=\(datos!.DSSignature!)&Ds_MerchantParameters=\(datos!.EncodedParams!)&Ds_Signature=\(datos!.Signature!)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!.replacingOccurrences(of: "+", with: "%2B")
|
||||
print(data)
|
||||
return data
|
||||
}
|
||||
|
||||
|
@ -77,11 +75,11 @@ class ViewNavegador: MyViewVentas, UIWebViewDelegate {
|
|||
handlerFinish: {
|
||||
self.datos = cmd.datos!
|
||||
self.generateWebView()
|
||||
},
|
||||
},
|
||||
handlerRetry: {
|
||||
self.showProgress(false)
|
||||
self.obtenerDatosPasarBanco()
|
||||
},
|
||||
},
|
||||
handlerAccept: {}
|
||||
)
|
||||
|
||||
|
@ -101,7 +99,7 @@ class ViewNavegador: MyViewVentas, UIWebViewDelegate {
|
|||
status = "ko"
|
||||
pagado = false
|
||||
}
|
||||
|
||||
|
||||
showProgress(true);
|
||||
let cmd = CmdTransactionEnd(s: status, t: transaccion)
|
||||
cmd.callbacks = CommandCallbacks(
|
||||
|
@ -109,19 +107,19 @@ class ViewNavegador: MyViewVentas, UIWebViewDelegate {
|
|||
handlerFinish: {
|
||||
self.showProgress(false)
|
||||
self.launchSegue("segueNavegadorFinalizar", sender: Values.CALLBACK_PAGO_OK as AnyObject?)
|
||||
},
|
||||
},
|
||||
handlerRetry: {
|
||||
self.transactionEnd(url, transaccion: transaccion)
|
||||
},
|
||||
},
|
||||
handlerAccept: {
|
||||
self.back()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
execute(cmd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
func back()
|
||||
{
|
||||
launchSegue("segueNavegadorFinalizar", sender: Values.CALLBACK_PAGO_ERROR as AnyObject?)
|
||||
|
@ -129,6 +127,8 @@ class ViewNavegador: MyViewVentas, UIWebViewDelegate {
|
|||
|
||||
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool
|
||||
{
|
||||
|
||||
|
||||
if(request.url!.absoluteString == Values.CALLBACK_PAGO_OK || request.url!.absoluteString == Values.CALLBACK_PAGO_ERROR){
|
||||
transactionEnd((request.url?.absoluteString)!, transaccion: NSNumber(value: Int(datos!.DSOrder!)! as Int))
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ class ViewNavegador: MyViewVentas, UIWebViewDelegate {
|
|||
let vc = segue.destination as! DialogFinalizarPedido
|
||||
vc.transaction = sender as! String
|
||||
vc.deuda = deuda
|
||||
|
||||
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
|
@ -155,5 +155,5 @@ class ViewNavegador: MyViewVentas, UIWebViewDelegate {
|
|||
func webViewDidFinishLoad(_ webView: UIWebView) {
|
||||
showProgress(false)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue