payment_data
This commit is contained in:
@@ -12,7 +12,6 @@ from app.api.integrations import StripeIntegration
|
||||
import json
|
||||
|
||||
|
||||
|
||||
class SubscriptionsService(BaseService):
|
||||
# def get_all_subscriptions(cls, product_id=None, member_id=None, page=1, limit=20):
|
||||
@staticmethod
|
||||
@@ -100,8 +99,8 @@ class SubscriptionsService(BaseService):
|
||||
price_create_result = StripeIntegration.create_product(t.display_name, t.monthly)
|
||||
logger.info(f"Inside Stripe_Product ===== : {price_create_result}")
|
||||
if price_create_result:
|
||||
SubscriptionOptions.set_stripe_product_id(t.uid,price_create_result['product_id'])
|
||||
SubscriptionOptions.set_stripe_price_id(t.uid,price_create_result['price_id'])
|
||||
SubscriptionOptions.set_stripe_product_id(t.uid, price_create_result['product_id'])
|
||||
SubscriptionOptions.set_stripe_price_id(t.uid, price_create_result['price_id'])
|
||||
|
||||
res_options.append({
|
||||
'option_id': t.id,
|
||||
@@ -164,7 +163,7 @@ class SubscriptionsService(BaseService):
|
||||
member_data = Members.get_member_by_uid(uid)
|
||||
member_id = member_data.id
|
||||
option_name = validated_data.get('option_name')
|
||||
sub_option = SubscriptionOptions.get_subscription_options_by_option_name(option_name)
|
||||
sub_option = SubscriptionOptions.get_subscription_options_by_option_name(option_name)
|
||||
|
||||
if sub_option is None:
|
||||
logger.error(f"Invalid Option Name")
|
||||
@@ -191,7 +190,6 @@ class SubscriptionsService(BaseService):
|
||||
# product_subscription_external_url = memberSubscription.external_url
|
||||
# product_subscription_internal_url = memberSubscription.internal_url
|
||||
|
||||
|
||||
# "banner": "banner.jpg",
|
||||
# myproduct_data = {
|
||||
# "myproudct": {
|
||||
@@ -215,7 +213,7 @@ class SubscriptionsService(BaseService):
|
||||
|
||||
# Simulate processing
|
||||
response_data = {
|
||||
"stripe_session":stripe_session.url,
|
||||
"stripe_session": stripe_session.url,
|
||||
"member_id": member_id,
|
||||
"uid": uid,
|
||||
}
|
||||
@@ -238,8 +236,6 @@ class SubscriptionsService(BaseService):
|
||||
db.session.rollback()
|
||||
return ResponseHelper.internal_server_error()
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def subscription_webhook_start(data):
|
||||
try:
|
||||
@@ -252,14 +248,19 @@ class SubscriptionsService(BaseService):
|
||||
logger.info(f"**************** Key: {key}, *********** Value: {value}")
|
||||
|
||||
data_id = hook_data["id"]
|
||||
amount_subtotal =hook_data["amount_subtotal"]
|
||||
amount_subtotal = hook_data["amount_subtotal"]
|
||||
logger.info(f"HOOK Result DATA ==>>>> {data_id} {amount_subtotal}")
|
||||
|
||||
currentPaymentsession = PaymentsSession.get_payment_session_with_session_id(data_id)
|
||||
currentPaymentsession = PaymentsSession.get_payment_session_with_session_id(data_id)
|
||||
logger.info(f"HOOK currentPaymentsession ==>>>> {currentPaymentsession}")
|
||||
|
||||
|
||||
|
||||
if currentPaymentsession:
|
||||
payment_data = {
|
||||
"payment_uid": currentPaymentsession.uid,
|
||||
"member_id": currentPaymentsession.member_id,
|
||||
"option_name": currentPaymentsession.option_name,
|
||||
}
|
||||
logger.info(f"HOOK payment_data ==>>>> {payment_data}")
|
||||
|
||||
# Simulate processing
|
||||
response_data = {
|
||||
@@ -285,5 +286,3 @@ class SubscriptionsService(BaseService):
|
||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||
db.session.rollback()
|
||||
return ResponseHelper.internal_server_error()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user