From 7ff8885a5a8e3611d442bd4ad0be73bfcf3e7375 Mon Sep 17 00:00:00 2001 From: DanRidh Date: Fri, 20 Sep 2024 11:22:51 +0900 Subject: [PATCH 1/2] added request id to topup endpoint --- .../BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift | 6 +++++- .../BankAPI/CreditCard/TopupWithCreditCardMembership.swift | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift b/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift index c8d0792..2c37426 100644 --- a/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift +++ b/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift @@ -7,16 +7,18 @@ public extension BankAPI.CreditCard { public let token: String public let accountId: String public let amount: Int + public let requestId: String public let organizationCode: String? public let isCardholderNameSpecified: Bool? public typealias Response = String - public init(userId: String, token: String, accountId: String, amount: Int, organizationCode: String? = nil, isCardholderNameSpecified: Bool? = nil) { + public init(userId: String, token: String, accountId: String, amount: Int, requestId: String, organizationCode: String? = nil, isCardholderNameSpecified: Bool? = nil) { self.userId = userId self.token = token self.accountId = accountId self.amount = amount + self.requestId = requestId self.organizationCode = organizationCode self.isCardholderNameSpecified = isCardholderNameSpecified } @@ -40,6 +42,8 @@ public extension BankAPI.CreditCard { dict["amount"] = amount + dict["request_id"] = requestId + if organizationCode != nil { dict["organization_code"] = organizationCode } diff --git a/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMembership.swift b/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMembership.swift index 5af6545..b11722d 100644 --- a/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMembership.swift +++ b/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMembership.swift @@ -7,16 +7,18 @@ public extension BankAPI.CreditCard { public let cardRegisteredAt: String public let accountId: String public let amount: Int + public let requestId: String public let deleteCardIfAuthFail: Bool? public let organizationCode: String? public typealias Response = String - public init(userId: String, cardRegisteredAt: String, accountId: String, amount: Int, deleteCardIfAuthFail: Bool? = nil, organizationCode: String? = nil) { + public init(userId: String, cardRegisteredAt: String, accountId: String, amount: Int, requestId: String, deleteCardIfAuthFail: Bool? = nil, organizationCode: String? = nil) { self.userId = userId self.cardRegisteredAt = cardRegisteredAt self.accountId = accountId self.amount = amount + self.requestId = requestId self.deleteCardIfAuthFail = deleteCardIfAuthFail self.organizationCode = organizationCode } @@ -40,6 +42,8 @@ public extension BankAPI.CreditCard { dict["amount"] = amount + dict["request_id"] = requestId + if deleteCardIfAuthFail != nil { dict["delete_card_if_auth_fail"] = deleteCardIfAuthFail } From 02c3ea68ec4364b5138638993f5a1cd12930a06a Mon Sep 17 00:00:00 2001 From: DanRidh Date: Tue, 15 Oct 2024 12:52:48 +0900 Subject: [PATCH 2/2] make request_id optional --- .../BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift | 8 +++++--- .../CreditCard/TopupWithCreditCardMembership.swift | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift b/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift index 2c37426..2b30dfd 100644 --- a/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift +++ b/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMdkToken.swift @@ -7,13 +7,13 @@ public extension BankAPI.CreditCard { public let token: String public let accountId: String public let amount: Int - public let requestId: String + public let requestId: String? public let organizationCode: String? public let isCardholderNameSpecified: Bool? public typealias Response = String - public init(userId: String, token: String, accountId: String, amount: Int, requestId: String, organizationCode: String? = nil, isCardholderNameSpecified: Bool? = nil) { + public init(userId: String, token: String, accountId: String, amount: Int, requestId: String? = nil, organizationCode: String? = nil, isCardholderNameSpecified: Bool? = nil) { self.userId = userId self.token = token self.accountId = accountId @@ -42,7 +42,9 @@ public extension BankAPI.CreditCard { dict["amount"] = amount - dict["request_id"] = requestId + if requestId != nil { + dict["request_id"] = requestId + } if organizationCode != nil { dict["organization_code"] = organizationCode diff --git a/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMembership.swift b/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMembership.swift index b11722d..0996473 100644 --- a/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMembership.swift +++ b/Sources/Pokepay/BankAPI/CreditCard/TopupWithCreditCardMembership.swift @@ -7,13 +7,13 @@ public extension BankAPI.CreditCard { public let cardRegisteredAt: String public let accountId: String public let amount: Int - public let requestId: String + public let requestId: String? public let deleteCardIfAuthFail: Bool? public let organizationCode: String? public typealias Response = String - public init(userId: String, cardRegisteredAt: String, accountId: String, amount: Int, requestId: String, deleteCardIfAuthFail: Bool? = nil, organizationCode: String? = nil) { + public init(userId: String, cardRegisteredAt: String, accountId: String, amount: Int, requestId: String? = nil, deleteCardIfAuthFail: Bool? = nil, organizationCode: String? = nil) { self.userId = userId self.cardRegisteredAt = cardRegisteredAt self.accountId = accountId @@ -42,7 +42,9 @@ public extension BankAPI.CreditCard { dict["amount"] = amount - dict["request_id"] = requestId + if requestId != nil { + dict["request_id"] = requestId + } if deleteCardIfAuthFail != nil { dict["delete_card_if_auth_fail"] = deleteCardIfAuthFail