Advertisement
Guest User

Untitled

a guest
Sep 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. //
  2. // ViewController.swift
  3. // IMEPayTest
  4. //
  5. // Created by Naren Maharjan on 9/20/18.
  6. // Copyright © 2018 Naren Maharjan. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10. import IMEPay
  11.  
  12. class ViewController: UIViewController {
  13.  
  14. let manager = IMPPaymentManager(environment: Live) // For Test
  15.  
  16. override func viewDidLoad() {
  17. super.viewDidLoad()
  18. setupIMEPay()
  19. // Do any additional setup after loading the view, typically from a nib.
  20. }
  21.  
  22.  
  23.  
  24.  
  25. func setupIMEPay(){
  26. // let manager = IMPPaymentManager(environment: Live) // For production
  27.  
  28.  
  29. manager?.pay(withUsername: "tootle" , password: "tootle123", merchantCode: "TOOTLE", merchantName: "Tootle", merchantUrl: "https://api.demo.ktm.tt.hyperloopnepal.com/v2/transactions/imeRecordData", amount: "10", referenceId: "C123", module: "TOOTLE", success: { (transactionInfo) in
  30.  
  31. print(transactionInfo?.amount)
  32.  
  33. // You can extract the following info from transactionInfo
  34.  
  35. transactionInfo?.responseCode
  36.  
  37. // Response Code 100:- Transaction successful.
  38. // Response Code 101:- Transaction failed.
  39.  
  40. transactionInfo?.responseDescription // ResponseDescription, message sent from server
  41. transactionInfo?.transactionId // Transaction Id, Unique ID generated from IME Pay system.
  42. transactionInfo?.customerMsisdn // Customer mobile number (IME Pay wallet ID)
  43. transactionInfo?.amount // Payment Amount
  44. transactionInfo?.referenceId // Reference Value
  45.  
  46. }, failure: { (transactionInfo, errorMessage) in
  47. print(errorMessage)
  48. // Transaction Failure
  49. })
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement