razorpay / react-native-razorpay

React Native wrapper for Razorpay's mobile SDKs
https://www.npmjs.com/package/react-native-razorpay
MIT License
125 stars 107 forks source link

App crashed when android hardware backbutton pressed #407

Open arghyaMatrix opened 2 years ago

arghyaMatrix commented 2 years ago

Description

I am using react-native-razorpay version 2.2.9 . When I am trying to pay using test cards and on the otp page when android hardware back button pressed and click on "Cancel Payment" on the popup, the app crashes immediately.

Razorpay Package Version :

2.2.9

Xcode Version (iOS) :

N/A

Razorpay-pod version (iOS) :

N/A

Java and Gradle Version (android) :

Java 8, Gradle: 4.2.2

What you did:

I am trying to pay using test cards

What happened:

On the OTP page when android hardware back button pressed and click on "Cancel Payment" on the popup, the app crashes immediately.

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Go to payment
  2. Try payment using card
  3. Enter test card details and go next
  4. In the OTP page press android hardware back button
  5. Tap on "Cancel Payment"
  6. Its crashing

Suggested solution:

Nothing

Code example, screenshot, or link to a repository:

const makePayment = async (data) => {
    var options = {
        description: selectedPackage.details.substring(0, 50),
        currency: data.currency,
        key: RPAY_KEY_ID,
        amount: data.amount_due,
        name: selectedPackage.name,
        order_id: data.id,
        prefill: {
            email: loginResponse?.email,
            contact: loginResponse?.phone,
            name: `${loginResponse?.translation.first_name} ${loginResponse?.translation.last_name}`
        },
        theme: { color: '#048dd5' }
    }
    RazorpayCheckout.open(options).then((data) => {
        console.log("SUCCESS:", data);
        submitOrder(data)
    }).catch((error) => {
        console.log("ERROR:", error);
    });
}