9 replies [Last post]
Johnny van de Laar's picture
Offline
Bug Finder
Joined: 12/18/2007
Juice: 70

I've been implementing a neos and a tripledeal payment provider for the past few weeks and i'm nearing completion of them (most propably i'll donate them to the community when they are finished and tested)

but i have one small problem now. i cant find out how to change the state from "pending" to "post_checkout" when the order is sent to the payment provider and from "post_checkout" to "post_payment" after the payment provider replies back.

I use this code:

function uc_neos_ok() {
  unset($_SESSION['cart_order'], $_SESSION['do_complete']);
  uc_cart_empty(uc_cart_get_id());
  $id = $_GET["orderID"];
  if ($id < 1) {
    drupal_access_denied();
    return;
  }

  uc_order_comment_save($id, $user->uid, t('Bestel proces afgerond door klant'), 'admin');
  uc_order_update_status($id, uc_order_state_default('post_checkout'));
return variable_get('neos_success_msg', '');
}

but the order always stays "pending".

complete module is in the attachment

PreviewAttachmentSize
uc_neos_payment.zip4.14 KB
Johnny van de Laar's picture
Offline
Bug Finder
Joined: 12/18/2007
Juice: 70
Re: Modify order state

doesn't anyone know a solution?

i also added the workflow-ng module btw and i'm running ubercart alpha 8

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: Modify order state

Hmm... perhaps I can propose an alternative that may solve your issue? Instead of hardcoding status changes in the module, have you considered making a workflow-ng configuration? This gets triggered by a few different functions, like when payments get entered or a person completes checkout. This should let you tie in exactly where you need and update the status w/o hardcoding. Then if you want, you can actually define this workflow configuration as a default enabled workflow in your module so other folks can use it.

Johnny van de Laar's picture
Offline
Bug Finder
Joined: 12/18/2007
Juice: 70
Re: Re: Re: Modify order state

well I didn't consider it as I didn't know this was possible Eye-wink

but if you can tell me where I can find information about it then I will consider it

Johnny van de Laar's picture
Offline
Bug Finder
Joined: 12/18/2007
Juice: 70
Re: Re: Re: Re: Modify order state

thats odd... my question in the first post is gone Shocked

TR
TR's picture
Online
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3369
Re: Re: Re: Re: Re: Modify order state
<tr>.
Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6841
Re: Re: Re: Re: Re: Re: Modify order state

Fixed.

Johnny van de Laar's picture
Offline
Bug Finder
Joined: 12/18/2007
Juice: 70
ok thx i'm near solving the

ok thx

i'm near solving the problem myself. i'll post tomorrow what i found out Eye-wink

*cliffhanger*

Johnny van de Laar's picture
Offline
Bug Finder
Joined: 12/18/2007
Juice: 70
Re: ok thx i'm near solving the

ok i've been reading in the manual that you could update the status with this:
uc_order_update_status($id, uc_order_state_default('payment_received'));

and this didn't work...

but this does work:

uc_order_update_status($id, 'payment_received');

so I think this page is wrong:
http://www.ubercart.org/docs/api/uc_order_state_default

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: ok thx

Honestly, the former should work unless something screwed up on the setup of your order states/statuses. The second works because you're directly setting it to the payment_received status which is also the name of an entire order state. Tricky language, I know, but the code should work. The way to check it would be to look in your uc_order_statuses table and see what state is assigned for the payment_received status. If you wanted to put some benchmarks in the code to isolate the issue, you could put some drupal_set_message() calls in the uc_order_update_status() function.

In any event, glad it works for you as is.

Also, if you wanted to see an example of updating order status in a workflow configuration instead of hardcoding it, you can check out the function uc_payment_configuration() in uc_payment_workflow.inc.