Created
September 5, 2019 19:29
-
-
Save philipshen/1b1291ddccf6b7d05df82730fad3bf3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let request = self.paymentRepository.createPKRequest(order: order) | |
if self.paymentRepository.canSubmit(paymentRequest: request) { | |
group.enter() | |
let paymentController = PaymentAuthorizationController() | |
paymentController.present(paymentRequest: request) { [weak self] controller, payment, authCompletion in | |
self?.paymentRepository.createStripeToken(payment: payment, completion: { token, error in | |
defer { group.leave() } | |
guard let token = token, error == nil else { | |
return | |
} | |
fetchedPaymentToken = token | |
}) | |
} | |
} else { | |
return completion(.init(code: .failureNoPaymentMethod, userActivity: nil)) | |
} | |
} | |
group.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment