Last active
November 4, 2018 00:12
-
-
Save Yoloabdo/2aae3e05e4240751d8f4da6cd83f7fc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func ShowPayfort(controller: PayFortController, with order: ScanOrder, token sdkToken: String) { | |
| let user = UserManager.shared.currentUserInfo | |
| let request = NSMutableDictionary() | |
| // Payfort api :Remember - Before sending the amount value of any transaction | |
| // you have to multiply the value with the currency decimal code according to ISO code 3. | |
| let updatedAmount: Float = Float(order.orderTotalSar! * 100) | |
| request.setValue(updatedAmount, forKey: "amount") | |
| request.setValue("PURCHASE", forKey: "command")//PURCHASE - AUTHORIZATION | |
| request.setValue("SAR", forKey: "currency") | |
| request.setValue(user?.email ?? "" , forKey: "customer_email") | |
| request.setValue("ar", forKey: "language") | |
| request.setValue(order.payfortId ?? "", forKey: "merchant_reference") | |
| request.setValue(sdkToken, forKey: "sdk_token") | |
| controller.callPayFort(withRequest: request, | |
| currentViewController: self, | |
| success: { (_, response) in | |
| self.sendPayfortToServer(response) | |
| }, canceled: { (request, response) in | |
| // self.showError(sub: response[""]) | |
| }, faild: { (requst, response, message) in | |
| self.showError(sub: message) | |
| }) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
adding comments