Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @objc func fetchPersonalData() {
- let personalDataGet = PayPersonalDataGet()
- var viewController: UIViewController?
- personalDataGet.execute(success: { [weak self] response in
- if response.resultCode == 1 && response.result == nil {
- viewController = self?.storyboard?.instantiateViewController(withIdentifier: "PayVerificationWelcomeVC")
- self?.navigationController?.pushViewController(viewController!, animated: true)
- return
- }
- PayVerificationManager.shared.personalData = response.result
- guard let status = response.result?.checkStatus else { return }
- switch status {
- case .INITIAL, .PERSONAL_DATA_VALIDATE_REJECTED, .SIGNED_DOCUMENTS_STORING_FAILED:
- viewController = self?.storyboard?.instantiateViewController(withIdentifier: "PayVerificationWelcomeVC")
- case .DOCUMENTS_UPLOADED:
- viewController = self?.storyboard?.instantiateViewController(withIdentifier: "PayVerificationPersonalDetailsVC")
- case .PERSONAL_DATA_VALIDATE_PASSED, .PERSONAL_DATA_UPDATE_REJECTED:
- viewController = self?.storyboard?.instantiateViewController(withIdentifier: "PayVerificationPlaceOfBirthVC")
- case .PERSONAL_DATA_UPDATE_PASSED, .FACE_MATCH_REJECTED:
- PayVerificationManager.shared.rootVC = UIApplication.shared.keyWindow?.rootViewController
- viewController = self?.storyboard?.instantiateViewController(withIdentifier: "PayVerificationSelfieVC")
- UIApplication.shared.keyWindow?.rootViewController = viewController
- return
- case .FACE_MATCH_PASSED, .SIGNATURE_STEP_STARTED, .SIGNATURE_STEP_REJECTED:
- let service = PayValidationSignature()
- service.execute(success: { response in
- let callVC = self?.storyboard?.instantiateViewController(withIdentifier: "PayVerificationCallVC") as? PayVerificationCallVC
- callVC?.url = response.result
- self?.navigationController?.pushViewController(callVC!, animated: true)
- }) { _ in }
- case .SIGNATURE_STEP_PASSED:
- break
- case .SIGNED_DOCUMENTS_STORED:
- if self?.issuingCard == true { return }
- self?.issuingCard = true
- let service = PayValidationIssueVirtualCard()
- service.execute(success: { response in
- if let cardToken = response.cardToken {
- let confirmService = PayValidationIssueVirtualCardConfirm(cardToken: cardToken)
- confirmService.execute(success: { response in
- self?.issuingCard = false
- }) { _ in
- self?.issuingCard = false
- }
- } else {
- self?.issuingCard = false
- }
- }) { _ in
- self?.issuingCard = false
- }
- break
- case .VALIDATION_FINISHED:
- break
- default:
- break
- }
- if let viewController = viewController {
- self?.navigationController?.pushViewController(viewController, animated: true)
- }
- }) { _ in }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement