/**
  * Simple wrapper for the api call / response treatement
  *
  * @param string $url
  * @param array $fields
  */
 private function performPayment($url, $fields)
 {
     $result = $this->curlAction($url, $fields);
     $result = $this->getDataTransaction($result);
     if ($result['CODEREPONSE'] == '00000') {
         edd_update_payment_status($this->payment, 'publish');
         edd_complete_purchase($this->payment, 'publish', 'pending');
         foreach ($this->purchaseDatas['downloads'] as $download) {
             $log = edd_record_log('Payment', 'Payment', $download['id'], 'sale');
             update_post_meta($log, '_edd_log_payment_id', $this->payment);
         }
         edd_empty_cart();
         edd_send_to_success_page();
     } else {
         if ($result['CODEREPONSE'] == '00001' || $result['CODEREPONSE'] == '00003') {
             $settings = $this->getSettings();
             // if the first prod url failed try the second
             if (!$settings['preprod'] && $url !== $settings['url_prod_2'] && isset($settings['url_prod_2'])) {
                 $this->performPayment($settings['url_prod_2'], $fields);
             }
             edd_record_gateway_error(__('Payment Error', 'edd'), __('Payment gateways unavailable', 'edd'));
             edd_send_back_to_checkout('?payment-mode=' . $this->gateway);
         } else {
             edd_record_gateway_error(__('Payment Error', 'edd'), $result['COMMENTAIRE']);
             edd_send_back_to_checkout('?payment-mode=' . $this->gateway);
         }
     }
 }
コード例 #2
0
/**
 * Record a gateway error
 *
 * A simple wrapper function for edd_record_log()
 *
 * @access public
 * @since 1.3.3
 * @param string $title Title of the log entry (default: empty)
 * @param string $message  Message to store in the log entry (default: empty)
 * @param int $parent Parent log entry (default: 0)
 * @return int ID of the new log entry
 */
function edd_record_gateway_error($title = '', $message = '', $parent = 0)
{
    return edd_record_log($title, $message, $parent, 'gateway_error');
}