• Resolved borish1

    (@borish1)


    Hi I need this code modified from this:

    /**
         * @return Patch
         * @throws InvalidArgumentException
         */
        public function custom()
        {
            $custom_patch = new Patch();
            $custom_patch
                ->setOp('add')
                ->setPath('/transactions/0/custom')
                ->setValue($this->order->get_order_key());
    
            return $custom_patch;
        }

    to this:

    /**
         * @return Patch
         * @throws InvalidArgumentException
         */
        public function custom()
        {
            $custom_patch = new Patch();
            $custom_patch
                ->setOp('add')
                ->setPath('/transactions/0/custom')
                ->setValue(wp_json_encode([
                    'order_id' => $this->order->get_id(),
                    'order_key' => $this->order->get_order_key(),
                ]));
    
            return $custom_patch;
        }

    Is there an easy way to do? Maybe you have some hooks that I could attach to?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Andreas W.

    (@aweissinpsyde)

    Hello @borish1

    how I see you already modified it. Can you give me more information about it please?

    Thread Starter borish1

    (@borish1)

    Hey Andreas,

    Yep, I modified it but directly inside the files (only on my development server to test it). The file is located inside /src/payment/ folder by the name of patchProvider.php.

    The key part of the functions is this one
    ->setValue($this->order->get_order_key());

    Currently, your plugin, upon successful creation of the invoice is sending custom data which in this case is wc_order_key.

    Now if we go back to 1.1.1 version of this plugin it actually sent both the wc_order_key and and order_id which is this part of code that I changed into:

    ->setValue(wp_json_encode([
                    'order_id' => $this->order->get_id(),
                    'order_key' => $this->order->get_order_key(),
                ]));

    Now my client is using third party software which pulls data via PayPal API from his PayPal account to double-check the order_key and order_id from the invoices but in 2.0.4 version we only have now order_key.

    That is the main reason why I needed that order_id.

    It would be good if you can put filter there so we can then add additional data without need to edit the core files of the plugin.

    Thread Starter borish1

    (@borish1)

    Some additional notes:

    https://ibb.co/VDwCZ1Y

    On the image, you can preview part of the invoice from the PayPal dashboard.
    The part that is important is the CUSTOM row which is basically a “Note” by the PayPal API documentation.

    That functions of yours custom() is passing only order_key but I need order_id as well.

    I hope this helps :).

    Plugin Support Andreas W.

    (@aweissinpsyde)

    Hello @borish1

    right now we can’t simply change code because new code will be revied and approved by PayPal. I’ll talk to our developer next Wednesday because currently, he is on holiday.

    Plugin Support Andreas W.

    (@aweissinpsyde)

    Hello @borish1

    we create an internal issue for it. The reference number is PPP-384 and it should be fixed with the next update.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Patch Custom note change (PayPal API)’ is closed to new replies.