Registration Confirm page fails with discounted priceset CRM-15730 fix
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 18 Dec 2014 13:17:33 +0000 (18:47 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 18 Dec 2014 13:17:33 +0000 (18:47 +0530)
CRM/Core/Payment/PayPalImpl.php
CRM/Event/Form/Registration/Confirm.php

index 8481a4ec81cc3bcf5c98c1bad65025e1d1bef1cd..867df555c826f75600ae51aaece50d8ee0310d21 100644 (file)
@@ -110,7 +110,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $args['paymentAction'] = $params['payment_action'];
     $args['amt'] = $params['amount'];
     $args['currencyCode'] = $params['currencyID'];
-    $args['desc'] = $params['description'];
+    $args['desc'] = CRM_Utils_Array::value('description', $params);
     $args['invnum'] = $params['invoiceID'];
     $args['returnURL'] = $params['returnURL'];
     $args['cancelURL'] = $params['cancelURL'];
@@ -167,10 +167,10 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $params['payer_id'] = $result['payerid'];
     $params['payer_status'] = $result['payerstatus'];
     $params['first_name'] = $result['firstname'];
-    $params['middle_name'] = $result['middlename'];
+    $params['middle_name'] = CRM_Utils_Array::value('middlename', $result);
     $params['last_name'] = $result['lastname'];
     $params['street_address'] = $result['shiptostreet'];
-    $params['supplemental_address_1'] = $result['shiptostreet2'];
+    $params['supplemental_address_1'] = CRM_Utils_Array::value('shiptostreet2', $result);
     $params['city'] = $result['shiptocity'];
     $params['state_province'] = $result['shiptostate'];
     $params['postal_code'] = $result['shiptozip'];
@@ -200,8 +200,8 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $args['currencyCode'] = $params['currencyID'];
     $args['payerID'] = $params['payer_id'];
     $args['invnum'] = $params['invoiceID'];
-    $args['returnURL'] = $params['returnURL'];
-    $args['cancelURL'] = $params['cancelURL'];
+    $args['returnURL'] = CRM_Utils_Array::value('returnURL', $params);
+    $args['cancelURL'] = CRM_Utils_Array::value('cancelURL', $params);
     $args['desc'] = $params['description'];
 
     $result = $this->invokeAPI($args);
@@ -215,7 +215,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $params['trxn_id'] = $result['transactionid'];
     $params['gross_amount'] = $result['amt'];
     $params['fee_amount'] = $result['feeamt'];
-    $params['net_amount'] = $result['settleamt'];
+    $params['net_amount'] = CRM_Utils_Array::value('settleamt', $result);
     if ($params['net_amount'] == 0 && $params['fee_amount'] != 0) {
       $params['net_amount'] = $params['gross_amount'] - $params['fee_amount'];
     }
index 9f2a2c78e9308292ca0340b89ed4a24975c9b1e8..b0fd2db935b8d2ea2abbc21722d892b8308cee6e 100644 (file)
@@ -99,7 +99,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
         else
           CRM_Core_Error::fatal($paymentObjError);
 
-        $params['payer'] = $expressParams['payer'];
+        $params['payer'] = CRM_Utils_Array::value('payer', $expressParams);
         $params['payer_id'] = $expressParams['payer_id'];
         $params['payer_status'] = $expressParams['payer_status'];
 
@@ -121,6 +121,9 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
           $params['discountAmount'] = $this->_params[0]['discountAmount'];
           $params['discountMessage'] = $this->_params[0]['discountMessage'];
         }
+        if (!empty($this->_params[0]['amount_priceset_level_radio'])) {
+          $params['amount_priceset_level_radio'] = $this->_params[0]['amount_priceset_level_radio'];
+        }
         $params['amount_level'] = $this->_params[0]['amount_level'];
         $params['currencyID'] = $this->_params[0]['currencyID'];
         $params['payment_action'] = 'Sale';