omise / omise-swift

15 stars 10 forks source link

Add SCB to installments #101

Closed alan-hadyk closed 4 years ago

alan-hadyk commented 4 years ago

Test in QuickStart.playground:

func createCharge() {
    let currency = Currency.thb
    let params = ChargeParams(
        value: Value(
            amount: currency.convert(toSubunit: 6000.00),
            currency: currency
        ),
        sourceType: .installment(
            Installment.CreateParameter(
                brand: .scb,
                numberOfTerms: 6
            )
        ),
        isAutoCapture: false,
        returnURL: URL(string: "http://omise.co")
    )

    Charge.create(using: client, params: params) { (result) in
        switch result {
        case let .success(charge):
            print("created charge: \(charge.id) - \(charge.value.amount)")

        case let .failure(err):
            print("error: \(err)")
        }
    }
}
alan-hadyk commented 4 years ago

Remark - tested successfully with other installment charges