4
Answers
Vote up!
0
Vote down!

Drupal commerce payment module workflow

Hi,

I posted this on the Drupal commerce discussion board, but I think that may not have been the correct place, since this is a more general developers question. Perhaps you can help...

I'm creating a new payment module for bank's VPC api. This is an offsite payment portal.

All seems good, however, there is only one message that the bank sends to confirm payment. There is no second notification to confirm payment, like Paypal's IPN.

When I create the transaction and save it as COMMERCE_PAYMENT_STATUS_SUCCESS, commerce saves the status as "Pending".

What should the actual status be, to indicate the correct stage in the workflow for the site owner, and how do I set the status to this state?

I only ask, because I'm unsure if I should be doing more here. It looks as if this is the correct way to do it, so that site configuration can add to this state. But my query is really because the bank's api goes against the workflow that's assumed workflow in Drupal - i.e. the initial response from the API call is the bank's confirmation of payment. Should it be left in the pending state, and the merchant should then go in for each transaction, check payment and update the status manually, or should my code update the state to some other state, automatically?

Thanks in advance for your help.

Asked by: john_a
on February 21, 2014

4 Answers

Vote up!
0
Vote down!

Looking in the history of a test payment:

Status has been set to Pending (previously: Checkout: Complete).
Status has been set to Checkout: Complete (previously: Checkout: Confirm order).
Status has been set to Checkout: Confirm order (previously: Checkout: Payment).
Payment of $48.00 AUD submitted via myBank.
Order has been paid in full.
Status has been set to Checkout: Payment (previously: Checkout: Review).
Status has been set to Checkout: Review (previously: Checkout: Shipping).
...

The documentation that I've found seems a little thin or confusing on the workflow, and what we're supposed to do here, in the code, and in the store configuration (we're using commerce_kickstart).

Can anyone tell me if this is the correct behaviour?

Answer by: john_a
Posted: Feb 24, 2014
Vote up!
0
Vote down!

From a successful PayPal WPS transaction I get the following log entries. The exact position of the Payment & Order lines in the log changes and can appear below
"Status has been set to Checkout: Complete (previously: Checkout: Payment)." I have no idea if this is a result of the way the log view is built or if it's an actual difference in the timing of events.

Payment of CC$XXX submitted via PayPal WPS.
Order has been paid in full.
Status has been set to Pending (previously: Checkout: Complete).
Status has been set to Checkout: Complete (previously: Checkout: Payment).
Status has been set to Checkout: Payment (previously: Checkout: Shipping).
Status has been set to Checkout: Shipping (previously: Checkout: Checkout).
Status has been set to Checkout: Checkout (previously: Shopping cart).

It looks to have the same entries and ends with the cart in the same status.

Cheers.

Andy @ BlueFusion
Posted: Feb 24, 2014
Vote up!
0
Vote down!

Thanks for replying DNZ.

I'm assuming that your final status at this stage, on completed checkout is "Pending"?

Thus allowing the merchant to manually move the tramnsaction forward, and he verifies funds have arrived, ships and completes the transaction.

Thanks

Answer by: john_a
Posted: Feb 24, 2014
Vote up!
0
Vote down!

I'm assuming that your final status at this stage, on completed checkout is "Pending"?
Yes, the status at the end of the customer's checkout process is always 'Pending'.

This, as you say, will leave the merchant free to go and check his account prior to shipping the goods and moving it to 'Completed'.

Cheers.

Andy @ BlueFusion
Posted: Feb 25, 2014