frappe / payments

A payments app for frappe
MIT License
80 stars 212 forks source link

Razorpay integration missing currency support. #15

Open chromonav opened 4 years ago

chromonav commented 4 years ago

razorpay_checkout.js does not have a currency field.

Context information (for bug reports)

Output of bench version

frappe 13.0.0-beta.5

Steps to reproduce the issue

  1. Create a checkout URL with the following code:

    controller = get_payment_gateway_controller("Razorpay")
    controller.validate_transaction_currency(currency)
    
    payment_details = {
        "amount": 5,
        "title": "Payment for bill : 111",
        "description": "payment via cart",
        "reference_doctype": "Invoice",
        "reference_docname": doc.name,
        "payer_email": doc.email,
        "payer_name": doc.first_name,
        "order_id": doc.name,
        "currency": "USD",
        "payment_gateway": "Razorpay",
    }
    # Redirect the user to this url
    url = controller.get_payment_url(**payment_details)
  2. Go to the checkout link

Observed result

The amount is shown in Rupees (Default Currency).

image

Expected result

Should have been in the currency with which the integration request was made

Additional information

adding "currency":"{{currency}}", param in apps/frappe/frappe/templates/includes/integrations/razorpay_checkout.js would resolve the issue.

kennethsequeira commented 4 years ago

@chromonav is the issue only that it shows ₹5 or that it ends up accepting ₹5 instead of USD 5?

chromonav commented 4 years ago

There are the following issues:

@chromonav is the issue only that it shows ₹5 or that it ends up accepting ₹5 instead of USD 5?

Yes @kennethsequeira if we add the parameter "currency":"{{currency}}" in frappe apps/frappe/frappe/templates/includes/integrations/razorpay_checkout.js with suitable context it works.

Also, currently in the supported currency list, other countries supported by Razorpay are not present.

We have done those necessary changes and would be willing to resolve this bug and raise a pull request. Just not sure how to get started.

kennethsequeira commented 4 years ago

@chromonav glad to know you'd like to contribute.

As a starter, you can have a look at the contribution guidelines:

https://github.com/frappe/erpnext/wiki/Contribution-Guidelines

kennethsequeira commented 3 years ago

@chromonav will you be raising a PR with your changes?

chromonav commented 3 years ago

@kennethsequeira Yes plan to do that tentatively by 15th