Custom payment method not working in Bagisto 1.2
-
@RK-REZA
could you please show the network response of this 500 error request. -
-
@RK-REZA
update your code with this PR
https://github.com/bagisto/bagisto/commit/b42ccbfa9e719c8526b249bbfef1951a894d0705 then check again. -
Those changes are already there in my packages/Webkul/Checkout/src/Cart.php
private function linkAddresses( \Webkul\Checkout\Models\Cart $cart, array $billingAddressData, array $shippingAddressData ): void { $billingAddressModel = $cart->billing_address; if ($billingAddressModel) { $billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_BILLING; $this->cartAddressRepository->update($billingAddressData, $billingAddressModel->id); if ($cart->haveStockableItems()) { $shippingAddressModel = $cart->shipping_address; if ($shippingAddressModel) { if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { $billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING; $this->cartAddressRepository->update($billingAddressData, $shippingAddressModel->id); } else { $shippingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING; $this->cartAddressRepository->update($shippingAddressData, $shippingAddressModel->id); } } else { if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { $this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING])); } else { $this->cartAddressRepository->create(array_merge($shippingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING])); } } } } else { $this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_BILLING])); if ($cart->haveStockableItems()) { if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { $this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING])); } else { $this->cartAddressRepository->create(array_merge($shippingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING])); } } } }
-
-
@RK-REZA
Have you done any customization in the code previously on checkout? -
-
If I remove my payment package the checkout works. But when I add again the error shows.
-
@RK-REZA
please check the error on network and click on save-shipping then show the response, so that we can read the error messge -
-
@Vaishali-Agarwal I think there is no problem in Bagisto 1.2 . This error is showing only when I'm adding my payment package.
-
@RK-REZA
Yes, bagisto v1.2 don't have this type of any error, you need to debug your package. -
@Vaishali-Agarwal I tried but didn't find any issue. That's why I posted here with my source code.
-
@Vaishali-Agarwal
You can see my previous version is working fine here - https://phpstack-378818-1259319.cloudwaysapps.com/ -
@Vaishali-Agarwal - Problem solved.
-
@RK-REZA
Great !