Мы должны добавить дебетовые / кредитные карты из приложения в Apple Wallet
let config = PKAddPaymentPassRequestConfiguration.init(encryptionScheme: PKEncryptionScheme.ECC_V2)
config?.cardholderName = "John"
config?.primaryAccountSuffix = "9999" //last 4 or 5digits of card
config?.localizedDescription = "This will add the card to Apple Pay";
config?.primaryAccountIdentifier = "test";
config?.paymentNetwork = PKPaymentNetwork(rawValue: "VISA");
guard let addPaymentPassVC = PKAddPaymentPassViewController.init(requestConfiguration: config!, delegate: self) else { return }
self.present(addPaymentPassVC, animated: true, completion: nil)
extension ViewController: PKAddPaymentPassViewControllerDelegate {
func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController,
generateRequestWithCertificateChain certificates: [Data],
nonce: Data,
nonceSignature: Data,
completionHandler handler: @escaping (PKAddPaymentPassRequest) -> Void) {
}
func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController,
didFinishAdding pass: PKPaymentPass?,
error: Error?) {
print("didFinishAdding")
}
}
Какой должна быть реализация для методов PKAddPaymentPassViewControllerDelegate?