chore: move older code into v1 gateway file

This commit is contained in:
David
2024-09-06 00:45:52 +02:00
parent c0323890a8
commit a9ecd99049
2 changed files with 11 additions and 7 deletions

View File

@@ -109,3 +109,11 @@ def v1_gateway_before_submit(self, payment_gateway):
if not (self.mute_email or self.flags.mute_email):
self.send_email()
self.make_communication_entry()
def v1_create_subscription(payment_provider, gateway_controller, data):
if payment_provider == "stripe":
with payment_app_import_guard():
from payments.payment_gateways.stripe_integration import create_stripe_subscription
return create_stripe_subscription(gateway_controller, data)

View File

@@ -17,7 +17,7 @@ from erpnext.accounts.party import get_party_account, get_party_bank_account
from erpnext.accounts.utils import get_account_currency, get_currency_precision
from erpnext.utilities import payment_app_import_guard
from .payment_gateway_v1 import v1_gateway_before_submit
from .payment_gateway_v1 import v1_create_subscription, v1_gateway_before_submit
class PaymentRequest(Document):
@@ -327,12 +327,8 @@ class PaymentRequest(Document):
)
comm.insert(ignore_permissions=True)
def create_subscription(self, payment_provider, gateway_controller, data):
if payment_provider == "stripe":
with payment_app_import_guard():
from payments.payment_gateways.stripe_integration import create_stripe_subscription
return create_stripe_subscription(gateway_controller, data)
def create_subscription(self, *args, **kwargs):
return v1_create_subscription(*args, **kwargs)
@frappe.whitelist(allow_guest=True)