Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to this project are documented in this file.

### Added

- **Apple Pay networks from iOS 26.2 to 27.** `PaymentNetwork` adds `conecs` (iOS 26.2),
`elCorteIngles` (iOS 26.4) and `ruPay`, `verve`, `humo`, `uzCard`, `payPak`, `maal` and `elcard`
(iOS 27). A request may name them, and a card on one of them is reported by name instead of
`'unknown'`. Each needs an app built with the Xcode whose iOS SDK adds it (26.2, 26.4 or 27);
Comment thread
jkasprzyk17 marked this conversation as resolved.
Resolved
an older Xcode still builds and leaves it out. Google Pay offers none of them
([#79](https://github.com/gmi-software/react-native-pay/issues/79)).
- **Cart updates in the Google Pay sheet.** Android now calls `onShippingAddressChange`,
`onShippingMethodChange` and `onPaymentMethodChange` through Google Pay's payment data callbacks
(`SHIPPING_ADDRESS`, `SHIPPING_OPTION`, `PAYMENT_METHOD`), with the same `PaymentSheetSelection`,
Expand Down Expand Up @@ -75,6 +81,13 @@ All notable changes to this project are documented in this file.

### Changed

- **`PaymentNetwork` has nine more values**, so `token.paymentMethod.network` can report
`conecs`, `elCorteIngles`, `ruPay`, `verve`, `humo`, `uzCard`, `payPak`, `maal` or `elcard`
for a card it reported as `'unknown'` before (see Added). An exhaustive `switch` over
`PaymentNetwork` stops compiling until it handles them, and code that treats `'unknown'` as
one of these cards now gets the network's name instead
([#79](https://github.com/gmi-software/react-native-pay/issues/79)).

- **Android: the payer picks the shipping method in the Google Pay sheet** when the payment has
a sheet callback, `shippingContactRequired` and `shippingMethods`, as on iOS. Before, Android
always charged the first method. `result.shippingMethod` and the `details` of `onAuthorize` hold
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,15 @@ type PaymentNetwork =
| "himyan"
| "jaywan"
| "myDebit"
| "conecs"
| "elCorteIngles"
| "ruPay"
| "verve"
| "humo"
| "uzCard"
| "payPak"
| "maal"
| "elcard"
| "unknown"; // results only

// Google Pay auth methods (Android). PAN_ONLY payments need a 3-D Secure step-up:
Expand Down
7 changes: 5 additions & 2 deletions docs/docs/api/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,17 @@ type PaymentNetwork =
| 'girocard' | 'mada' | 'mir' | 'quicPay' | 'suica' | 'vPay'
| 'waon' | 'nanaco' | 'bancontact' | 'postFinance' | 'pagoBancomat'
| 'tmoney' | 'meeza' | 'napas' | 'bankAxept' | 'himyan' | 'jaywan'
| 'myDebit'
| 'myDebit' | 'conecs' | 'elCorteIngles' | 'ruPay' | 'verve'
| 'humo' | 'uzCard' | 'payPak' | 'maal' | 'elcard'
| 'unknown' // results only
```

| Platform | Offers |
|----------|--------|
| Google Pay | `visa`, `mastercard`, `amex`, `discover`, `jcb`, `interac`, and `electron`, `maestro` and `elo` for Brazilian combo cards |
| Apple Pay | Every network but `unknown`. Some need a newer iOS: `bancontact` 16, `postFinance` 16.4, `pagoBancomat` and `tmoney` 17, `meeza` 17.4, `napas` and `bankAxept` 17.5, `himyan` and `jaywan` 18.4, `myDebit` 26 |
| Apple Pay | Every network but `unknown`. Some need a newer iOS: `bancontact` 16, `postFinance` 16.4, `pagoBancomat` and `tmoney` 17, `meeza` 17.4, `napas` and `bankAxept` 17.5, `himyan` and `jaywan` 18.4, `myDebit` 26, `conecs` 26.2, `elCorteIngles` 26.4, `ruPay`, `verve`, `humo`, `uzCard`, `payPak`, `maal` and `elcard` 27 |

An app built with an older Xcode leaves out the networks its iOS SDK lacks: `conecs` needs Xcode 26.2, `elCorteIngles` Xcode 26.4, and the iOS 27 networks Xcode 27.

`'unknown'` is never a valid request value. A result reports it for a card on a network that is not listed here, instead of guessing.

Expand Down
70 changes: 69 additions & 1 deletion package/ios/PassKitTypeMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ enum PassKitTypeMapper {
.idcredit, .interac, .privatelabel, .cartesbancaires, .chinaunionpay,
.dankort, .eftpos, .girocard, .mada, .mir, .quicpay, .suica, .vpay,
.waon, .nanaco, .bancontact, .postfinance, .pagobancomat, .tmoney,
.meeza, .napas, .bankaxept, .himyan, .jaywan, .mydebit,
.meeza, .napas, .bankaxept, .himyan, .jaywan, .mydebit, .conecs,
.elcorteingles, .rupay, .verve, .humo, .uzcard, .paypak, .maal, .elcard,
]

/// The network with this name, ignoring case, or nil for a name that is
Expand Down Expand Up @@ -117,6 +118,73 @@ enum PassKitTypeMapper {
case .mydebit:
guard #available(iOS 26.0, *) else { return nil }
return .myDebit
// Each network below needs the iOS SDK that adds it, so an app built
// with an older Xcode leaves it out. The compiler version tells the
// SDKs apart: Swift 6.2.3 ships with Xcode 26.2, 6.3 with 26.4, 6.4
// with 27.0.
case .conecs:
#if compiler(>=6.2.3)
guard #available(iOS 26.2, *) else { return nil }
return .conecs
#else
return nil
#endif
case .elcorteingles:
#if compiler(>=6.3)
guard #available(iOS 26.4, *) else { return nil }
return .elCorteIngles
#else
return nil
#endif
case .rupay:
#if compiler(>=6.4)
guard #available(iOS 27.0, *) else { return nil }
return .ruPay
#else
return nil
#endif
case .verve:
#if compiler(>=6.4)
guard #available(iOS 27.0, *) else { return nil }
return .verve
#else
return nil
#endif
case .humo:
#if compiler(>=6.4)
guard #available(iOS 27.0, *) else { return nil }
return .humo
#else
return nil
#endif
case .uzcard:
#if compiler(>=6.4)
guard #available(iOS 27.0, *) else { return nil }
return .uzCard
#else
return nil
#endif
case .paypak:
#if compiler(>=6.4)
guard #available(iOS 27.0, *) else { return nil }
return .payPak
#else
return nil
#endif
case .maal:
#if compiler(>=6.4)
guard #available(iOS 27.0, *) else { return nil }
return .maal
#else
return nil
#endif
case .elcard:
#if compiler(>=6.4)
guard #available(iOS 27.0, *) else { return nil }
return .elcard
#else
return nil
#endif
case .unknown: return nil
}
}
Expand Down
42 changes: 39 additions & 3 deletions package/ios/Tests/PassKitTypeMapperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,45 @@ final class PassKitTypeMapperTests: XCTestCase {
"cartesBancaires", "chinaUnionPay", "dankort", "eftpos", "girocard",
"mada", "mir", "quicPay", "suica", "vPay", "waon", "nanaco",
"bancontact", "postFinance", "pagoBancomat", "tmoney", "meeza",
"napas", "bankAxept", "himyan", "jaywan", "myDebit",
"napas", "bankAxept", "himyan", "jaywan", "myDebit", "conecs",
"elCorteIngles", "ruPay", "verve", "humo", "uzCard", "payPak", "maal",
"elcard",
]

// The first iOS with each network that is newer than iOS 15
private let minimumIOSVersions: [String: (Int, Int)] = [
"bancontact": (16, 0), "postFinance": (16, 4), "pagoBancomat": (17, 0),
"tmoney": (17, 0), "meeza": (17, 4), "napas": (17, 5),
"bankAxept": (17, 5), "himyan": (18, 4), "jaywan": (18, 4),
"myDebit": (26, 0), "conecs": (26, 2), "elCorteIngles": (26, 4),
"ruPay": (27, 0), "verve": (27, 0), "humo": (27, 0), "uzCard": (27, 0),
"payPak": (27, 0), "maal": (27, 0), "elcard": (27, 0),
]

// The networks the iOS SDK of this build lacks, as PassKitTypeMapper
// checks them
private var networksMissingFromSDK: Set<String> {
var names: Set<String> = []
#if !compiler(>=6.2.3)
names.insert("conecs")
#endif
#if !compiler(>=6.3)
names.insert("elCorteIngles")
#endif
#if !compiler(>=6.4)
names.formUnion(["ruPay", "verve", "humo", "uzCard", "payPak", "maal", "elcard"])
#endif
return names
}

private func isAvailable(_ name: String) -> Bool {
if networksMissingFromSDK.contains(name) { return false }
guard let (major, minor) = minimumIOSVersions[name] else { return true }
return ProcessInfo.processInfo.isOperatingSystemAtLeast(
OperatingSystemVersion(majorVersion: major, minorVersion: minor, patchVersion: 0)
)
}

// Swift drops this `convert` overload when it is looked up before the
// C++ `PaymentNetwork` enum is imported. Naming the type in a signature
// imports it first.
Expand All @@ -32,10 +68,10 @@ final class PassKitTypeMapperTests: XCTestCase {
let network = try XCTUnwrap(PassKitTypeMapper.paymentNetwork(named: name), name)
XCTAssertEqual(network.stringValue, name)
guard let pkNetwork = pkNetwork(named: name) else {
// Only a network newer than the simulator's iOS has none.
if #available(iOS 26.0, *) { XCTFail("No PassKit network for \(name)") }
XCTAssertFalse(isAvailable(name), "No PassKit network for \(name)")
continue
}
XCTAssertTrue(isAvailable(name), "\(name) is not on this iOS version")
XCTAssertEqual(convert(pkNetwork), PaymentNetwork(fromString: name), name)
}
XCTAssertEqual(pkNetwork(named: "mastercard"), .masterCard)
Expand Down
27 changes: 27 additions & 0 deletions package/nitrogen/generated/android/c++/JPaymentNetwork.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions package/nitrogen/generated/ios/swift/PaymentNetwork.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 37 additions & 1 deletion package/nitrogen/generated/shared/c++/PaymentNetwork.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions package/src/components/googlePayButtonConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ const PAYMENT_NETWORKS = {
himyan: false,
jaywan: false,
myDebit: false,
conecs: false,
elCorteIngles: false,
ruPay: false,
verve: false,
humo: false,
uzCard: false,
payPak: false,
maal: false,
elcard: false,
} satisfies Record<Exclude<PaymentNetwork, 'unknown'>, boolean>

const AUTH_METHODS: GooglePayAuthMethod[] = ['PAN_ONLY', 'CRYPTOGRAM_3DS']
Expand Down
Loading
Loading