Просмотр исходного кода

Ticket #418 - Related changes in Payments module.

AntonLV 10 лет назад
Родитель
Сommit
fb016a4945

+ 5 - 1
modules/boonex/payment/classes/BxPaymentModule.php

@@ -443,6 +443,7 @@ class BxPaymentModule extends BxBaseModPaymentModule
 		if($bTypeSingle)
 			$sCartItems = $this->_oDb->getCartItems($iClientId);
 
+		$bResult = false;
         $aItems = $this->_oConfig->descriptorsM2A($aPending['items']);
         foreach($aItems as $aItem) {
         	$sMethod = $bTypeSingle ? 'callRegisterCartItem' : 'callRegisterSubscriptionItem';
@@ -463,13 +464,16 @@ class BxPaymentModule extends BxBaseModPaymentModule
 
             if($bTypeSingle)
             	$sCartItems = trim(preg_replace("'" . $this->_oConfig->descriptorA2S($aItem) . ":?'", "", $sCartItems), ":");
+
+			$bResult = true;
         }
 
         if($bTypeSingle)
 			$this->_oDb->setCartItems($iClientId, $sCartItems);
 
-        $bResult = $this->_oDb->updateOrderPending($aPending['id'], array('processed' => 1));
         if($bResult) {
+        	$this->_oDb->updateOrderPending($aPending['id'], array('processed' => 1));
+
 			//--- 'System' -> 'Register Payment' for Alerts Engine ---//
 			bx_import('BxDolAlerts');
 	        $oZ = new BxDolAlerts('system', 'register_payment', 0, $iClientId, array('pending' => $aPending));

+ 3 - 3
modules/boonex/payment/classes/BxPaymentProviderStripe.php

@@ -258,7 +258,7 @@ class BxPaymentProviderStripe extends BxBaseModPaymentProvider implements iBxBas
 				'description' => $aCartInfo['items_title'],
 				'metadata' => array(
 					'vendor' => $aCartInfo['vendor_id'],
-					'customer' => $aClient['id'],
+					'client' => $aClient['id'],
 					'product' => $iPendingId,
 					'verification' => $this->_getVerificationCodeCharge($aCartInfo['vendor_id'], $aClient['id'], $fAmount, $aCartInfo['vendor_currency_code'])
 				)
@@ -273,7 +273,7 @@ class BxPaymentProviderStripe extends BxBaseModPaymentProvider implements iBxBas
 			return false;
 
 		$aMetadata = $aResult['metadata'];
-		if(empty($aMetadata['verification']) || $aMetadata['verification'] != $this->_getVerificationCodeCharge($aMetadata['vendor'], $aMetadata['customer'], $aResult['amount'], $aResult['currency']))
+		if(empty($aMetadata['verification']) || $aMetadata['verification'] != $this->_getVerificationCodeCharge($aCartInfo['vendor_id'], $aClient['id'], $aResult['amount'], $aResult['currency']))
 			return false;
 
 		return array(
@@ -318,7 +318,7 @@ class BxPaymentProviderStripe extends BxBaseModPaymentProvider implements iBxBas
 				'plan' => $aItem['name'],
 				'metadata' => array(
 					'vendor' => $aCartInfo['vendor_id'],
-					'customer' => $aClient['id'],
+					'client' => $aClient['id'],
 					'product' => $iPendingId,
 					'verification' => $this->_getVerificationCodeSubscription($aCartInfo['vendor_id'], $aClient['id'], $aItem['name'], $aCartInfo['vendor_currency_code'])
 				)