From 8b347013b7d9185a97fba35eb902ebaff95db4aa Mon Sep 17 00:00:00 2001 From: sayliraut Date: Wed, 14 Aug 2024 13:35:44 +0530 Subject: [PATCH] changes --- .../APIs/Customer_API/StripeWebhookController.php | 11 +++++------ app/Models/SubscriptionProducts.php | 4 ---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/APIs/Customer_API/StripeWebhookController.php b/app/Http/Controllers/APIs/Customer_API/StripeWebhookController.php index fbb5b78..80aba7f 100644 --- a/app/Http/Controllers/APIs/Customer_API/StripeWebhookController.php +++ b/app/Http/Controllers/APIs/Customer_API/StripeWebhookController.php @@ -155,7 +155,7 @@ class StripeWebhookController extends Controller } } - $subscriptionProductData = SubscriptionProducts::with('product')->where('id', $subscriptionProductId)->first(); + $subscriptionProductData = SubscriptionProducts::where('id', $subscriptionProductId)->first(); //checkout store in db $subscriptionData = $stripe->checkout->sessions->retrieve($session->id, []); @@ -258,11 +258,11 @@ class StripeWebhookController extends Controller Log::info("Created entry in Referral User table"); } - Log::info($subscriptionData); + $getUserData = IamPrincipal::where('id', $userId)->first(); $title = "Congratulations your subscription is now active"; - $message = $getUserData->first_name . " has subscribed for " . $subscriptionProductData->name; + $message = $getUserData->first_name . " has subscribed for " . $subscriptionProductData->product_name; $content_type = "new_subscription"; onesignalhelper::sendNotificationApi($getUserData->one_signal_player_id, $title, $message, $content_type, $image = null, $id = null); @@ -291,7 +291,7 @@ class StripeWebhookController extends Controller // $productID = $invoice->lines->data[0]->price->product; - $subscriptionProductData = SubscriptionProducts::with('product')->where('stripe_product_id', $productID)->first(); + $subscriptionProductData = SubscriptionProducts::where('stripe_product_id', $productID)->first(); $customerID = $invoice->customer; @@ -321,10 +321,9 @@ class StripeWebhookController extends Controller $iamPrincialData = IamPrincipal::where('id', $subscriptionInDatabase->iam_principal_xid)->first(); - Log::info($subscriptionData); $title = "Congratulations your Subscription has been Renewed"; - $message = $iamPrincialData->first_name . " has subscribed for " . $subscriptionProductData->name; + $message = $iamPrincialData->first_name . " has subscribed for " . $subscriptionProductData->product_name; $content_type = "recurring_subscription"; onesignalhelper::sendNotificationApi($iamPrincialData->one_signal_player_id, $title, $message, $content_type, $image = null, $id = null); diff --git a/app/Models/SubscriptionProducts.php b/app/Models/SubscriptionProducts.php index 78bbc24..68c9d71 100644 --- a/app/Models/SubscriptionProducts.php +++ b/app/Models/SubscriptionProducts.php @@ -28,8 +28,4 @@ class SubscriptionProducts extends Model ]; - public function product() - { - return $this->belongsTo(SubscriptionProducts::class, 'subscription_product_xid', 'id'); - } }