remove simbrell int
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
from .simbrella import SimbrellaIntegration
|
||||
from .kafka import KafkaIntegration
|
||||
from .merms_stripe import StripeIntegration
|
||||
@@ -46,3 +46,21 @@ class StripeIntegration:
|
||||
expand=["latest_invoice.payment_intent"], # To get details for payment confirmation
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def create_checkout_session_subscription(price_id):
|
||||
try:
|
||||
checkout_session = stripe.checkout.Session.create(
|
||||
line_items=[
|
||||
{
|
||||
'price': price_id, # Use a pre-defined Stripe Price ID
|
||||
'quantity': 1,
|
||||
},
|
||||
],
|
||||
mode='subscription',
|
||||
success_url='https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
|
||||
cancel_url='https://example.com/cancel',
|
||||
)
|
||||
return checkout_session.url
|
||||
except stripe.error.StripeError as e:
|
||||
print(f"Error creating subscription Checkout Session: {e}")
|
||||
return None
|
||||
@@ -1,45 +0,0 @@
|
||||
import httpx
|
||||
import json
|
||||
from app.utils.logger import logger
|
||||
from app.config import settings
|
||||
import logging
|
||||
|
||||
|
||||
class SimbrellaIntegration:
|
||||
BASE_URL = settings.SIMBRELLA_BASE_URL
|
||||
ENDPOINT_RAC_CHECKS = settings.SIMBRELLA_ENDPOINT_RAC_CHECKS
|
||||
|
||||
@staticmethod
|
||||
def rac_check(customer_id, account_id, transaction_id):
|
||||
"""
|
||||
Calls the RACCheck endpoit
|
||||
"""
|
||||
url = f"{SimbrellaIntegration.BASE_URL}/{SimbrellaIntegration.ENDPOINT_RAC_CHECKS}"
|
||||
logger.info(f"Contacting Rack Checks EndPoint: {str(url)}", exc_info=True)
|
||||
|
||||
payload = {
|
||||
"customerId": customer_id,
|
||||
"accountId": account_id,
|
||||
"transactionId": str(transaction_id),
|
||||
"fbnTransactionId": str(transaction_id),
|
||||
"countryCode": "NG",
|
||||
"channel": "USSD"
|
||||
}
|
||||
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": f"{settings.VALID_API_KEY}",
|
||||
"App-Id": f"{settings.VALID_APP_ID}",
|
||||
}
|
||||
|
||||
try:
|
||||
response = httpx.post(url, json=payload, headers=headers, timeout=10.0)
|
||||
|
||||
logger.info(f"This is Response: {str(response)}", exc_info=True)
|
||||
|
||||
return response
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"RACCheck API call failed: {str(e)}", exc_info=True)
|
||||
raise Exception(f"RACCheck API call failed: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user