瀏覽代碼

Merge pull request #1 from frappe/develop

merge frappe/develop into LIS-Engineering/develop
pull/2/head
Manuel 4 年之前
committed by GitHub
父節點
當前提交
cfddaff347
共有 1 個檔案被更改,包括 7 行新增2 行删除
  1. +7
    -2
      payments/templates/pages/stripe_checkout.py

+ 7
- 2
payments/templates/pages/stripe_checkout.py 查看文件

@@ -26,7 +26,7 @@ def get_context(context):

context['amount'] = fmt_money(amount=context['amount'], currency=context['currency'])

if frappe.db.get_value(context.reference_doctype, context.reference_docname, "is_a_subscription"):
if is_a_subscription(context.reference_doctype, context.reference_docname):
payment_plan = frappe.db.get_value(context.reference_doctype, context.reference_docname, "payment_plan")
recurrence = frappe.db.get_value("Payment Plan", payment_plan, "recurrence")

@@ -60,7 +60,7 @@ def make_payment(stripe_token_id, data, reference_doctype=None, reference_docnam

gateway_controller = get_gateway_controller(reference_doctype,reference_docname)

if frappe.db.get_value(reference_doctype, reference_docname, 'is_a_subscription'):
if is_a_subscription(reference_doctype, reference_docname):
reference = frappe.get_doc(reference_doctype, reference_docname)
data = reference.create_subscription("stripe", gateway_controller, data)
else:
@@ -68,3 +68,8 @@ def make_payment(stripe_token_id, data, reference_doctype=None, reference_docnam

frappe.db.commit()
return data

def is_a_subscription(reference_doctype, reference_docname):
if not frappe.get_meta(reference_doctype).has_field('is_a_subscription'):
return False
return frappe.db.get_value(reference_doctype, reference_docname, "is_a_subscription")

Loading…
取消
儲存