payment methods finish fx2

This commit is contained in:
merdan 2022-03-02 18:10:22 +05:00
parent 5151348f6d
commit e21ae9cb9d
4 changed files with 12 additions and 29 deletions

View File

@ -61,7 +61,7 @@ class Checkout extends CheckoutController
if (Cart::hasError() || ! Cart::saveCustomerAddress($data)
|| ! $shippingMethod
|| ! Cart::saveShippingMethod($shippingMethod)) {
abort(400);
return response(['message'=>'error. wrong shipment method or address'],400);
}
Cart::collectTotals();

View File

@ -22,25 +22,17 @@ class CartItemResource extends JsonResource
'name' => $this->name,
'base_total_weight' => $this->base_total_weight,
'price' => $this->price,
'formatted_price' => core()->formatPrice($this->price, $this->cart->cart_currency_code),
'base_price' => $this->base_price,
'formatted_base_price' => core()->formatBasePrice($this->base_price),
'formatted_price' => core()->formatPrice($this->base_price, $this->cart->cart_currency_code),
'custom_price' => $this->custom_price,
'formatted_custom_price' => core()->formatPrice($this->custom_price, $this->cart->cart_currency_code),
'total' => $this->total,
'formatted_total' => core()->formatPrice($this->total, $this->cart->cart_currency_code),
'base_total' => $this->base_total,
'formatted_base_total' => core()->formatBasePrice($this->base_total),
'formatted_total' => core()->formatPrice($this->base_total, $this->cart->cart_currency_code),
'tax_percent' => $this->tax_percent,
'tax_amount' => $this->tax_amount,
'formatted_tax_amount' => core()->formatPrice($this->tax_amount, $this->cart->cart_currency_code),
'base_tax_amount' => $this->base_tax_amount,
'formatted_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount),
'formatted_tax_amount' => core()->formatPrice($this->base_tax_amount, $this->cart->cart_currency_code),
'discount_percent' => $this->discount_percent,
'discount_amount' => $this->discount_amount,
'formatted_discount_amount' => core()->formatPrice($this->discount_amount, $this->cart->cart_currency_code),
'base_discount_amount' => $this->base_discount_amount,
'formatted_base_discount_amount'=> core()->formatBasePrice($this->base_discount_amount),
'formatted_discount_amount' => core()->formatPrice($this->base_discount_amount, $this->cart->cart_currency_code),
'additional' => is_array($this->resource->additional)
? $this->resource->additional
: json_decode($this->resource->additional, true),

View File

@ -36,21 +36,13 @@ class CartResource extends JsonResource
'items_count' => $this->items_count,
'items_qty' => (int) $this->items_qty,
'grand_total' => (double) $this->grand_total,
'formatted_grand_total' => core()->formatPrice($this->grand_total, $this->cart_currency_code),
'base_grand_total' => (double) $this->base_grand_total,
'formatted_base_grand_total' => core()->formatBasePrice($this->base_grand_total),
'formatted_grand_total' => core()->formatPrice($this->base_grand_total),
'sub_total' => (double) $this->sub_total,
'formatted_sub_total' => core()->formatPrice($this->sub_total, $this->cart_currency_code),
'base_sub_total' => (double) $this->base_sub_total,
'formatted_base_sub_total' => core()->formatBasePrice($this->base_sub_total),
'formatted_sub_total' => core()->formatPrice($this->base_sub_total, $this->cart_currency_code),
'tax_total' => (double) $this->tax_total,
'formatted_tax_total' => core()->formatPrice($this->tax_total, $this->cart_currency_code),
'base_tax_total' => (double) $this->base_tax_total,
'formatted_base_tax_total' => core()->formatBasePrice($this->base_tax_total),
'formatted_tax_total' => core()->formatPrice($this->base_tax_total, $this->cart_currency_code),
'discount' => (double) $this->discount_amount,
'formatted_discount' => core()->formatPrice($this->discount_amount, $this->cart_currency_code),
'base_discount' => (double) $this->base_discount_amount,
'formatted_base_discount' => core()->formatBasePrice($this->base_discount_amount),
'formatted_discount' => core()->formatPrice($this->base_discount_amount, $this->cart_currency_code),
'checkout_method' => $this->checkout_method,
'vendors' => $this->groupByVendors($this->items),
'selected_shipping_rate' => new CartShippingRateResource($this->selected_shipping_rate),
@ -61,8 +53,7 @@ class CartResource extends JsonResource
'formatted_taxes' => json_encode($formatedTaxes, JSON_FORCE_OBJECT),
'base_taxes' => json_encode($baseTaxes, JSON_FORCE_OBJECT),
'formatted_base_taxes' => json_encode($formatedBaseTaxes, JSON_FORCE_OBJECT),
'formatted_discounted_sub_total' => core()->formatPrice($this->sub_total - $this->discount_amount, $this->cart_currency_code),
'formatted_base_discounted_sub_total'=> core()->formatPrice($this->base_sub_total - $this->base_discount_amount, $this->cart_currency_code),
'formatted_discounted_sub_total' => core()->formatPrice($this->base_sub_total - $this->base_discount_amount, $this->cart_currency_code)
];
}

View File

@ -18,7 +18,7 @@ return [
],
'terminal100' => [
'code' => 'terminal100',
'title' => "I\\'ll pay by card on terminal",
'title' => "I\\'ll pay by card on terminal with deposit 100%",
'description' => '50% deposit is taken before delivery',
'class' => 'Sarga\Payment\Methods\Terminal100',
'active' => true,
@ -26,7 +26,7 @@ return [
],
'terminal50' => [
'code' => 'terminal50',
'title' => "I\\'ll pay by card on terminal",
'title' => "I\\'ll pay by card on terminal with deposit 50%",
'description' => '50% deposit is taken before delivery',
'class' => 'Sarga\Payment\Methods\Terminal50',
'active' => true,