Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Custom payment method not working in Bagisto 1.2

    Modules
    2
    17
    862
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      Vaishali Agarwal last edited by

      @RK-REZA
      update your code with this PR
      https://github.com/bagisto/bagisto/commit/b42ccbfa9e719c8526b249bbfef1951a894d0705 then check again.

      1 Reply Last reply Reply Quote 0
      • R
        RK REZA last edited by RK REZA

        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]));
                        }
                    }
                }
            }
        
        1 Reply Last reply Reply Quote 0
        • R
          RK REZA last edited by

          @Vaishali-Agarwal

          1 Reply Last reply Reply Quote 0
          • V
            Vaishali Agarwal last edited by

            @RK-REZA
            Have you done any customization in the code previously on checkout?

            1 Reply Last reply Reply Quote 0
            • R
              RK REZA last edited by

              @Vaishali-Agarwal No

              1 Reply Last reply Reply Quote 0
              • R
                RK REZA last edited by

                If I remove my payment package the checkout works. But when I add again the error shows.

                1 Reply Last reply Reply Quote 0
                • V
                  Vaishali Agarwal last edited by

                  @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

                  1 Reply Last reply Reply Quote 0
                  • R
                    RK REZA last edited by

                    @Vaishali-Agarwal

                    1.PNG

                    1 Reply Last reply Reply Quote 0
                    • R
                      RK REZA last edited by

                      @Vaishali-Agarwal I think there is no problem in Bagisto 1.2 . This error is showing only when I'm adding my payment package.

                      1 Reply Last reply Reply Quote 0
                      • V
                        Vaishali Agarwal last edited by

                        @RK-REZA
                        Yes, bagisto v1.2 don't have this type of any error, you need to debug your package.

                        1 Reply Last reply Reply Quote 0
                        • R
                          RK REZA last edited by

                          @Vaishali-Agarwal I tried but didn't find any issue. That's why I posted here with my source code.

                          1 Reply Last reply Reply Quote 0
                          • R
                            RK REZA last edited by

                            @Vaishali-Agarwal
                            You can see my previous version is working fine here - https://phpstack-378818-1259319.cloudwaysapps.com/

                            1 Reply Last reply Reply Quote 0
                            • R
                              RK REZA last edited by

                              @Vaishali-Agarwal - Problem solved.

                              1 Reply Last reply Reply Quote 0
                              • V
                                Vaishali Agarwal last edited by

                                @RK-REZA
                                Great !✌

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post