CMS MADE SIMPLE FORGE

Self Registration

 

[#7685] Paid package with manual payment problem

avatar
Created By: Vincent G. (vinc)
Date Submitted: Thu Mar 08 11:38:29 -0500 2012

Assigned To: Robert Campbell (calguy1000)
Version: 1.6.14
CMSMS Version: 1.10.3
Severity: Critical
Resolution: None
State: Open
Summary:
Paid package with manual payment problem
Detailed Description:
Hi there,

Apparently, when using cart + orders + selfreg and a manual payment the
behaviour is like :

1- selfreg : add a registration to the cart
2- order : fill informations and proceed to payment
3- chekout with manual payment : erase cart 
4- order (after receiving the payment and say it is paid) : activate the FEU

But... at step 3, the manual checkout process erase the cart and so
event.CGEcommerceBase.CartAdjusted.php is called.
Which one seeing that a registration is deleted also delete the temporary
created user in SelfReg.

So step 4 cannot activate a non-existant "zombie" user and it fails !

Fix Proposal :
(also fix a typo error I think with "gateway-complate" -> "gateway-complete"
---------------------------
diff --git a/modules/SelfRegistration/event.CGEcommerceBase.CartAdjusted.php
b/modules/SelfRegistration/event.CGEcommerceBase.CartAdjusted.php
index 420289f..789493e 100644
--- a/modules/SelfRegistration/event.CGEcommerceBase.CartAdjusted.php
+++ b/modules/SelfRegistration/event.CGEcommerceBase.CartAdjusted.php
@@ -38,7 +38,20 @@
 #END_LICENSE
 if( !isset($gCms) ) exit;
 if( !isset($params['status']) ) return;
-if( !isset($params['extra']) || $params['extra'] == 'gateway-complate' )
return;
+if( !isset($params['extra']) || $params['extra'] == 'gateway-complete' )
return;
+
+// here we grab the order directly.
+$order_id = (int)$params['order_id'];
+$order_obj = orders_ops::load_by_id($order_id);
+if( !$order_obj )
+  {
+    return;
+  }
+else if( $order_obj->get_status() == ORDERSTATUS_CONFIRMED )
+  {
+    // don't do anything : we're dealing with a confirmed order and with manual
payment.
+    return;
+  }
 
 switch($params['status'])
   {
---------------------------

Feel free to comment adjust etc...

Regards

Vincent


History