Skip to content

Instantly share code, notes, and snippets.

@Yoloabdo
Last active November 4, 2018 00:12
Show Gist options
  • Select an option

  • Save Yoloabdo/2aae3e05e4240751d8f4da6cd83f7fc2 to your computer and use it in GitHub Desktop.

Select an option

Save Yoloabdo/2aae3e05e4240751d8f4da6cd83f7fc2 to your computer and use it in GitHub Desktop.
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)
})
}
@Yoloabdo
Copy link
Copy Markdown
Author

adding comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment