richnologies / ngx-stripe

Angular 6+ wrapper for StripeJS
MIT License
217 stars 77 forks source link

Payment Dialog Not Closing on Abort Method Call Before/After Payment Intent Creation #240

Open HelloooJoe opened 8 months ago

HelloooJoe commented 8 months ago

Describe the bug The payment dialog remains open even after calling the abort method on the StripePaymentRequestButtonComponent. This occurs when the payment process is meant to be aborted due to the absence of the payer's name. Despite calling ev.complete('fail') followed by this.paymentRequestButton.abort(), the dialog persists.

@ViewChild(StripePaymentRequestButtonComponent) paymentRequestButton: StripePaymentRequestButtonComponent;

onPaymentMethod(ev: PaymentRequestPaymentMethodEvent) {
  const name = ev.payerName;

  // If the name is not provided, then abort the payment process
  if (!name) {
    ev.complete('fail');
    this.paymentRequestButton.abort();
    this._changeDetectorRef.markForCheck();
    return;
  }

  // ... Create Payment Intent logic
}

To Reproduce Steps to reproduce the behavior:

  1. Click on a digital wallet payment option.
  2. Complete the payment information and click on "Pay".
  3. Observe the code invoke the abort method to cancel the payment.
  4. Notice that the payment dialog does not close as expected.

image

Expected behavior When this.paymentRequestButton.abort() is called, the payment dialog should close, indicating the payment process has been halted due to missing payer information.

Desktop (please complete the following information):

Additional context The issue occurs within an Angular application using the ngx-stripe library. All dependencies are up to date with their latest versions. "ngx-stripe": "^17.0.1" & "@stripe/stripe-js": "^2.3.0" No console errors are observed when the issue occurs.