From ea4968faf3cc54d3dd851c265b89c4a6edaedde4 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 5 Sep 2018 11:55:03 +0530 Subject: [PATCH] setup upfront amount --- .../doctype/paypal_settings/paypal_settings.py | 12 ++++++------ .../doctype/razorpay_settings/razorpay_settings.py | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/payments/payment_gateways/doctype/paypal_settings/paypal_settings.py b/payments/payment_gateways/doctype/paypal_settings/paypal_settings.py index 627d01a..e783fca 100644 --- a/payments/payment_gateways/doctype/paypal_settings/paypal_settings.py +++ b/payments/payment_gateways/doctype/paypal_settings/paypal_settings.py @@ -34,7 +34,8 @@ Example: "start_date": "2018-08-30", "billing_period": "Month" #(Day, Week, SemiMonth, Month, Year), "billing_frequency": 1, - "customer_notify": 1 + "customer_notify": 1, + "upfront_amount": 1000 } } @@ -296,13 +297,12 @@ def create_recurring_profile(token, payerid): "BILLINGPERIOD": subscription_details.get("billing_period"), "BILLINGFREQUENCY": subscription_details.get("billing_frequency"), "AMT": data.get("amount"), - "CURRENCYCODE": data.get("currency").upper() + "CURRENCYCODE": data.get("currency").upper(), + "INITAMT": subscription_details.get("upfront_amount") }) - if subscription_details.get("start_date"): - starts_at = subscription_details.get("start_date") - else: - starts_at = frappe.utils.now() + starts_at = subscription_details.get("start_date") if subscription_details.get("start_date")\ + else frappe.utils.now() params.update({ "PROFILESTARTDATE": datetime.utcfromtimestamp(get_timestamp(starts_at)).isoformat() diff --git a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py index 2068f04..3ad9559 100644 --- a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py +++ b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py @@ -34,7 +34,8 @@ Example: "start_date": "2018-08-30", "billing_period": "Month" #(Day, Week, Month, Year), "billing_frequency": 1, - "customer_notify": 1 + "customer_notify": 1, + "upfront_amount": 1000 } } @@ -132,6 +133,7 @@ class RazorpaySettings(Document): "start_at": cint(start_date), "total_count": kwargs.get('subscription_details').get("billing_frequency"), "customer_notify": kwargs.get('subscription_details').get("customer_notify"), + "upfront_amount": kwargs.get('subscription_details').get("upfront_amount") } try: