fix: use Stripe's Price API for plan-price information (#26107)
* fix: use Stripe's new Plan API for price information
* patch: use inbuilt function to rename field
* fix: patch call
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
(cherry picked from commit 16eed07a0f)
# Conflicts:
# erpnext/accounts/doctype/subscription_plan/subscription_plan.json
# erpnext/erpnext_integrations/stripe_integration.py
# erpnext/patches.txt
This commit is contained in:
@@ -148,7 +148,11 @@
|
||||
}
|
||||
],
|
||||
"links": [],
|
||||
<<<<<<< HEAD
|
||||
"modified": "2021-12-10 15:24:15.794477",
|
||||
=======
|
||||
"modified": "2021-08-13 10:53:44.205774",
|
||||
>>>>>>> 16eed07a0f (fix: use Stripe's Price API for plan-price information (#26107))
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Subscription Plan",
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import stripe
|
||||
|
||||
>>>>>>> 16eed07a0f (fix: use Stripe's Price API for plan-price information (#26107))
|
||||
import frappe
|
||||
import stripe
|
||||
from frappe import _
|
||||
@@ -23,6 +28,7 @@ def create_stripe_subscription(gateway_controller, data):
|
||||
|
||||
except Exception:
|
||||
frappe.log_error(frappe.get_traceback())
|
||||
<<<<<<< HEAD
|
||||
return {
|
||||
"redirect_to": frappe.redirect_to_message(
|
||||
_("Server Error"),
|
||||
@@ -31,6 +37,14 @@ def create_stripe_subscription(gateway_controller, data):
|
||||
),
|
||||
),
|
||||
"status": 401,
|
||||
=======
|
||||
return{
|
||||
"redirect_to": frappe.redirect_to_message(
|
||||
_('Server Error'),
|
||||
_("It seems that there is an issue with the server's stripe configuration. In case of failure, the amount will get refunded to your account.")
|
||||
),
|
||||
"status": 401
|
||||
>>>>>>> 16eed07a0f (fix: use Stripe's Price API for plan-price information (#26107))
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +58,17 @@ def create_subscription_on_stripe(stripe_settings):
|
||||
customer = stripe.Customer.create(
|
||||
source=stripe_settings.data.stripe_token_id,
|
||||
description=stripe_settings.data.payer_name,
|
||||
<<<<<<< HEAD
|
||||
email=stripe_settings.data.payer_email,
|
||||
=======
|
||||
email=stripe_settings.data.payer_email
|
||||
>>>>>>> 16eed07a0f (fix: use Stripe's Price API for plan-price information (#26107))
|
||||
)
|
||||
|
||||
subscription = stripe.Subscription.create(customer=customer, items=items)
|
||||
|
||||
if subscription.status == "active":
|
||||
<<<<<<< HEAD
|
||||
stripe_settings.integration_request.db_set("status", "Completed", update_modified=False)
|
||||
stripe_settings.flags.status_changed_to = "Completed"
|
||||
|
||||
@@ -58,6 +77,16 @@ def create_subscription_on_stripe(stripe_settings):
|
||||
frappe.log_error("Subscription N°: " + subscription.id, "Stripe Payment not completed")
|
||||
except Exception:
|
||||
stripe_settings.integration_request.db_set("status", "Failed", update_modified=False)
|
||||
=======
|
||||
stripe_settings.integration_request.db_set('status', 'Completed', update_modified=False)
|
||||
stripe_settings.flags.status_changed_to = "Completed"
|
||||
|
||||
else:
|
||||
stripe_settings.integration_request.db_set('status', 'Failed', update_modified=False)
|
||||
frappe.log_error('Subscription N°: ' + subscription.id, 'Stripe Payment not completed')
|
||||
except Exception:
|
||||
stripe_settings.integration_request.db_set('status', 'Failed', update_modified=False)
|
||||
>>>>>>> 16eed07a0f (fix: use Stripe's Price API for plan-price information (#26107))
|
||||
frappe.log_error(frappe.get_traceback())
|
||||
|
||||
return stripe_settings.finalize_request()
|
||||
|
||||
@@ -301,10 +301,13 @@ erpnext.patches.v13_0.update_export_type_for_gst #2021-08-16
|
||||
erpnext.patches.v13_0.update_tds_check_field #3
|
||||
erpnext.patches.v13_0.update_recipient_email_digest
|
||||
erpnext.patches.v13_0.shopify_deprecation_warning
|
||||
<<<<<<< HEAD
|
||||
erpnext.patches.v13_0.add_custom_field_for_south_africa #2
|
||||
erpnext.patches.v13_0.rename_discharge_ordered_date_in_ip_record
|
||||
erpnext.patches.v13_0.remove_bad_selling_defaults
|
||||
erpnext.patches.v13_0.trim_whitespace_from_serial_nos # 16-01-2022
|
||||
=======
|
||||
>>>>>>> 16eed07a0f (fix: use Stripe's Price API for plan-price information (#26107))
|
||||
erpnext.patches.v13_0.migrate_stripe_api
|
||||
erpnext.patches.v13_0.reset_clearance_date_for_intracompany_payment_entries
|
||||
execute:frappe.reload_doc("erpnext_integrations", "doctype", "TaxJar Settings")
|
||||
|
||||
Reference in New Issue
Block a user