Update
This commit is contained in:
@@ -43,7 +43,6 @@ public static function getSubscriptionPlanByStripePriceID($stripe_price_id)
|
||||
|
||||
foreach ($plans as $plan) {
|
||||
|
||||
|
||||
if ($plan['id'] == 'free') {
|
||||
continue;
|
||||
}
|
||||
@@ -76,10 +75,10 @@ public static function getPlanSystemProperty($plan, $property)
|
||||
// Inject environment into the path
|
||||
// stripe.product_id.month becomes system.stripe.product_id.{env}.month
|
||||
array_splice($propertyParts, 2, 0, $environment);
|
||||
$fullPath = 'system.' . implode('.', $propertyParts);
|
||||
$fullPath = 'system.'.implode('.', $propertyParts);
|
||||
} else {
|
||||
// For non-stripe properties, just prepend 'system.'
|
||||
$fullPath = 'system.' . $property;
|
||||
$fullPath = 'system.'.$property;
|
||||
}
|
||||
|
||||
return data_get($plan, $fullPath);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
use App\Helpers\FirstParty\Stripe\StripeHelper;
|
||||
use App\Models\Plan;
|
||||
use App\Models\UserPlan;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Laravel\Cashier\Events\WebhookReceived;
|
||||
|
||||
class SubscriptionHelper
|
||||
@@ -28,7 +27,7 @@ private static function handleSubscriptionUpsert(WebhookReceived $event)
|
||||
{
|
||||
$object = $event->payload['data']['object'];
|
||||
|
||||
//dump($object);
|
||||
// dump($object);
|
||||
|
||||
$ignore_statuses = ['incomplete_expired', 'incomplete'];
|
||||
|
||||
@@ -41,7 +40,7 @@ private static function handleSubscriptionUpsert(WebhookReceived $event)
|
||||
if ($user) {
|
||||
foreach ($object['items']['data'] as $line_item) {
|
||||
|
||||
//dump($line_item);
|
||||
// dump($line_item);
|
||||
|
||||
$stripe_price_id = $line_item['plan']['id'];
|
||||
$current_period_end = $line_item['current_period_end'];
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
use App\Helpers\FirstParty\Stripe\StripeHelper;
|
||||
use App\Models\UserUsage;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Laravel\Cashier\Events\WebhookReceived;
|
||||
|
||||
class WatermarkUsageHelper
|
||||
@@ -22,11 +21,11 @@ private static function handleInvoicePaid(WebhookReceived $event)
|
||||
{
|
||||
$object = $event->payload['data']['object'];
|
||||
|
||||
//dump($object);
|
||||
// dump($object);
|
||||
|
||||
$accept_statuses = ['paid', 'partially_paid'];
|
||||
|
||||
if (!in_array($object['status'], $accept_statuses)) {
|
||||
if (! in_array($object['status'], $accept_statuses)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,7 +35,7 @@ private static function handleInvoicePaid(WebhookReceived $event)
|
||||
foreach ($object['lines']['data'] as $line_item) {
|
||||
$stripe_price_id = $line_item['pricing']['price_details']['price'];
|
||||
|
||||
//dd($stripe_price_id);
|
||||
// dd($stripe_price_id);
|
||||
|
||||
$subscription_config = PurchaseHelper::getSubscriptionPlanByStripePriceID($stripe_price_id);
|
||||
|
||||
@@ -57,7 +56,7 @@ private static function handleInvoicePaid(WebhookReceived $event)
|
||||
}
|
||||
}
|
||||
|
||||
//dd($subscription_config);
|
||||
// dd($subscription_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Helpers\FirstParty\Stripe;
|
||||
|
||||
use App\Models\User;
|
||||
use Laravel\Cashier\Events\WebhookReceived;
|
||||
|
||||
class StripeHelper
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user