How to do refunds for Vendor Suborders paid with Mangopay

  • Posts: 128
  • Thank you received: 2
6 years 9 months ago #272322

-- HikaShop version -- : 3.0.1
-- HikaMarket version -- : 1.7.3
-- Joomla version -- : 3.7.1
-- PHP version -- : 5.6

Hi there,

I find quite difficult to understand refunds when using HikaMarket multi-vendor and MangoPay Payment plugin. In particular how to refund vendor suborders.

I’ll explain how I am doing it:

Step 1. The customer places the order and pays via Mangopay
--

  • The Vendor can go into the order H1J69 in his control panel and see the User Total 25 Euro and the Vendor Total 23.5 Euro which has the orange tick saying (Vendor has been paid for this order) → screenshot 1
  • The exports his orders to CSV and see that in order H1J69 order_full_price is 25 Euros and order_vendor_price 23.5 Euros → screenshot2

This is OK

Step 2. The Site Admin changes the Vendor sub-order status to Refunded
--

  • The Vendor goes into the order H1J69 in his control panel and see the User Total 25 Euro and the Vendor Total 0 Euro and next to it (23.5 Euros unpaid to Store) →screenshot3
  • The exports his orders to CSV and see that in order H1J69 order_full_price is 25 Euros and order_vendor_price 23.5 Euros → screenshot4


QUESTION: Why is order_vendor_price = 23.5 on the CSV export? Is it because the Vendor still has the 23.5 Euros and is pending to be paid to the store?
--

  • An adjustment is made to the Vendor Sub-order of -23.5 Euros → screenshot5
  • A negative Payment of -23.5 Euros is added to the Pending payments to the Vendor → screenshot6

QUESTION: Why this Payment does NOT reference order H1J69 and it says “None” ?


Step 3. Site Admin selects this “None” Payment and click “Pay”
--

  • This creates a new order H1N73 in status created for the account who is admin of the Vendor Account for 23.5 Euros → screenshot7
    This new order H1N73 contains product “Vendor Order (0.00 Euros)”

QUESTION: Shouldn’t this Vendor Order product mention Vendor Order H1J69? Otherwise the Vendor does not know what is this order for
--

  • The Vendor goes into the order H1J69 in his control panel and see the User Total 25 Euro and the Vendor Total 0 Euro and he orange tick saying (Vendor has been paid for this order) → Screenshot8

QUESTION: Considering order H1N73 is still in status created, why does it say “Vendor has been paid for this order” ? It should stay as (23.5 Euros unpaid to Store) until order H1N73 is confirmed.
--

  • The Vendor exports his orders to CSV and see that in order H1J69 order_full_price is 25 Euros and order_vendor_price 23.5 Euros → same as previous screenshot4

QUESTION: This is correct only if we consider that the Vendor still has the 23.5 Euros since order H1N73 is in created status

Step 4. The Vendor pays 23.5 Euros back to the Store and the Site Admin changes order H1N73 to confirmed
--

  • Order H1N73 still shows “Vendor Order (0.00 Euros)” and no reference to order H1J69 → same as previous screenshot7

QUESTION: Shouldn’t this reference order H1J69?
--

  • The Vendor goes into the order H1J69 in his control panel and see the User Total 25 Euro and the Vendor Total 0 Euro and he orange tick saying (Vendor has been paid for this order) → same as previous Screenshot8

This is correct now that order H1N73 is now confirmed.
--

  • The Vendor exports his orders to CSV and see that in order H1J69 order_full_price is 25 Euros and order_vendor_price 23.5 Euros → same as previous screenshot4

QUESTION: This is not correct since order_vendor_price should now be 0 Euros since order H1N73 is now confirmed which means the Vendor does not have the 23.5 Euros any more. The Vendor has 0 Euros from order H1J69 which he has paid back to the store as per order H1N73. If the Vendor sums all the amounts in the order_vendor_price column then he will think the Store owes him 23.5 Euros.

Many thanks for your answers and comments

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 9 months ago #272326

Hello,

Sorry but your message have a lot of questions and it's very very (very !) difficult to follow and answer to them.
Please make real points in your next messages or several threads for different questions.

Once a sub order is paid, his "vendor order total" do not change ; because it already been paid.
You can change his order status it won't change the fact that the sub order has been paid for the "vendor order total" it contains.
But you can find other sub orders for the vendor adjustments, when you make the sum of all of them, you got the final vendor order total for his current "status".
These adjustments are not real vendor sub orders ; so they do not have any order number ; because they are not orders (no product, etc) but just vendor price adjustments.

Afterwards, the HikaShop order export is related to HikaShop and extract the raw data from the database ; it does not export the "adjustments" because they are not visible in the HikaShop interface.

With HikaMarket 1.8 I want to change a bit how the sub-orders act and how the vendor order total is stored. I want to avoid the creation of these adjustments and store that data in an HikaMarket table.

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
6 years 9 months ago #272399

OK, if you have trouble understanding what I mean let's see if I can understand you:

Can you please explain step by step how are we supposed to do a refund for a Vendor suborder that has been paid via MangoPay? Including what happens with the adjustments and how we are supposed to deal with them

Thank you

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 9 months ago #272425

Hello,

There is no current support of automatic refund in the MangoPay plugin.

But there is an option in the plugin (in the Joomla part of it) named "Order statuses for wallet transfer".
It allows you to specify for which order status the customer wallet money will be transferred to the vendor wallets.
Once the transfert is made, the order is marked as paid and you logically should not set the order as refund afterwards.

Now, I can see to add features in the plugin to perform a "rollback" transfert if the order pass as "refund" and when the vendors have been already paid ; but I admit that I'm not really fan of it regarding all possible side effects (like, if the vendor already get the money to his bank account).

It is also possible to handle the refund using the MangoPay API but in a way, I would prefer to integrate with an HikaShop refund system (the idea is to have a "refund" button when you edit the order in the backend, so you are really sure that it's not a order status modification mistake).

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
6 years 9 months ago #272466

Hi Jerome,

Thank you for your good ideas for the future but this is NOT what I’m asking.

I would like to understand what is the process to do a refund NOW, with HikaMarket 1.7.3.

I understand there are some manual steps and that we cannot handle refunds now with the Mangopay API. That’s OK, I can go to the MangoPay dashboard and execute an action manually.

I just would like to know what actions I need to perform and in which order when a Vendor contacts me and tells me that his customer has requested a refund.

Surely before you do the coding, you need to think about a business logic which is what you are trying to accomplish with your coding. So that is what I would like to understand, how you thought the software should be used when you did the coding. Please!

I would like to see something like for example (this is just an example, I’m sure it is not right):
-Step 1: move the Vendor suborder to refunded
- As a consequence of Step 1 an order adjustment is created on the Parent order.
-Step 2: In the Vendors section of the backend, go to the Vendor in question and then click Pay. Select the order None and click pay.
- As a consequence of step 3 a new order is created as which represents the money to be returned by the Vendor to the store.
- Step 4: Once the money from the Vendor is received by the Store change this new order to confirmed.
- As a consequence of step 4 Vendor is notified of payment received for the settlement order
- Step 5: go to mangopay dashboard an return money to customer
- Step 6: notify customer
-Step 7: bla bla bla

This is just an example of the type of answer I am expecting from you and what I would consider good support. Please, please (please!)

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 9 months ago #272487

Hello,

The refund process with MangoPay is the same refund process than with any other payment system using HikaShop ; you need to do it manually in the payment platform interface.

But there is an option in the plugin (in the Joomla part of it) named "Order statuses for wallet transfer".
It allows you to specify for which order status the customer wallet money will be transferred to the vendor wallets.
Once the transfert is made, the order is marked as paid and you logically should not set the order as refund afterwards.

I wrote you to configure the plugin MangoPay in order to avoid the transfer of money to the vendors "too soon", so you do not have to perform tasks like "transfert the money from the vendor wallets to the customer wallet" ; which can be something complicated to do in their interface.

Best is to start with the refund in MangoPay interface.
And yes, you need to set the main order as "refunded", the vendor orders will be marked as well.
They will also be notified of that modification ; as the customer if you check the right box (so he will receive the email as a confirmation of the refund you just made in MangoPay).
Then, you can perform the "pay" action for the vendors to select the "adjustments" (and the suborders depending the first point) and mark them as paid (because you already handle that part manually in MangoPay).

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
6 years 9 months ago #272500

Hi Jerome,

Thank you for your patience, finally I feel we are on the same page. I appreciate your support.

The way I control that the Vendor does not take the money too soon is by making the “payout Waiting duration” in the Joomla Payment Plugin 14 days. “Order Status for Wallet transfer” I leave it blank so it follows the Hikashop configuration as per your recommendation in another post. This setup works well because the Vendor sees his money in his wallet as soon as the order is confirmed, but he cannot withdraw his money until 2 weeks later.

So, if the customer requests a refund 7 days after paying the order that money is still in the Vendor Wallet. So from the MangoPay dashboard I can transfer back to the user wallet and then trigger a refund to his credit card. It is manual but it works.

So lets test the process you suggest:

- Step 1: Return the money from the Vendor wallet to the customer using the MangoPay interface.
- Step 2: Set the Parent Order as “Refunded” and select notify customer.
Consequences of Step 2:
2.1 The Vendor Suborder does NOT change to refunded, stays as confirmed
2.2 Now when the Vendor looks the order from the Vendor Control Panel he sees Vendor Total = 0 Euros (X Euros unpaid to Store) SCREENSHOT_1→ this is NOT correct because the money has been taken in Step 1
-Step 3: Set the Vendor “None” Payment as paid (shows with status refunded)
Consequences of Step 3:
3.1 New Order created to the admin account of the Vendor. Status “Created”. → this is NOT correct because the Vendor has paid this on Step 1
3.2 The Vendor suborder stays as “Confirmed”. Still it does NOT change to refunded
3.3 Now when the Vendor looks the order from the Vendor Control Panel he sees Vendor Total = 0 Euros and the orange tick saying (vendor has been paid for this order) SCREENSHOT_2 → Previous problem (2.2) is now fixed.
-Step 4: Set the new order created (3.1) as confirmed → Previous problem (3.1) is now fixed


BIG PROBLEM OF THIS PROCESS:
- The Vendor suborder stays as CONFIRMED and although the suborder view in the Vendor control panel shows Vendor Total = 0 Euros if the Vendor does a CSV of his suborders he sees this order as CONFIRMED and order_vendor_price = X Euros SCREENSHOT_3 → vendor will think he is missing money

ANOTHER PROBLEM:
- When the adjustment is marked as paid (Step 3), why is the new order created (3.1) to the admin user of the Vendor Account? The problem is that the CSV export for Vendor suborders does not include this order because it is not linked to the Vendor Account, so it becomes very confusing for the Vendor

ANOTHER PROBLEM:
- The new order created in 3.1 does NOT say it has been created because of an adjustment to order XYZ SCREENSHOT_4. There is no reference to the refunded order that triggered this adjustment.

Attachments:

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 9 months ago #272550

Hello,

I'm sorry but I'm not following you for your workflow ; I do not understand what you're talking about.

1 - Oh yes, in HikaMarket 1.7 a paid order cannot be modified at all and the order status is not changed..
That's something I changed in HikaMarket 1.8 but with all the remaining tests I have to stabilize the new organisation (and the work I have for HikaSerial), I'm not able to release it yet.
Right now, the best would be to display the "current" order status from the "vendor adjustments".

In the hikamarket ordermarket/view.html.php file you will find the line

	$order->refunds = $db->loadObjectList();
You need to replace it with
	$order->refunds = $db->loadObjectList();

	foreach($order->refunds as $refund) {
		if($refund->order_vendor_paid == 0)
			$order->current_order_status = $refund->order_status;
	}

So in the ordermarket/show_block_general view, you can adapt the display of the order status
	if(!isset($this->edit) || $this->edit !== true ) {
		?><span><?php echo hikamarket::orderStatus($this->order->order_status); ?></span><?php
	} else {
		$extra = 'onchange="window.orderMgr.status_changed(this);"';
		echo $this->order_status->display('data[order][order_status]', $this->order->order_status, $extra);
	}
With something like
	$order_status = isset($this->order->current_order_status) ? $this->order->current_order_status : $this->order->order_status;
	if(!isset($this->edit) || $this->edit !== true ) {
		?><span><?php echo hikamarket::orderStatus($order_status); ?></span><?php
	} else {
		$extra = 'onchange="window.orderMgr.status_changed(this);"';
		echo $this->order_status->display('data[order][order_status]', $order_status, $extra);
	}
But for sure it won't affect the CSV export because that data is a raw export of what is in the database.

2 - I don't know what you're talking about.
When an adjustment is paid and there is a new need of adjustment, a new adjustment is created.
In HikaMarket 1.7 when an element is marked as "paid", it cannot be modified anymore to not generate side effects and keep some kind of history of what happened.

3 - When you pay your vendors, you have two modes of display, the first one is "orders" and the second is "products".
In "products" mode, an adjustment is not referring to a product ; that's why you have such kind of display.
And once again, that's something I'm trying to improve with a really hard and complicated work of HikaMarket 1.8

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
6 years 9 months ago #272809

Hi Jerome,

ordermarket/show_block_general view, does NOT have the lines you suggest to replace. Please clarify the second file that needs to be updated in your suggested in point 1

Thanks

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 9 months ago #272813

Hello,

It's the view show_general.
Afterwards, some modifications might be also needed in other "ordermarket" view to display the "current_order_status" instead of the "order_status", like in the views "show" and "status".

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.

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