|
@@ -46,6 +46,7 @@ class GiftController extends Controller
|
|
|
'giftcard_number' => $giftCard->giftcard_number,
|
|
'giftcard_number' => $giftCard->giftcard_number,
|
|
|
'giftcard_amount' => $giftCard->giftcard_amount,
|
|
'giftcard_amount' => $giftCard->giftcard_amount,
|
|
|
'remaining_giftcard_amount' => $giftCard->remaining_giftcard_amount,
|
|
'remaining_giftcard_amount' => $giftCard->remaining_giftcard_amount,
|
|
|
|
|
+ 'formatted_remaining_giftcard_amount' => core()->formatPrice(core()->convertPrice($giftCard->remaining_giftcard_amount)),
|
|
|
'used_giftcard_amount' => $giftCard->used_giftcard_amount,
|
|
'used_giftcard_amount' => $giftCard->used_giftcard_amount,
|
|
|
'expirationdate' => $giftCard->expirationdate->format('Y-m-d'),
|
|
'expirationdate' => $giftCard->expirationdate->format('Y-m-d'),
|
|
|
'giftcard_status' => $giftCard->giftcard_status,
|
|
'giftcard_status' => $giftCard->giftcard_status,
|
|
@@ -79,7 +80,8 @@ class GiftController extends Controller
|
|
|
'message' => trans('Coupon not found.'),
|
|
'message' => trans('Coupon not found.'),
|
|
|
]))->response()->setStatusCode(Response::HTTP_UNPROCESSABLE_ENTITY);
|
|
]))->response()->setStatusCode(Response::HTTP_UNPROCESSABLE_ENTITY);
|
|
|
}
|
|
}
|
|
|
- if ($giftCard->remaining_giftcard_amount <= 0) {
|
|
|
|
|
|
|
+ $remainingGiftcardAmount = core()->convertPrice($giftCard->remaining_giftcard_amount);
|
|
|
|
|
+ if ($remainingGiftcardAmount <= 0) {
|
|
|
return (new JsonResource([
|
|
return (new JsonResource([
|
|
|
'data' => new CustomCartResource(Cart::getCart()),
|
|
'data' => new CustomCartResource(Cart::getCart()),
|
|
|
'message' => trans('Gift card already used.'),
|
|
'message' => trans('Gift card already used.'),
|
|
@@ -94,7 +96,7 @@ class GiftController extends Controller
|
|
|
|
|
|
|
|
|
|
|
|
|
$cartTotal = $cart->grand_total;
|
|
$cartTotal = $cart->grand_total;
|
|
|
- $remainingAmount = $giftCard->remaining_giftcard_amount - $cartTotal;
|
|
|
|
|
|
|
+ $remainingAmount = $remainingGiftcardAmount - $cartTotal;
|
|
|
|
|
|
|
|
if ($remainingAmount >= 0) {
|
|
if ($remainingAmount >= 0) {
|
|
|
// Apply the gift card to the cart
|
|
// Apply the gift card to the cart
|