Skip to content

Commit

Permalink
[PAY-2040] Payment Sheet Displayed On Unrelated Context (#1752)
Browse files Browse the repository at this point in the history
* allow tracking incorrect page display for payment sheet

create function calls for calling vm from vc, ensure nil value still sends the property name. No need to send user information.

* found a way to prevent analytics altogether and prevent display of the payment sheet on unintended context.

* naming variable correction.
  • Loading branch information
msadoon committed Oct 27, 2022
1 parent d954d24 commit e61111e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Expand Up @@ -187,11 +187,16 @@ internal final class PaymentMethodsViewController: UIViewController, MessageBann
strongSelf.messageBannerViewController?
.showBanner(with: .error, message: error.localizedDescription)
case let .success(paymentSheetFlowController):
strongSelf.paymentSheetFlowController = paymentSheetFlowController
strongSelf.paymentSheetFlowController?.presentPaymentOptions(from: strongSelf) { [weak self] in
guard let strongSelf = self else { return }
let topViewController = strongSelf.navigationController?.topViewController
let paymentSheetShownWithinPaymentMethodsContext = topViewController is PaymentMethodsViewController

strongSelf.confirmPaymentResult(with: data.clientSecret)
if paymentSheetShownWithinPaymentMethodsContext {
strongSelf.paymentSheetFlowController = paymentSheetFlowController
strongSelf.paymentSheetFlowController?.presentPaymentOptions(from: strongSelf) { [weak self] in
guard let strongSelf = self else { return }

strongSelf.confirmPaymentResult(with: data.clientSecret)
}
}
}
}
Expand Down
Expand Up @@ -172,11 +172,16 @@ final class PledgePaymentMethodsViewController: UIViewController {
strongSelf.messageDisplayingDelegate?
.pledgeViewController(strongSelf, didErrorWith: error.localizedDescription)
case let .success(paymentSheetFlowController):
strongSelf.paymentSheetFlowController = paymentSheetFlowController
strongSelf.paymentSheetFlowController?.presentPaymentOptions(from: strongSelf) { [weak self] in
guard let strongSelf = self else { return }
let topViewController = strongSelf.navigationController?.topViewController
let paymentSheetShownWithinPledgeContext = topViewController is PledgeViewController

strongSelf.confirmPaymentResult(with: data.clientSecret)
if paymentSheetShownWithinPledgeContext {
strongSelf.paymentSheetFlowController = paymentSheetFlowController
strongSelf.paymentSheetFlowController?.presentPaymentOptions(from: strongSelf) { [weak self] in
guard let strongSelf = self else { return }

strongSelf.confirmPaymentResult(with: data.clientSecret)
}
}
}
}
Expand Down

0 comments on commit e61111e

Please sign in to comment.