News:

Support the VirtueMart project and become a member

Main Menu

Applying partial payments

Started by corkys, October 08, 2015, 22:52:04 PM

Previous topic - Next topic

corkys

I am using VM3.0.10 on Joomla 3.4.4

I have created a Gift Card payment plugin. It works great when the gift card balance exceeds the total cart price. The price is subtracted and the remaining balance is stored for next time.
Example:
Cart Total: $45.78
Gift Card Balance: $50
Full payment made - Remaining Gift Card Balance: $4.22

My problem is the next time, when the shopper needs to make a purchase while the total cart price exceeds the remaining balance.
Cart Total: $28.99
Gift card balance: $4.22
Remaining Cart Balance: $24.77

I need to subtract the gift card amount from the total price and force the shopper to select an additional payment method. I would like to do this before confirmation so if they decide to cancel the order, it doesn't subtract the any value from the gift card balance.

I'm using plgVmOnSelectCheckPayment to get the balance of the gift card from the database based on the card number entered.
I can get this to display correctly in the cart with plgVmDisplayListFEPayment after selecting the gift card method, but when plgVmConfirmedOrder is fired the order it leaves an unpaid amount. Should I return FALSE here or NULL?

How do I prevent confirming the order if there is still an amount to be paid?
Is it even possible for the system to select multiple payments methods?