mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-01-16 19:05:08 -05:00
WTIAlaCarte Module Update - Fix discounting for active not renewing subscriptions
This commit is contained in:
@@ -36,8 +36,18 @@ class Alacarte extends Model
|
||||
public function getFinalPriceAttribute()
|
||||
{
|
||||
$currentSubscription = auth()->user()->currentSubscription();
|
||||
if($currentSubscription && $currentSubscription->status == 'active') {
|
||||
return ($this->price - ($this->price * ($currentSubscription->planPrice->plan->discount / 100) ));
|
||||
if($currentSubscription) {
|
||||
if($currentSubscription->status == 'active'){
|
||||
return ($this->price - ($this->price * ($currentSubscription->planPrice->plan->discount / 100) ));
|
||||
}
|
||||
|
||||
if($currentSubscription->status == 'cancelled'){
|
||||
$subscription_expired = $currentSubscription->expired_at != null ? \Carbon\Carbon::now()->gt(\Carbon\Carbon::parse($currentSubscription->expired_at)) : true;
|
||||
if(!$subscription_expired) {
|
||||
return ($this->price - ($this->price * ($currentSubscription->planPrice->plan->discount / 100) ));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"/js/wtialacarte.js": "/js/wtialacarte.js?id=3131daa93c81a752cb5999569a1f9366",
|
||||
"/js/manage-wtialacarte.js": "/js/manage-wtialacarte.js?id=0fdf8b4b3fc9dadd3b959c745f45bb25",
|
||||
"/css/wtialacarte.css": "/css/wtialacarte.css?id=fb4028e64652ab655a2eb3aee0319852",
|
||||
"/css/wtialacarte.css": "/css/wtialacarte.css?id=314b91e13b79c3820015877ac1b2def6",
|
||||
"/css/base.css": "/css/base.css?id=06d5bacc695674be7965bf519e0f1a43",
|
||||
"/js/orders-wtialacarte.js": "/js/orders-wtialacarte.js?id=c2500cc03de70e856b6765ae0dcf2553",
|
||||
"/js/orders-history-wtialacarte.js": "/js/orders-history-wtialacarte.js?id=ae544d2da65d08e2b614f4506e78f9ba",
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
background: #ffc107!important;
|
||||
}
|
||||
|
||||
.p-selectbutton .p-button.p-highlight:before {
|
||||
background: transparent!important;
|
||||
border-color: transparent!important;
|
||||
box-shadow: none!important;
|
||||
}
|
||||
|
||||
.p-dialog.p-component.p-confirm-dialog {
|
||||
.p-button.p-component {
|
||||
/*color: $primary-text-color;
|
||||
|
||||
@@ -41,6 +41,38 @@ class StripeService
|
||||
'quantity' => $item['qty'],
|
||||
];
|
||||
|
||||
} else if($currentSubscription && $currentSubscription->status == 'cancelled'){
|
||||
|
||||
$subscription_expired = $currentSubscription->expired_at != null ? \Carbon\Carbon::now()->gt(\Carbon\Carbon::parse($currentSubscription->expired_at)) : true;
|
||||
if($subscription_expired) {
|
||||
|
||||
$data = [
|
||||
'price' => $item['stripe_price_id'],
|
||||
'adjustable_quantity' => [
|
||||
'enabled' => true,
|
||||
'minimum' => 1,
|
||||
'maximum' => 100,
|
||||
],
|
||||
'quantity' => $item['qty'],
|
||||
];
|
||||
|
||||
} else {
|
||||
|
||||
$data = [
|
||||
'price_data' => [
|
||||
'currency' => $this->currecyCode,
|
||||
'product' => $item['stripe_product_id'],
|
||||
'unit_amount_decimal' => $item['final_price'] * 100
|
||||
],
|
||||
'adjustable_quantity' => [
|
||||
'enabled' => true,
|
||||
'minimum' => 1,
|
||||
'maximum' => 100,
|
||||
],
|
||||
'quantity' => $item['qty'],
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
$data = [
|
||||
'price' => $item['stripe_price_id'],
|
||||
|
||||
Reference in New Issue
Block a user