Skip to content

Commit

Permalink
Adds Cashapp, link, PayPal and zip payment method details to charge. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewangeta authored Aug 18, 2023
1 parent 782be51 commit 4dc40c3
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 36 deletions.
89 changes: 54 additions & 35 deletions Sources/StripeKit/Core Resources/Charges/Charge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public struct ChargePaymentMethodDetails: Codable {
public var alipay: ChargePaymentMethodDetailsAlipay?
/// If this is a `au_becs_debit` payment, this hash contains a snapshot of the transaction specific details of the `au_becs_debit` payment method.
public var auBecsDebit: ChargePaymentMethodDetailsAuBecsDebit?
/// If this is a `bacs_debit` payment, this hash contains a snapshot of the transaction specific details of the bacs_debit payment method.
/// If this is a `bacs_debit` payment, this hash contains a snapshot of the transaction specific details of the `bacs_debit` payment method.
public var bacsDebit: ChargePaymentMethodDetailsBacsDebit?
/// If this is a `bancontact` payment, this hash contains a snapshot of the transaction specific details of the `bancontact` payment method.
public var bancontact: ChargePaymentMethodDetailsBancontact?
Expand All @@ -368,6 +368,8 @@ public struct ChargePaymentMethodDetails: Codable {
public var card: ChargePaymentMethodDetailsCard?
/// If this is a `card_present` payment, this hash contains a snapshot of the transaction specific details of the `card_present` payment method.
public var cardPresent: ChargePaymentMethodDetailsCardPresent?
/// If this is a `cashapp` payment, this hash contains a snapshot of the transaction specific details of the `cashapp` payment method.
public var cashapp: ChargePaymentMethodDetailsCashApp?
/// If this is a `customer_balance` payment, this hash contains a snapshot of the transaction specific details of the `customer_balance` payment method.
public var customerBalance: ChargePaymentMethodDetailsCustomerBalance?
/// If this is a `eps` payment, this hash contains a snapshot of the transaction specific details of the `eps` payment method.
Expand All @@ -386,6 +388,8 @@ public struct ChargePaymentMethodDetails: Codable {
public var klarna: ChargePaymentMethodDetailsKlarna?
/// If this is a konbini payment, this hash contains a snapshot of the transaction specific details of the konbini payment method.
public var konbini: ChargePaymentMethodDetailsKobini?
/// If this is a `link` payment, this hash contains a snapshot of the transaction specific details of the `link` payment method.
public var link: ChargePaymentMethodDetailsLink?
/// If this is a `multibanco` payment, this hash contains a snapshot of the transaction specific details of the `multibanco` payment method.
public var multibanco: ChargePaymentMethodDetailsMultibanco?
/// If this is a oxxo payment, this hash contains a snapshot of the transaction specific details of the oxxo payment method.
Expand All @@ -394,6 +398,8 @@ public struct ChargePaymentMethodDetails: Codable {
public var p24: ChargePaymentMethodDetailsP24?
/// If this is a `paynow` payment, this hash contains a snapshot of the transaction specific details of the `paynow` payment method.
public var paynow: ChargePaymentMethodDetailsPaynow?
/// If this is a `paypal` payment, this hash contains a snapshot of the transaction specific details of the `paypal` payment method.
public var paypal: ChargePaymentMethodDetailsPaypal?
/// If this is a `pix` payment, this hash contains a snapshot of the transaction specific details of the `pix` payment method.
public var pix: ChargePaymentMethodDetailsPix?
/// If this is a `promptpay` payment, this hash contains a snapshot of the transaction specific details of the `promptpay` payment method.
Expand All @@ -412,42 +418,48 @@ public struct ChargePaymentMethodDetails: Codable {
public var wechat: ChargePaymentMethodDetailsWechat?
/// If this is a `wechat_pay` payment, this hash contains a snapshot of the transaction specific details of the `wechat_pay` payment method.
public var wechatPay: ChargePaymentMethodDetailsWechatPay?
/// If this is a zip payment, this hash contains a snapshot of the transaction specific details of the zip payment method.
public var zip: ChargePaymentMethodDetailsZip?

public init(achCreditTransfer: ChargePaymentMethodDetailsACHCreditTransfer? = nil,
achDebit: ChargePaymentMethodDetailsACHDebit? = nil,
acssDebit: ChargePaymentMethodDetailsACSSDebit? = nil,
affirm: ChargePaymentMethodDetailsAffirm? = nil,
afterpayClearpay: ChargePaymentMethodDetailsAfterpayClearpay? = nil,
alipay: ChargePaymentMethodDetailsAlipay? = nil,
auBecsDebit: ChargePaymentMethodDetailsAuBecsDebit? = nil,
bacsDebit: ChargePaymentMethodDetailsBacsDebit? = nil,
bancontact: ChargePaymentMethodDetailsBancontact? = nil,
blik: ChargePaymentMethodDetailsBlik? = nil,
boleto: ChargePaymentMethodDetailsBoleto? = nil,
card: ChargePaymentMethodDetailsCard? = nil,
cardPresent: ChargePaymentMethodDetailsCardPresent? = nil,
customerBalance: ChargePaymentMethodDetailsCustomerBalance? = nil,
eps: ChargePaymentMethodDetailsEPS? = nil,
fpx: ChargePaymentMethodDetailsFpx? = nil,
grabpay: ChargePaymentMethodDetailsGrabpay? = nil,
giropay: ChargePaymentMethodDetailsGiropay? = nil,
ideal: ChargePaymentMethodDetailsIdeal? = nil,
interacPresent: ChargePaymentMethodDetailsInteracPresent? = nil,
klarna: ChargePaymentMethodDetailsKlarna? = nil,
konbini: ChargePaymentMethodDetailsKobini? = nil,
multibanco: ChargePaymentMethodDetailsMultibanco? = nil,
oxxo: ChargePaymentMethodDetailsOXXO? = nil,
p24: ChargePaymentMethodDetailsP24? = nil,
paynow: ChargePaymentMethodDetailsPaynow? = nil,
pix: ChargePaymentMethodDetailsPix? = nil,
promptpay: ChargePaymentMethodDetailsPromptpay? = nil,
sepaDebit: ChargePaymentMethodDetailsSepaDebit? = nil,
sofort: ChargePaymentMethodDetailsSofort? = nil,
stripeAccount: ChargePaymentMethodDetailsStripeAccount? = nil,
type: ChargePaymentMethodDetailsType? = nil,
usBankAccount: ChargePaymentMethodDetailsUSBankAccount? = nil,
wechat: ChargePaymentMethodDetailsWechat? = nil,
wechatPay: ChargePaymentMethodDetailsWechatPay? = nil) {
achDebit: ChargePaymentMethodDetailsACHDebit? = nil,
acssDebit: ChargePaymentMethodDetailsACSSDebit? = nil,
affirm: ChargePaymentMethodDetailsAffirm? = nil,
afterpayClearpay: ChargePaymentMethodDetailsAfterpayClearpay? = nil,
alipay: ChargePaymentMethodDetailsAlipay? = nil,
auBecsDebit: ChargePaymentMethodDetailsAuBecsDebit? = nil,
bacsDebit: ChargePaymentMethodDetailsBacsDebit? = nil,
bancontact: ChargePaymentMethodDetailsBancontact? = nil,
blik: ChargePaymentMethodDetailsBlik? = nil,
boleto: ChargePaymentMethodDetailsBoleto? = nil,
card: ChargePaymentMethodDetailsCard? = nil,
cardPresent: ChargePaymentMethodDetailsCardPresent? = nil,
cashapp: ChargePaymentMethodDetailsCashApp? = nil,
customerBalance: ChargePaymentMethodDetailsCustomerBalance? = nil,
eps: ChargePaymentMethodDetailsEPS? = nil,
fpx: ChargePaymentMethodDetailsFpx? = nil,
grabpay: ChargePaymentMethodDetailsGrabpay? = nil,
giropay: ChargePaymentMethodDetailsGiropay? = nil,
ideal: ChargePaymentMethodDetailsIdeal? = nil,
interacPresent: ChargePaymentMethodDetailsInteracPresent? = nil,
klarna: ChargePaymentMethodDetailsKlarna? = nil,
konbini: ChargePaymentMethodDetailsKobini? = nil,
link: ChargePaymentMethodDetailsLink? = nil,
multibanco: ChargePaymentMethodDetailsMultibanco? = nil,
oxxo: ChargePaymentMethodDetailsOXXO? = nil,
p24: ChargePaymentMethodDetailsP24? = nil,
paynow: ChargePaymentMethodDetailsPaynow? = nil,
paypal: ChargePaymentMethodDetailsPaypal? = nil,
pix: ChargePaymentMethodDetailsPix? = nil,
promptpay: ChargePaymentMethodDetailsPromptpay? = nil,
sepaDebit: ChargePaymentMethodDetailsSepaDebit? = nil,
sofort: ChargePaymentMethodDetailsSofort? = nil,
stripeAccount: ChargePaymentMethodDetailsStripeAccount? = nil,
type: ChargePaymentMethodDetailsType? = nil,
usBankAccount: ChargePaymentMethodDetailsUSBankAccount? = nil,
wechat: ChargePaymentMethodDetailsWechat? = nil,
wechatPay: ChargePaymentMethodDetailsWechatPay? = nil,
zip: ChargePaymentMethodDetailsZip? = nil) {
self.achCreditTransfer = achCreditTransfer
self.achDebit = achDebit
self.acssDebit = acssDebit
Expand All @@ -461,6 +473,7 @@ public struct ChargePaymentMethodDetails: Codable {
self.boleto = boleto
self.card = card
self.cardPresent = cardPresent
self.cashapp = cashapp
self.customerBalance = customerBalance
self.eps = eps
self.fpx = fpx
Expand All @@ -469,11 +482,13 @@ public struct ChargePaymentMethodDetails: Codable {
self.ideal = ideal
self.interacPresent = interacPresent
self.klarna = klarna
self.link = link
self.konbini = konbini
self.multibanco = multibanco
self.oxxo = oxxo
self.p24 = p24
self.paynow = paynow
self.paypal = paypal
self.pix = pix
self.promptpay = promptpay
self.sepaDebit = sepaDebit
Expand All @@ -483,6 +498,7 @@ public struct ChargePaymentMethodDetails: Codable {
self.usBankAccount = usBankAccount
self.wechat = wechat
self.wechatPay = wechatPay
self.zip = zip
}
}

Expand Down Expand Up @@ -510,10 +526,12 @@ public enum ChargePaymentMethodDetailsType: String, Codable {
case interacPresent = "interac_present"
case klarna
case konbini
case link
case multibanco
case oxxo
case p24
case paynow
case paypal
case pix
case promptpay
case sepaDebit = "sepa_debit"
Expand All @@ -522,6 +540,7 @@ public enum ChargePaymentMethodDetailsType: String, Codable {
case usBankAccount = "us_bank_account"
case wechat
case wechatPay = "wechat_pay"
case zip
}

public struct ChrageRadarOptions: Codable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,20 @@ public enum ChargePaymentMethodDetailsCardThreeDSecureResultReason: String, Coda
case protocolError = "protocol_error"
}

// MARK: - Cashapp
public struct ChargePaymentMethodDetailsCashApp: Codable {
/// A unique and immutable identifier assigned by Cash App to every buyer.
public var buyerId: String?
/// A public identifier for buyers using Cash App.
public var cashtag: String?

public init(buyerId: String? = nil,
cashtag: String? = nil) {
self.buyerId = buyerId
self.cashtag = cashtag
}
}

// MARK: - Wallet
public struct ChargePaymentMethodDetailsCardWallet: Codable {
/// If this is a `amex_express_checkout` card wallet, this hash contains details about the wallet.
Expand Down Expand Up @@ -1001,7 +1015,12 @@ public struct ChargePaymentMethodDetailsKobiniStore: Codable {

// MARK: - Link
public struct ChargePaymentMethodDetailsLink: Codable {
public init() {}
/// Two-letter ISO code representing the funding source country beneath the Link payment. You could use this attribute to get a sense of international fees.
public var country: String?

public init(country: String?) {
self.country = country
}
}

// MARK: - Multibanco
Expand Down Expand Up @@ -1083,6 +1102,49 @@ public struct ChargePaymentMethodDetailsPaynow: Codable {
}
}

// MARK: - Paypal
public struct ChargePaymentMethodDetailsPaypal: Codable {
/// Owner’s email. Values are provided by PayPal directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
public var payerEmail: String?
/// PayPal account PayerID. This identifier uniquely identifies the PayPal customer.
public var payerId: String?
/// Owner’s full name. Values provided by PayPal directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
public var payerName: String?
/// The level of protection offered as defined by PayPal Seller Protection for Merchants, for this transaction.
public var sellerProtection: ChargePaymentMethodDetailsPaypalSellerProtection?
/// A unique ID generated by PayPal for this transaction.
public var transactionId: String?
}

public struct ChargePaymentMethodDetailsPaypalSellerProtection: Codable {
/// An array of conditions that are covered for the transaction, if applicable.
public var disputeCategories: [ChargePaymentMethodDetailsPaypalSellerProtectionDisputeCategory]?
/// Indicates whether the transaction is eligible for PayPal’s seller protection.
public var status: ChargePaymentMethodDetailsPaypalSellerProtectionStatus?

public init(disputeCategories: [ChargePaymentMethodDetailsPaypalSellerProtectionDisputeCategory]? = nil,
status: ChargePaymentMethodDetailsPaypalSellerProtectionStatus? = nil) {
self.disputeCategories = disputeCategories
self.status = status
}
}

public enum ChargePaymentMethodDetailsPaypalSellerProtectionDisputeCategory: String, Codable {
/// The payer paid for an item that they did not receive.
case productNotReceived = "product_not_received"
/// The payer did not authorize the payment.
case fraudulent
}

public enum ChargePaymentMethodDetailsPaypalSellerProtectionStatus: String, Codable {
/// Your balance remains intact if the customer claims that they did not receive an item or the account holder claims that they did not authorize the payment.
case eligible
/// Your balance remains intact if the customer claims that they did not receive an item.
case partiallyEligible = "partially_eligible"
/// This transaction is not eligible for seller protection.
case notEligible = "not_eligible"
}

// MARK: - Pix
public struct ChargePaymentMethodDetailsPix: Codable {
/// Unique transaction id generated by BCB
Expand Down Expand Up @@ -1242,3 +1304,8 @@ public struct ChargePaymentMethodDetailsWechatPay: Codable {
self.transactionId = transactionId
}
}

// MARK: - Zip
public struct ChargePaymentMethodDetailsZip: Codable {
public init() {}
}

0 comments on commit 4dc40c3

Please sign in to comment.