Skip to content

Commit

Permalink
Bagisto v 2.2 fixations
Browse files Browse the repository at this point in the history
1 function changed in the controller based on new v2.2
2 order message changed and fixed
  • Loading branch information
wontone18 committed Aug 9, 2024
1 parent a7f302b commit 5994a3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Config/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
'locale_based' => true,
],
[
'name' => 'image',
'name' => 'logo_image',
'title' => 'Logo',
'type' => 'image',
'channel_based' => false,
'locale_based' => false,
'validation' => 'mimes:bmp,jpeg,jpg,png,webp',
],
],
[
'name' => 'stripe_api_key',
'title' => 'Strip Secret Key',
Expand All @@ -37,7 +37,7 @@
'channel_based' => false,
'locale_based' => true,
],
[
[
'name' => 'active',
'title' => 'admin::app.configuration.index.sales.payment-methods.status',
'type' => 'boolean',
Expand All @@ -47,4 +47,4 @@
]
]
]
];
];
8 changes: 6 additions & 2 deletions src/Http/Controllers/StripeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Webkul\Checkout\Facades\Cart;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Sales\Transformers\OrderResource;
use Webkul\Sales\Repositories\InvoiceRepository;
use Stripe\Stripe;

Expand Down Expand Up @@ -82,13 +83,16 @@ public function redirect()
*/
public function success()
{
$order = $this->orderRepository->create(Cart::prepareDataForOrder());
$cart = Cart::getCart();
$data = (new OrderResource($cart))->jsonSerialize(); // new class v2.2
$order = $this->orderRepository->create($data);
// $order = $this->orderRepository->create(Cart::prepareDataForOrder()); // removed for v2.2
$this->orderRepository->update(['status' => 'processing'], $order->id);
if ($order->canInvoice()) {
$this->invoiceRepository->create($this->prepareInvoiceData($order));
}
Cart::deActivateCart();
session()->flash('order', $order);
session()->flash('order_id', $order->id); // line instead of $order in v2.1
// Order and prepare invoice
return redirect()->route('shop.checkout.onepage.success');
}
Expand Down

0 comments on commit 5994a3c

Please sign in to comment.