-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from xendit/CC-4890/allow-example-to-handle-de…
…cimals Fixed examples to handle decimals
- Loading branch information
Showing
12 changed files
with
184 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// XenditAuthenticationRequest.swift | ||
// Xendit | ||
// | ||
// Created by xendit on 07/07/21. | ||
// | ||
|
||
import Foundation | ||
|
||
@objcMembers | ||
@objc(XenditAuthenticationRequest) open class XenditAuthenticationRequest: NSObject, JsonSerializable { | ||
|
||
public var amount: NSNumber | ||
public var tokenId: String | ||
public var currency: String | ||
public var cardCvn: String? | ||
public var midLabel: String? | ||
public var billingDetails: XenditBillingDetails? | ||
public var customer: XenditCustomer? | ||
|
||
public init(tokenId: String, amount: NSNumber, currency: String) { | ||
self.amount = amount | ||
self.tokenId = tokenId | ||
self.currency = currency | ||
} | ||
|
||
func toJsonObject() -> [String : Any] { | ||
|
||
var json: [String: Any] = [ | ||
"amount": amount, | ||
"credit_card_token_id": tokenId, | ||
"currency": currency | ||
] | ||
|
||
if (midLabel != nil) { | ||
json["mid_label"] = midLabel | ||
} | ||
|
||
if (billingDetails != nil) { | ||
json["billing_details"] = billingDetails!.toJsonObject() | ||
} | ||
|
||
if (cardCvn != nil) { | ||
json["card_cvn"] = cardCvn | ||
} | ||
|
||
if (customer != nil) { | ||
json["customer"] = customer!.toJsonObject() | ||
} | ||
|
||
return json | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// XenditCardData.swift | ||
// Xendit | ||
// | ||
// Created by xendit on 07/07/21. | ||
// | ||
|
||
import Foundation | ||
@objcMembers | ||
@objc(XenditCardData) open class XenditCardData: NSObject { | ||
|
||
// Card Number value | ||
open var cardNumber: String | ||
|
||
// Card expiration month value | ||
open var cardExpMonth: String | ||
|
||
// Card expiration year value | ||
open var cardExpYear: String | ||
|
||
// Card verification number (CVN) value | ||
open var cardCvn: String? | ||
|
||
public init(cardNumber: String, cardExpMonth: String, cardExpYear: String) { | ||
self.cardNumber = cardNumber | ||
self.cardExpMonth = cardExpMonth | ||
self.cardExpYear = cardExpYear | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
Oops, something went wrong.