subscription Module Updated
This commit is contained in:
@@ -85,9 +85,11 @@ class StripeWebhookController extends Controller
|
||||
|
||||
|
||||
$isReferralSubscription = $metadata->is_referral_subscription;
|
||||
$isCustomReferralCodeApplied = $metadata->isCustomReferralCodeApplied;
|
||||
|
||||
$referralUserId = $metadata->referral_user_id;
|
||||
|
||||
if ($isReferralSubscription == 1) {
|
||||
if ($isReferralSubscription == 1 && $isCustomReferralCodeApplied == 0) {
|
||||
//who has refer the Subscription to Current user
|
||||
Log::info("Referral User Subscription Updating Function Starts");
|
||||
|
||||
@@ -180,7 +182,8 @@ class StripeWebhookController extends Controller
|
||||
]);
|
||||
|
||||
$id = Subscriptions::updateOrCreate(
|
||||
['iam_principal_xid' => $userId, 'subscription_product_xid' => $subscriptionProductId],
|
||||
['iam_principal_xid' => $userId,
|
||||
'subscription_product_xid' => $subscriptionProductId],
|
||||
[
|
||||
'subscription_id' => $subscriptionData->subscription,
|
||||
'amount' => $amountSubtotalDollars,
|
||||
@@ -197,7 +200,7 @@ class StripeWebhookController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
if ($isReferralSubscription == 1) {
|
||||
if ($isReferralSubscription == 1 && $isCustomReferralCodeApplied == 1) {
|
||||
|
||||
Log::info("new User Subscription Updating Function Starts");
|
||||
|
||||
@@ -243,6 +246,7 @@ class StripeWebhookController extends Controller
|
||||
'iam_principal_xid' => $referralUserId, //Referral User Xid
|
||||
'referred_user_xid' => $userId, // new user Id
|
||||
'referred_date_time' => Carbon::now(),
|
||||
'isCustomReferralCodeApplied' =>$isCustomReferralCodeApplied
|
||||
]);
|
||||
Log::info("Created entry in Referral User table");
|
||||
|
||||
@@ -256,9 +260,6 @@ class StripeWebhookController extends Controller
|
||||
|
||||
onesignalhelper::sendNotificationApi($getUserData->one_signal_player_id, $title, $message, $content_type, $image = null, $id = null);
|
||||
|
||||
|
||||
|
||||
|
||||
Log::info('Subscription Taken Successfully by ');
|
||||
DB::commit();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user