Kaynağa Gözat

[fixes] for razorpay

pull/2/head
Rushabh Mehta 8 yıl önce
ebeveyn
işleme
8d9996fa66
5 değiştirilmiş dosya ile 17 ekleme ve 29 silme
  1. +1
    -9
      payments/templates/includes/razorpay_checkout.js
  2. +3
    -3
      payments/templates/pages/payment-cancel.html
  3. +4
    -4
      payments/templates/pages/payment-failed.html
  4. +5
    -4
      payments/templates/pages/payment-success.html
  5. +4
    -9
      payments/templates/pages/razorpay_checkout.py

+ 1
- 9
payments/templates/includes/razorpay_checkout.js Dosyayı Görüntüle

@@ -5,7 +5,6 @@ $(document).ready(function(){
"amount": cint({{ amount }} * 100), // 2000 paise = INR 20
"name": "{{ title }}",
"description": "{{ description }}",
"image": "{{ brand_image }}",
"handler": function (response){
razorpay.make_payment_log(response, options, "{{ reference_doctype }}", "{{ reference_docname }}");
},
@@ -14,14 +13,7 @@ $(document).ready(function(){
"email": "{{ payer_email }}",
"order_id": "{{ order_id }}"
},
"notes": {
"doctype": "{{ doctype }}",
"name": "{{ name }}",
"payment_request": "{{ name }}" // backward compatibility
},
"theme": {
"color": "#4B4C9D"
}
"notes": {{ frappe.form_dict|json }}
};

var rzp = new Razorpay(options);


+ 3
- 3
payments/templates/pages/payment-cancel.html Dosyayı Görüntüle

@@ -1,12 +1,12 @@
{% extends "templates/web.html" %}

{% block title %}Make Payment{% endblock %}
{% block title %}{{ _("Payment Cancelled") }}{% endblock %}

{%- block header -%}
<h2>Payment Cancelled<h2>
<h2>{{ _("Payment Cancelled") }}<h2>
{% endblock %}

{%- block page_content -%}
<p>You have cancelled your payment.</p>
<p>{{ _("You have cancelled the payment") }}</p>
<p><br><a href="/">Back to home page</a></p>
{% endblock %}

+ 4
- 4
payments/templates/pages/payment-failed.html Dosyayı Görüntüle

@@ -1,12 +1,12 @@
{% extends "templates/web.html" %}

{% block title %}Payment Failed{% endblock %}
{% block title %}{{ _("Payment Failed") }}{% endblock %}

{%- block header -%}
<h2>Payment Failed<h2>
<h2>{{ _("Payment Failed") }}<h2>
{% endblock %}

{%- block page_content -%}
<p class="lead">Your payment has failed. Do you mind trying again?</p>
<p><a href="/" class="btn btn-default">Back to Home</a></p>
<p class="lead">{{ _("Oops. Your payment has failed.") }}</p>
<p><a href="{{ frappe.form_dict.redirect_to or "/" }}" class="btn btn-primary">{{ frappe.form_dict.redirect_message or _("Continue") }}</a></p>
{% endblock %}

+ 5
- 4
payments/templates/pages/payment-success.html Dosyayı Görüntüle

@@ -1,12 +1,13 @@
{% extends "templates/web.html" %}

{% block title %}Payment Success{% endblock %}
{% block title %}{{ _("Payment Success") }}{% endblock %}

{%- block header -%}
<h2>Payment Success<h2>
<h2>{{ _("Payment Success") }}<h2>
{% endblock %}

{%- block page_content -%}
<p class="lead">Your payment has succeeded.</p>
<p><a href="/" class="btn btn-default">Back to Home</a></p>
<p class="lead">{{ _("Your payment was successfully accepted") }}</p>
<p><a href="{{ frappe.form_dict.redirect_to or "/" }}"
class="btn btn-primary">{{ frappe.form_dict.redirect_message or _("Continue") }}</a></p>
{% endblock %}

+ 4
- 9
payments/templates/pages/razorpay_checkout.py Dosyayı Görüntüle

@@ -17,13 +17,8 @@ expected_keys = ('amount', 'title', 'description', 'reference_doctype', 'referen
def get_context(context):
context.no_cache = 1
context.api_key = Controller().get_settings().api_key
installed_apps = frappe.get_installed_apps()
if 'erpnext' in installed_apps:
context.brand_image = "/assets/erpnext/images/erp-icon.svg"
else:
context.brand_image = '/assets/frappe_theme/img/erp-icon.svg'

# all these keys exist in form_dict
if not (set(expected_keys) - set(frappe.form_dict.keys())):
@@ -40,14 +35,14 @@ def get_context(context):
@frappe.whitelist(allow_guest=True)
def make_payment(razorpay_payment_id, options, reference_doctype, reference_docname):
data = {}
if isinstance(options, basestring):
data = json.loads(options)
data.update({
"razorpay_payment_id": razorpay_payment_id,
"reference_docname": reference_docname,
"reference_doctype": reference_doctype
})
return Controller().create_request(data)

Yükleniyor…
İptal
Kaydet