Skip to content

Commit

Permalink
Default return_url
Browse files Browse the repository at this point in the history
  • Loading branch information
dyfero committed Mar 21, 2024
1 parent 21747de commit 4102799
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Jobs/RenewRecursiveProductUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function handle(OrderServiceContract $orderService): void
$paymentProcessor = $newOrder->process();

$parameters = [
'return_url' => config(),
'return_url' => url('/'),
'email' => $user->email,
'type' => $product->type,
'gateway' => $prevPayment->driver,
Expand Down
10 changes: 6 additions & 4 deletions src/Services/ProductService.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,13 @@ public function attachProductToUser(Product $product, User $user, int $quantity

$productUserPivot = ProductUser::query()->firstOrCreate(['user_id' => $user->getKey(), 'product_id' => $product->getKey()], ['quantity' => $quantity]);

if (!$productUserPivot->wasRecentlyCreated && !is_null($product->limit_per_user)) {
if ($product->limit_per_user < ($productUserPivot->quantity + $quantity)) {
$quantity = $product->limit_per_user - $productUserPivot->quantity;
if (!$productUserPivot->wasRecentlyCreated) {
if (!is_null($product->limit_per_user)) {
if ($product->limit_per_user < ($productUserPivot->quantity + $quantity)) {
$quantity = $product->limit_per_user - $productUserPivot->quantity;
}
$productUserPivot->quantity += $quantity;
}
$productUserPivot->quantity += $quantity;

if (ProductType::isSubscriptionType($product->type)) {
$productUserPivot->end_date = PeriodEnum::calculatePeriod($productUserPivot->end_date, $product->subscription_period, $product->subscription_duration);
Expand Down

0 comments on commit 4102799

Please sign in to comment.