Skip to content

Commit e1b48d6

Browse files
authored
Merge pull request #6039 from woocommerce/issue/5976-charge-model
[Mobile Payments] Add WCPayCharge model
2 parents 99cf350 + 9548f08 commit e1b48d6

12 files changed

+608
-2
lines changed

Fakes/Fakes/Networking.generated.swift

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,13 +1644,105 @@ extension WCPayAccountStatusEnum {
16441644
.complete
16451645
}
16461646
}
1647+
extension WCPayCardBrand {
1648+
/// Returns a "ready to use" type filled with fake values.
1649+
///
1650+
public static func fake() -> WCPayCardBrand {
1651+
.amex
1652+
}
1653+
}
1654+
extension WCPayCardFunding {
1655+
/// Returns a "ready to use" type filled with fake values.
1656+
///
1657+
public static func fake() -> WCPayCardFunding {
1658+
.credit
1659+
}
1660+
}
1661+
extension WCPayCardPaymentDetails {
1662+
/// Returns a "ready to use" type filled with fake values.
1663+
///
1664+
public static func fake() -> WCPayCardPaymentDetails {
1665+
.init(
1666+
brand: .fake(),
1667+
last4: .fake(),
1668+
funding: .fake()
1669+
)
1670+
}
1671+
}
1672+
extension WCPayCardPresentPaymentDetails {
1673+
/// Returns a "ready to use" type filled with fake values.
1674+
///
1675+
public static func fake() -> WCPayCardPresentPaymentDetails {
1676+
.init(
1677+
brand: .fake(),
1678+
last4: .fake(),
1679+
funding: .fake(),
1680+
receipt: .fake()
1681+
)
1682+
}
1683+
}
1684+
extension WCPayCardPresentReceiptDetails {
1685+
/// Returns a "ready to use" type filled with fake values.
1686+
///
1687+
public static func fake() -> WCPayCardPresentReceiptDetails {
1688+
.init(
1689+
accountType: .fake(),
1690+
applicationPreferredName: .fake(),
1691+
dedicatedFileName: .fake()
1692+
)
1693+
}
1694+
}
1695+
extension WCPayCharge {
1696+
/// Returns a "ready to use" type filled with fake values.
1697+
///
1698+
public static func fake() -> WCPayCharge {
1699+
.init(
1700+
siteID: .fake(),
1701+
id: .fake(),
1702+
amount: .fake(),
1703+
amountCaptured: .fake(),
1704+
amountRefunded: .fake(),
1705+
authorizationCode: .fake(),
1706+
captured: .fake(),
1707+
created: .fake(),
1708+
currency: .fake(),
1709+
paid: .fake(),
1710+
paymentIntentID: .fake(),
1711+
paymentMethodID: .fake(),
1712+
paymentMethodDetails: .fake(),
1713+
refunded: .fake(),
1714+
status: .fake()
1715+
)
1716+
}
1717+
}
1718+
extension WCPayChargeStatus {
1719+
/// Returns a "ready to use" type filled with fake values.
1720+
///
1721+
public static func fake() -> WCPayChargeStatus {
1722+
.succeeded
1723+
}
1724+
}
16471725
extension WCPayPaymentIntentStatusEnum {
16481726
/// Returns a "ready to use" type filled with fake values.
16491727
///
16501728
public static func fake() -> WCPayPaymentIntentStatusEnum {
16511729
.requiresPaymentMethod
16521730
}
16531731
}
1732+
extension WCPayPaymentMethodDetails {
1733+
/// Returns a "ready to use" type filled with fake values.
1734+
///
1735+
public static func fake() -> WCPayPaymentMethodDetails {
1736+
.unknown
1737+
}
1738+
}
1739+
extension WCPayPaymentMethodType {
1740+
/// Returns a "ready to use" type filled with fake values.
1741+
///
1742+
public static func fake() -> WCPayPaymentMethodType {
1743+
.card
1744+
}
1745+
}
16541746
extension WordPressMedia {
16551747
/// Returns a "ready to use" type filled with fake values.
16561748
///

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,16 @@
7676
02E7FFCB256218F600C53030 /* ShippingLabelRemoteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02E7FFCA256218F600C53030 /* ShippingLabelRemoteTests.swift */; };
7777
02E7FFCF25621C7900C53030 /* shipping-label-print.json in Resources */ = {isa = PBXBuildFile; fileRef = 02E7FFCE25621C7900C53030 /* shipping-label-print.json */; };
7878
02F096C22406691100C0C1D5 /* media-library.json in Resources */ = {isa = PBXBuildFile; fileRef = 02F096C12406691100C0C1D5 /* media-library.json */; };
79+
0329CF9B27A82E19008AFF91 /* WCPayCharge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0329CF9A27A82E19008AFF91 /* WCPayCharge.swift */; };
7980
034480C327A42F9100DFACD2 /* order-with-charge.json in Resources */ = {isa = PBXBuildFile; fileRef = 034480C227A42F9100DFACD2 /* order-with-charge.json */; };
81+
0359EA0D27AAC5F80048DE2D /* WCPayChargeStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359EA0C27AAC5F80048DE2D /* WCPayChargeStatus.swift */; };
82+
0359EA0F27AAC6410048DE2D /* WCPayPaymentMethodDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359EA0E27AAC6410048DE2D /* WCPayPaymentMethodDetails.swift */; };
83+
0359EA1127AAC6740048DE2D /* WCPayPaymentMethodType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359EA1027AAC6740048DE2D /* WCPayPaymentMethodType.swift */; };
84+
0359EA1327AAC6D00048DE2D /* WCPayCardPaymentDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359EA1227AAC6D00048DE2D /* WCPayCardPaymentDetails.swift */; };
85+
0359EA1527AAC7460048DE2D /* WCPayCardBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359EA1427AAC7460048DE2D /* WCPayCardBrand.swift */; };
86+
0359EA1727AAC7740048DE2D /* WCPayCardFunding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359EA1627AAC7740048DE2D /* WCPayCardFunding.swift */; };
87+
0359EA1927AAC79E0048DE2D /* WCPayCardPresentPaymentDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359EA1827AAC79E0048DE2D /* WCPayCardPresentPaymentDetails.swift */; };
88+
0359EA1B27AAC7CC0048DE2D /* WCPayCardPresentReceiptDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359EA1A27AAC7CC0048DE2D /* WCPayCardPresentReceiptDetails.swift */; };
8089
03DCB72626244B9B00C8953D /* Coupon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03DCB72526244B9B00C8953D /* Coupon.swift */; };
8190
03DCB7402624AD7D00C8953D /* CouponListMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03DCB73F2624AD7D00C8953D /* CouponListMapper.swift */; };
8291
03DCB7442624AD9B00C8953D /* CouponListMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03DCB7432624AD9A00C8953D /* CouponListMapperTests.swift */; };
@@ -735,7 +744,16 @@
735744
02E7FFCA256218F600C53030 /* ShippingLabelRemoteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelRemoteTests.swift; sourceTree = "<group>"; };
736745
02E7FFCE25621C7900C53030 /* shipping-label-print.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "shipping-label-print.json"; sourceTree = "<group>"; };
737746
02F096C12406691100C0C1D5 /* media-library.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "media-library.json"; sourceTree = "<group>"; };
747+
0329CF9A27A82E19008AFF91 /* WCPayCharge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayCharge.swift; sourceTree = "<group>"; };
738748
034480C227A42F9100DFACD2 /* order-with-charge.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "order-with-charge.json"; sourceTree = "<group>"; };
749+
0359EA0C27AAC5F80048DE2D /* WCPayChargeStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayChargeStatus.swift; sourceTree = "<group>"; };
750+
0359EA0E27AAC6410048DE2D /* WCPayPaymentMethodDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayPaymentMethodDetails.swift; sourceTree = "<group>"; };
751+
0359EA1027AAC6740048DE2D /* WCPayPaymentMethodType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayPaymentMethodType.swift; sourceTree = "<group>"; };
752+
0359EA1227AAC6D00048DE2D /* WCPayCardPaymentDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayCardPaymentDetails.swift; sourceTree = "<group>"; };
753+
0359EA1427AAC7460048DE2D /* WCPayCardBrand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayCardBrand.swift; sourceTree = "<group>"; };
754+
0359EA1627AAC7740048DE2D /* WCPayCardFunding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayCardFunding.swift; sourceTree = "<group>"; };
755+
0359EA1827AAC79E0048DE2D /* WCPayCardPresentPaymentDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayCardPresentPaymentDetails.swift; sourceTree = "<group>"; };
756+
0359EA1A27AAC7CC0048DE2D /* WCPayCardPresentReceiptDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WCPayCardPresentReceiptDetails.swift; sourceTree = "<group>"; };
739757
03DCB72526244B9B00C8953D /* Coupon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coupon.swift; sourceTree = "<group>"; };
740758
03DCB73F2624AD7D00C8953D /* CouponListMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponListMapper.swift; sourceTree = "<group>"; };
741759
03DCB7432624AD9A00C8953D /* CouponListMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponListMapperTests.swift; sourceTree = "<group>"; };
@@ -1754,13 +1772,22 @@
17541772
3148976F27232982007A86BD /* SystemStatus.swift */,
17551773
DEC51AE527684717009F3DF4 /* SystemStatusDetails */,
17561774
450106842399A7CB00E24722 /* TaxClass.swift */,
1757-
3192F21F260D33BB0067FEF9 /* WCPayAccount.swift */,
17581775
31799AF7270508C600D78179 /* RemoteReaderLocation.swift */,
1759-
3192F223260D34C40067FEF9 /* WCPayAccountStatusEnum.swift */,
17601776
D8EDFE2125EE88C9003D2213 /* ReaderConnectionToken.swift */,
17611777
318E8FD426C31F9500F519D7 /* Customer.swift */,
17621778
31054705262E278100C5C02B /* RemotePaymentIntent.swift */,
1779+
3192F21F260D33BB0067FEF9 /* WCPayAccount.swift */,
1780+
3192F223260D34C40067FEF9 /* WCPayAccountStatusEnum.swift */,
1781+
0359EA1627AAC7740048DE2D /* WCPayCardFunding.swift */,
1782+
0359EA1827AAC79E0048DE2D /* WCPayCardPresentPaymentDetails.swift */,
1783+
0359EA1A27AAC7CC0048DE2D /* WCPayCardPresentReceiptDetails.swift */,
1784+
0359EA1427AAC7460048DE2D /* WCPayCardBrand.swift */,
1785+
0359EA1227AAC6D00048DE2D /* WCPayCardPaymentDetails.swift */,
1786+
0329CF9A27A82E19008AFF91 /* WCPayCharge.swift */,
1787+
0359EA0C27AAC5F80048DE2D /* WCPayChargeStatus.swift */,
17631788
3105470B262E27F000C5C02B /* WCPayPaymentIntentStatusEnum.swift */,
1789+
0359EA0E27AAC6410048DE2D /* WCPayPaymentMethodDetails.swift */,
1790+
0359EA1027AAC6740048DE2D /* WCPayPaymentMethodType.swift */,
17641791
FE28F6E126840DED004465C7 /* User.swift */,
17651792
);
17661793
path = Model;
@@ -2687,6 +2714,7 @@
26872714
D89A01D426D3F8D9008195BE /* ReaderLocation.swift in Sources */,
26882715
74C8F06420EEB44800B6EDC9 /* OrderNote.swift in Sources */,
26892716
02C254AC2563781800A04423 /* ShippingLabelStatus.swift in Sources */,
2717+
0359EA1B27AAC7CC0048DE2D /* WCPayCardPresentReceiptDetails.swift in Sources */,
26902718
74ABA1D3213F25AE00FFAD30 /* TopEarnerStatsMapper.swift in Sources */,
26912719
020D07B823D852BB00FD9580 /* Media.swift in Sources */,
26922720
B5BB1D0C20A2050300112D92 /* DateFormatter+Woo.swift in Sources */,
@@ -2729,6 +2757,7 @@
27292757
456930AB264EB85A009ED69D /* ShippingLabelCarriersAndRatesMapper.swift in Sources */,
27302758
CCF48AD4262864CB0034EA83 /* ShippingLabelAccountSettings.swift in Sources */,
27312759
CE12FBD9221F3A6F00C59248 /* OrderStatus.swift in Sources */,
2760+
0359EA0F27AAC6410048DE2D /* WCPayPaymentMethodDetails.swift in Sources */,
27322761
7426CA1121AF30BD004E9FFC /* SiteAPIMapper.swift in Sources */,
27332762
57E8FED3246616AC0057CD68 /* Result+Extensions.swift in Sources */,
27342763
020D07BC23D856BF00FD9580 /* MediaRemote.swift in Sources */,
@@ -2862,8 +2891,10 @@
28622891
77CE40602514CB3E003FF69D /* ProductDownloadDragAndDrop.swift in Sources */,
28632892
2685C0FE263B5D8900D9EE97 /* AddOnGroupRemote.swift in Sources */,
28642893
450106912399B2C800E24722 /* TaxClassListMapper.swift in Sources */,
2894+
0329CF9B27A82E19008AFF91 /* WCPayCharge.swift in Sources */,
28652895
74749B97224134FF005C4CF2 /* ProductMapper.swift in Sources */,
28662896
26455E2A25F669F0008A1D32 /* ProductAttributeTermMapper.swift in Sources */,
2897+
0359EA1127AAC6740048DE2D /* WCPayPaymentMethodType.swift in Sources */,
28672898
026CF61A237D607A009563D4 /* ProductVariationAttribute.swift in Sources */,
28682899
D8FBFF1A22D4DF7A006E3336 /* OrderStatsV4.swift in Sources */,
28692900
74A1D26B21189B8100931DFA /* SiteVisitStatsItem.swift in Sources */,
@@ -2872,10 +2903,12 @@
28722903
314703082670222500EF253A /* PaymentGatewayAccount.swift in Sources */,
28732904
CCF48B282628A4EB0034EA83 /* ShippingLabelAccountSettingsMapper.swift in Sources */,
28742905
B5BB1D1220A255EC00112D92 /* OrderStatusEnum.swift in Sources */,
2906+
0359EA1727AAC7740048DE2D /* WCPayCardFunding.swift in Sources */,
28752907
D88E229425AC9B420023F3B1 /* OrderFeeTaxStatus.swift in Sources */,
28762908
B5DAEFF02180DD5A0002356A /* NotificationsRemote.swift in Sources */,
28772909
2665032A261F41510079A159 /* ProductAddOn.swift in Sources */,
28782910
020D07BE23D8570800FD9580 /* MediaListMapper.swift in Sources */,
2911+
0359EA1327AAC6D00048DE2D /* WCPayCardPaymentDetails.swift in Sources */,
28792912
CCB2CA9E262091CB00285CA0 /* SuccessDataResultMapper.swift in Sources */,
28802913
74C8F06820EEB7BD00B6EDC9 /* OrderNotesMapper.swift in Sources */,
28812914
24F98C582502EA8800F49B68 /* FeatureFlagMapper.swift in Sources */,
@@ -2927,14 +2960,17 @@
29272960
B59325D5217E4206000B0E8E /* NoteRange.swift in Sources */,
29282961
26B2F74324C545D50065CCC8 /* Leaderboard.swift in Sources */,
29292962
458C6DE425AC72A1009B300D /* StoredProductSettings.swift in Sources */,
2963+
0359EA1927AAC79E0048DE2D /* WCPayCardPresentPaymentDetails.swift in Sources */,
29302964
45150A9C2683417A006922EA /* StateOfACountry.swift in Sources */,
29312965
AEF9458B27297FF6001DCCFB /* IgnoringResponseMapper.swift in Sources */,
29322966
B59325C7217E22FC000B0E8E /* Note.swift in Sources */,
29332967
CE0A0F13223942D90075ED8D /* ProductImage.swift in Sources */,
29342968
D8FBFF0B22D3ADB1006E3336 /* OrderStatsRemoteV4.swift in Sources */,
29352969
029BA53B255DFABD006171FD /* ShippingLabelPrintDataMapper.swift in Sources */,
2970+
0359EA0D27AAC5F80048DE2D /* WCPayChargeStatus.swift in Sources */,
29362971
CE430674234BA6AD0073CBFF /* RefundMapper.swift in Sources */,
29372972
CE0A0F1B223989670075ED8D /* ProductsRemote.swift in Sources */,
2973+
0359EA1527AAC7460048DE2D /* WCPayCardBrand.swift in Sources */,
29382974
2665032E261F4FBF0079A159 /* ProductAddOnOption.swift in Sources */,
29392975
028296F7237D588700E84012 /* ProductVariation.swift in Sources */,
29402976
DEC51AEF2768A628009F3DF4 /* SystemStatus+Database.swift in Sources */,

Networking/Networking/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,117 @@ extension TopEarnerStatsItem {
16991699
}
17001700
}
17011701

1702+
extension WCPayCardPaymentDetails {
1703+
public func copy(
1704+
brand: CopiableProp<WCPayCardBrand> = .copy,
1705+
last4: CopiableProp<String> = .copy,
1706+
funding: CopiableProp<WCPayCardFunding> = .copy
1707+
) -> WCPayCardPaymentDetails {
1708+
let brand = brand ?? self.brand
1709+
let last4 = last4 ?? self.last4
1710+
let funding = funding ?? self.funding
1711+
1712+
return WCPayCardPaymentDetails(
1713+
brand: brand,
1714+
last4: last4,
1715+
funding: funding
1716+
)
1717+
}
1718+
}
1719+
1720+
extension WCPayCardPresentPaymentDetails {
1721+
public func copy(
1722+
brand: CopiableProp<WCPayCardBrand> = .copy,
1723+
last4: CopiableProp<String> = .copy,
1724+
funding: CopiableProp<WCPayCardFunding> = .copy,
1725+
receipt: CopiableProp<WCPayCardPresentReceiptDetails> = .copy
1726+
) -> WCPayCardPresentPaymentDetails {
1727+
let brand = brand ?? self.brand
1728+
let last4 = last4 ?? self.last4
1729+
let funding = funding ?? self.funding
1730+
let receipt = receipt ?? self.receipt
1731+
1732+
return WCPayCardPresentPaymentDetails(
1733+
brand: brand,
1734+
last4: last4,
1735+
funding: funding,
1736+
receipt: receipt
1737+
)
1738+
}
1739+
}
1740+
1741+
extension WCPayCardPresentReceiptDetails {
1742+
public func copy(
1743+
accountType: CopiableProp<WCPayCardFunding> = .copy,
1744+
applicationPreferredName: CopiableProp<String> = .copy,
1745+
dedicatedFileName: CopiableProp<String> = .copy
1746+
) -> WCPayCardPresentReceiptDetails {
1747+
let accountType = accountType ?? self.accountType
1748+
let applicationPreferredName = applicationPreferredName ?? self.applicationPreferredName
1749+
let dedicatedFileName = dedicatedFileName ?? self.dedicatedFileName
1750+
1751+
return WCPayCardPresentReceiptDetails(
1752+
accountType: accountType,
1753+
applicationPreferredName: applicationPreferredName,
1754+
dedicatedFileName: dedicatedFileName
1755+
)
1756+
}
1757+
}
1758+
1759+
extension WCPayCharge {
1760+
public func copy(
1761+
siteID: CopiableProp<Int64> = .copy,
1762+
id: CopiableProp<String> = .copy,
1763+
amount: CopiableProp<Int64> = .copy,
1764+
amountCaptured: CopiableProp<Int64> = .copy,
1765+
amountRefunded: CopiableProp<Int64> = .copy,
1766+
authorizationCode: NullableCopiableProp<String> = .copy,
1767+
captured: CopiableProp<Bool> = .copy,
1768+
created: CopiableProp<Date> = .copy,
1769+
currency: CopiableProp<String> = .copy,
1770+
paid: CopiableProp<Bool> = .copy,
1771+
paymentIntentID: NullableCopiableProp<String> = .copy,
1772+
paymentMethodID: CopiableProp<String> = .copy,
1773+
paymentMethodDetails: CopiableProp<WCPayPaymentMethodDetails> = .copy,
1774+
refunded: CopiableProp<Bool> = .copy,
1775+
status: CopiableProp<WCPayChargeStatus> = .copy
1776+
) -> WCPayCharge {
1777+
let siteID = siteID ?? self.siteID
1778+
let id = id ?? self.id
1779+
let amount = amount ?? self.amount
1780+
let amountCaptured = amountCaptured ?? self.amountCaptured
1781+
let amountRefunded = amountRefunded ?? self.amountRefunded
1782+
let authorizationCode = authorizationCode ?? self.authorizationCode
1783+
let captured = captured ?? self.captured
1784+
let created = created ?? self.created
1785+
let currency = currency ?? self.currency
1786+
let paid = paid ?? self.paid
1787+
let paymentIntentID = paymentIntentID ?? self.paymentIntentID
1788+
let paymentMethodID = paymentMethodID ?? self.paymentMethodID
1789+
let paymentMethodDetails = paymentMethodDetails ?? self.paymentMethodDetails
1790+
let refunded = refunded ?? self.refunded
1791+
let status = status ?? self.status
1792+
1793+
return WCPayCharge(
1794+
siteID: siteID,
1795+
id: id,
1796+
amount: amount,
1797+
amountCaptured: amountCaptured,
1798+
amountRefunded: amountRefunded,
1799+
authorizationCode: authorizationCode,
1800+
captured: captured,
1801+
created: created,
1802+
currency: currency,
1803+
paid: paid,
1804+
paymentIntentID: paymentIntentID,
1805+
paymentMethodID: paymentMethodID,
1806+
paymentMethodDetails: paymentMethodDetails,
1807+
refunded: refunded,
1808+
status: status
1809+
)
1810+
}
1811+
}
1812+
17021813
extension WordPressMedia {
17031814
public func copy(
17041815
mediaID: CopiableProp<Int64> = .copy,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Foundation
2+
import Codegen
3+
4+
/// Model for card brands as returned from WCPay.
5+
///
6+
/// This is returned as part of the response from the `/payments/charges/<charge_id>` WCPay endpoint.
7+
/// The endpoint returns a thin wrapper around the Stripe object, so
8+
/// [these docs are relevant](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-brand)
9+
///
10+
public enum WCPayCardBrand: String, Codable, GeneratedCopiable, GeneratedFakeable, Equatable {
11+
case amex
12+
case diners
13+
case discover
14+
case jcb
15+
case mastercard
16+
case unionpay
17+
case visa
18+
case unknown
19+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Foundation
2+
import Codegen
3+
4+
/// Model containing information about how a card is funded
5+
///
6+
/// This is returned as part of the response from the `/payments/charges/<charge_id>` WCPay endpoint.
7+
/// The endpoint returns a thin wrapper around the Stripe object, so
8+
/// [these docs are relevant](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-funding)
9+
///
10+
/// e.g. `credit`, `debit`, `prepaid`
11+
///
12+
public enum WCPayCardFunding: String, Codable, GeneratedCopiable, GeneratedFakeable, Equatable {
13+
case credit
14+
case debit
15+
case prepaid
16+
case unknown
17+
}

0 commit comments

Comments
 (0)