Transfer to Vendor's wallet is NOT happening - Mangopay

  • Posts: 128
  • Thank you received: 2
7 years 6 months ago #252401

-- HikaShop version -- : 2.6.4
-- HikaMarket version -- : 1.7.2
-- Joomla version -- : 3.6.2
-- PHP version -- : 5.6

Hi there,

I'm testing the Mangopay plugin but all I can see in the Mangopay dashboard is that the credited amount sits in the buyers wallet and it does not get transferred to the Vendor's wallet. I have run reports in Mangoay dashboard to list all successful and errored operations including payins and transfers but there is no sign of any transfer at all - so I discard that the transfers fail because of Mangopay conditions, it looks like Hikashop is NOT initiating them.

Some of the key settings I have:
Hikamarket Config:
- Market mode: store paid directly

Hikashop config:
- Payment confirmed order status: confirmed
- Invoice order statuses: confirmed

Mangopay Joomla plugin:
- Payout waiting duration: 0
- Order statuses for wallet transfer: confirmed

Mangopay Payment Method:
- Default Settings

Fees:
- I have not configured any fees so the vendor should receive the total amount of the order

Hikashop is marking the orders as "paid to the vendor" in the backend and front end. But the Vendor's wallet amount does not reflect this (which is correct since there has been no transfer between wallets).

Additional Note: I can also see that the hikashop order gets an invoice number but the vendor suborder does not get an invoice number. (this does not happen when using the bank transfer payment method, once an order is changed into "confirmed" it gets an invoice number both the hikashop order and the vendor suborder)

Anything else I should be checking?

Many thanks!

Last edit: 7 years 6 months ago by sabroso.

Please Log in or Create an account to join the conversation.

  • Posts: 26008
  • Thank you received: 4004
  • MODERATOR
7 years 6 months ago #252403

Hi,

Thanks for the report.

Because your setting "invoice order statuses" is right configured, you can let the setting "order statuses for wallet transfer" empty.
It will avoid issues if you modify your HikaShop configuration in the future.

MangoPay have a setting "sandbox" in the Joomla part of the plugin ; and it have a setting "debug" when you create an instance of the payment method.
The "debug" is there to store information in the HikaShop payment log file. It can be useful to have some trace of what is happening.

During the event "onAfterOrderUpdate", the MangoPay plugin will check if the order is "confirm" and will then process the payment of the vendors.
If you take a look in the database, for the table "order" you will see a column named "order_payment_params". It contains serialized data for the payment and MangoPay is using it to store element like the "wallet id" and the different states (so he can know if the transfert already occurred or not).
There you can see the wallet ID used for the order but also the wallet ID for your vendors (stored in the sub orders).

Because you have the order marked as "paid" in the HikaShop backend, we know that MangoPay tried to do the transfer of money to the vendors.
If during a call to the MangoPay API there is an error ; the error message is stored in the HikaShop payment log (even if the debug is not activated).

Thanks to the data stored in the orders and the HikaShop payment log ; you should be able to know more about what is happening.

I made some test with my sandbox account and I was able to reproduce your issue and I had that message in the HikaShop payment log

Details: MangoPay\Error Object
(
    [Message] => One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.
    [Errors] => stdClass Object
        (
            [Currency] => The code  cannot be found in the standard ISO 4217 : http://en.wikipedia.org/wiki/ISO_4217
        )
)
I check the MangoPay code in order to understand why the currency code was wrong/missing and I saw that there was some modifications in the order object provided by HikaShop.

In the file "plugins/hikashoppayment/mangopay/mangopay.php" file, please replace
	if(!empty($order->order_currency_id)) {
		$currencyClass = hikashop_get('class.currency');
		$currencies = null;
		$currencies = $currencyClass->getCurrencies($order->order_currency_id, $currencies);
		$this->currency = $currencies[$order->order_currency_id];
	}
By
	$currency_id = (isset($order->order_currency_id) ? (int)$order->order_currency_id : (int)$order->old->order_currency_id);
	if(!empty($currency_id)) {
		$currencyClass = hikashop_get('class.currency');
		$currencies = null;
		$currencies = $currencyClass->getCurrencies($currency_id, $currencies);
		$this->currency = $currencies[$currency_id];
	}
So the currency will be loaded correctly even if the order object do not include that information.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 128
  • Thank you received: 2
7 years 6 months ago #252789

Thank you for the detailed response.

Unfortunately your suggestion did not solve my problem.

I think something is going wrong before the wallet transfer is requested. The payin is reported as successful but the tranfer does not seem to get initiated at all.

I don't get any error in the payment log file ( I switched on debug mode but that does not add anything to the log file). The log file had some old error messages so it looks like to log file works OK.

What I have noticed is that the suborder does not get an invoice number, even though the order is confirmed - I attach a CSV from my hikashop_order table so you can see.

Maybe it is a configuration problem? Is there any option relating to when the vendor suborder gets an invoice number? Maybe that's what stopping the process...

Thanks!

File Attachment:

File Name: hikashop-order.csv
File Size:6 KB

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26008
  • Thank you received: 4004
  • MODERATOR
7 years 6 months ago #252819

Hi,

It is strange ; are you sure that you do not have an error in your PHP error log ?

In your order export, we can see that the subsales do not have any invoice id (or invoice number), so it looks like the orders have not been processed entirely.
Because the main order is confirmed and have an invoice ID ; his sub sales should also have an invoice id.
That element makes me think that you could have a PHP error in the process which would stop the update of the subsales and maybe, the transfert of the money between the wallets.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 128
  • Thank you received: 2
7 years 6 months ago #252893

Hi Jerome,

I switched on error reporting and this is what I found in the error log.

Right after submitting the shoppping cart (after pressing the finished button and when redirected to Mangopay), the following line gets added to the log

[19-Oct-2016 05:58:30 America/New_York] PHP Warning:  Creating default object from empty value in /home/XXXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 192

After introducing the credit card number in MangoPay and being redirected back to the website, the following lines get added to the log
[19-Oct-2016 05:59:42 America/New_York] PHP Notice:  Undefined property: stdClass::$order_user_id in /home/XXXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 514
[19-Oct-2016 05:59:42 America/New_York] PHP Notice:  Trying to get property of non-object in /home/XXXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 515
[19-Oct-2016 05:59:42 America/New_York] PHP Notice:  Trying to get property of non-object in /home/XXXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 515
[19-Oct-2016 05:59:42 America/New_York] PHP Notice:  Undefined property: stdClass::$order_full_price in /home/XXXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 573
[19-Oct-2016 05:59:42 America/New_York] PHP Notice:  Undefined property: stdClass::$order_payment_tax in /home/XXXXX/public_html/media/com_hikamarket/mail/order_status_notification.preload.php on line 55
[19-Oct-2016 05:59:42 America/New_York] PHP Notice:  Undefined property: stdClass::$order_payment_tax in /home/XXXXX/public_html/media/com_hikamarket/mail/order_status_notification.preload.php on line 55
[19-Oct-2016 05:59:42 America/New_York] PHP Notice:  Undefined property: stdClass::$order_payment_tax in /home/XXXXX/public_html/media/com_hikamarket/mail/order_status_notification.preload.php on line 55

And these are the referenced lines in mangopay.php
Line 192
$payIn->Tag = 'order#' . $order->order_id;

LIne 514
$order->user = $userClass->get((int)$order->order_user_id);

Line 515
$mangoCustomerId = $order->user->user_params->mangopay_id;

Line 573
$order_full_price = (float)hikamarket::toFloat($order->order_full_price);


What do you think?

Thanks!

Last edit: 7 years 6 months ago by sabroso.

Please Log in or Create an account to join the conversation.

  • Posts: 128
  • Thank you received: 2
7 years 6 months ago #252915

There seems to be a typo in line 192, it should be capital P, as follows:

$PayIn->Tag = 'order#' . $order->order_id;

This solves the warning that was appearing before submitting the shopping cart. However the transfer between wallets is still NOT happening and the rest of errors that happen after being redirected back from Mangopay remain:
[19-Oct-2016 06:17:24 America/New_York] PHP Notice:  Undefined property: stdClass::$order_user_id in /home/XXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 514
[19-Oct-2016 06:17:24 America/New_York] PHP Notice:  Trying to get property of non-object in /home/XXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 515
[19-Oct-2016 06:17:24 America/New_York] PHP Notice:  Trying to get property of non-object in /home/XXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 515
[19-Oct-2016 06:17:24 America/New_York] PHP Notice:  Undefined property: stdClass::$order_full_price in /home/XXXX/public_html/plugins/hikashoppayment/mangopay/mangopay.php on line 573
[19-Oct-2016 06:17:24 America/New_York] PHP Notice:  Undefined property: stdClass::$order_payment_tax in /home/XXXX/public_html/media/com_hikamarket/mail/order_status_notification.preload.php on line 55
[19-Oct-2016 06:17:25 America/New_York] PHP Notice:  Undefined property: stdClass::$order_payment_tax in /home/XXXX/public_html/media/com_hikamarket/mail/order_status_notification.preload.php on line 55
[19-Oct-2016 06:17:25 America/New_York] PHP Notice:  Undefined property: stdClass::$order_payment_tax in /home/XXXX/public_html/media/com_hikamarket/mail/order_status_notification.preload.php on line 55

Thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 26008
  • Thank you received: 4004
  • MODERATOR
7 years 6 months ago #252910

Hi,

I think you should use the "contact us" form with a link to that thread so I will be able to provide you the latest version of the mangopay plugin.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 128
  • Thank you received: 2
7 years 6 months ago #253015

Done, thank you!

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.070 seconds
Powered by Kunena Forum