コード例 #1
0
 /**
  * @param $paymentProcessor
  * @param $paymentMode
  * @param $start
  * @param $end
  */
 public static function google($paymentProcessor, $paymentMode, $start, $end)
 {
     require_once "CRM/Contribute/BAO/Contribution/Utils.php";
     require_once 'CRM/Core/Payment/Google.php';
     $nextPageToken = TRUE;
     $searchParams = array('start' => $start, 'end' => $end, 'notification-types' => array('charge-amount'));
     $response = CRM_Core_Payment_Google::invokeAPI($paymentProcessor, $searchParams);
     while ($nextPageToken) {
         if ($response[0] == 'error') {
             CRM_Core_Error::debug_log_message("GOOGLE ERROR: " . $response[1]['error']['error-message']['VALUE'], TRUE);
         }
         $nextPageToken = isset($response[1][$response[0]]['next-page-token']['VALUE']) ? $response[1][$response[0]]['next-page-token']['VALUE'] : FALSE;
         if (is_array($response[1][$response[0]]['notifications']['charge-amount-notification'])) {
             if (array_key_exists('google-order-number', $response[1][$response[0]]['notifications']['charge-amount-notification'])) {
                 // sometimes 'charge-amount-notification' itself is an absolute
                 // array and not array of arrays. This is the case when there is only one
                 // charge-amount-notification. Hack for this special case -
                 $chrgAmt = $response[1][$response[0]]['notifications']['charge-amount-notification'];
                 unset($response[1][$response[0]]['notifications']['charge-amount-notification']);
                 $response[1][$response[0]]['notifications']['charge-amount-notification'][] = $chrgAmt;
             }
             foreach ($response[1][$response[0]]['notifications']['charge-amount-notification'] as $amtData) {
                 $searchParams = array('order-numbers' => array($amtData['google-order-number']['VALUE']), 'notification-types' => array('risk-information', 'new-order', 'charge-amount'));
                 $response = CRM_Core_Payment_Google::invokeAPI($paymentProcessor, $searchParams);
                 // append amount information as well
                 $response[] = $amtData;
                 $params = self::formatAPIParams($response, self::$_googleParamsMapper, 'google');
                 if ($paymentMode == 'test') {
                     $params['transaction']['is_test'] = 1;
                 } else {
                     $params['transaction']['is_test'] = 0;
                 }
                 if (self::processAPIContribution($params)) {
                     CRM_Core_Error::debug_log_message("Processed - {$params['email']}, {$amtData['total-charge-amount']['VALUE']}, {$amtData['google-order-number']['VALUE']} ..<p>", TRUE);
                 } else {
                     CRM_Core_Error::debug_log_message("Skipped - {$params['email']}, {$amtData['total-charge-amount']['VALUE']}, {$amtData['google-order-number']['VALUE']} ..<p>", TRUE);
                 }
             }
             if ($nextPageToken) {
                 $searchParams = array('next-page-token' => $nextPageToken);
                 $response = CRM_Core_Payment_Google::invokeAPI($paymentProcessor, $searchParams);
             }
         }
     }
 }
コード例 #2
0
ファイル: Google.php プロジェクト: ksecor/civicrm
 /**  
  * Sets appropriate parameters for checking out to google
  *  
  * @param array $params  name value pair of contribution datat
  *  
  * @return void  
  * @access public 
  *  
  */
 function doTransferCheckout(&$params)
 {
     parent::doTransferCheckout($params, 'event');
 }
コード例 #3
0
ファイル: Google.php プロジェクト: ksecor/civicrm
 /**  
  * Sets appropriate parameters for checking out to google
  *  
  * @param array $params  name value pair of contribution datat
  *  
  * @return void  
  * @access public 
  *  
  */
 function doTransferCheckout(&$params)
 {
     parent::doTransferCheckout($params, 'contribute');
 }