/**
  * Adds the standard transaction data to the order
  *
  * @since 1.0.0
  * @param WC_Order $order the order object
  * @param SV_WC_Payment_Gateway_API_Response|null $response optional transaction response
  */
 public function add_transaction_data($order, $response = null)
 {
     // transaction id if available
     if ($response && $response->get_transaction_id()) {
         $this->update_order_meta($order->id, 'trans_id', $response->get_transaction_id());
         // set transaction ID for WC core - remove this and use WC_Order::payment_complete() to add transaction ID after 2.2+ can be required
         update_post_meta($order->id, '_transaction_id', $response->get_transaction_id());
     }
     // transaction date
     $this->update_order_meta($order->id, 'trans_date', current_time('mysql'));
     // if there's more than one environment
     if (count($this->get_environments()) > 1) {
         $this->update_order_meta($order->id, 'environment', $this->get_environment());
     }
     // customer data
     if ($this->supports_customer_id()) {
         $this->add_customer_data($order, $response);
     }
     /**
      * Payment Gateway Add Transaction Data Action.
      *
      * Fired after a transaction is processed and provides actors a way to add additional
      * transactional data to an order given the transaction response object.
      *
      * @since 4.1.0
      * @param \WC_Order $order order object
      * @param \SV_WC_Payment_Gateway_API_Response|null $response transaction response
      * @param \SV_WC_Payment_Gateway $this instance
      */
     do_action('wc_payment_gateway_' . $this->get_id() . '_add_transaction_data', $order, $response, $this);
 }
 /**
  * Adds the standard capture data to the order
  *
  * @since 2.0
  * @param WC_Order $order the order object
  * @param SV_WC_Payment_Gateway_API_Response $response transaction response
  */
 protected function add_capture_data($order, $response)
 {
     // mark the order as captured
     $this->update_order_meta($order->id, 'charge_captured', 'yes');
     // add capture transaction ID
     if ($response && $response->get_transaction_id()) {
         $this->update_order_meta($order->id, 'capture_trans_id', $response->get_transaction_id());
     }
 }
 /**
  * Adds the standard transaction data to the order
  *
  * @since 1.0.0
  * @param WC_Order $order the order object
  * @param SV_WC_Payment_Gateway_API_Response|null $response optional transaction response
  */
 protected function add_transaction_data($order, $response = null)
 {
     // transaction id if available
     if ($response && $response->get_transaction_id()) {
         $this->update_order_meta($order->id, 'trans_id', $response->get_transaction_id());
         // set transaction ID for WC core - remove this and use WC_Order::payment_complete() to add transaction ID after 2.2+ can be required
         update_post_meta($order->id, '_transaction_id', $response->get_transaction_id());
     }
     // transaction date
     $this->update_order_meta($order->id, 'trans_date', current_time('mysql'));
     // if there's more than one environment
     if (count($this->get_environments()) > 1) {
         $this->update_order_meta($order->id, 'environment', $this->get_environment());
     }
     // if there is a payment gateway customer id, set it to the order (we don't append the environment here like we do for the user meta, because it's available from the 'environment' order meta already)
     if (isset($order->customer_id) && $order->customer_id) {
         $this->update_order_meta($order->id, 'customer_id', $order->customer_id);
     }
 }
 /**
  * Authorize.Net allows for an authorized & captured transaction that has not
  * yet settled to be voided. This overrides the refund method when a refund
  * request encounters the "Code 54 - The referenced transaction does not meet
  * the criteria for issuing a credit." error and attempts a void instead.
  *
  * @since 2.0.0
  * @see SV_WC_Payment_Gateway::maybe_void_instead_of_refund()
  * @param \WC_Order $order order
  * @param \SV_WC_Payment_Gateway_API_Response $response refund response
  * @return boolean true if
  */
 protected function maybe_void_instead_of_refund($order, $response)
 {
     return !$response->transaction_approved() && '3' == $response->get_transaction_response_code() && '54' == $response->get_transaction_response_reason_code();
 }
 /**
  * Adds the standard transaction data to the order
  *
  * @since 1.0
  * @param WC_Order $order the order object
  * @param SV_WC_Payment_Gateway_API_Response|null $response optional transaction response
  */
 protected function add_transaction_data($order, $response = null)
 {
     // transaction id if available
     if ($response && $response->get_transaction_id()) {
         update_post_meta($order->id, '_wc_' . $this->get_id() . '_trans_id', $response->get_transaction_id());
     }
     // transaction date
     update_post_meta($order->id, '_wc_' . $this->get_id() . '_trans_date', current_time('mysql'));
     // if there's more than one environment
     if (count($this->get_environments()) > 1) {
         update_post_meta($order->id, '_wc_' . $this->get_id() . '_environment', $this->get_environment());
     }
     // if there is a payment gateway customer id, set it to the order (we don't append the environment here like we do for the user meta, because it's available from the 'environment' order meta already)
     if (isset($order->customer_id) && $order->customer_id) {
         update_post_meta($order->id, '_wc_' . $this->get_id() . '_customer_id', $order->customer_id);
     }
 }
 /**
  * Called after an unsuccessful transaction attempt
  *
  * @since 3.0
  * @param WC_Order $order the order
  * @param SV_WC_Payment_Gateway_API_Response $response the transaction response
  * @return boolean false
  */
 protected function do_transaction_failed_result(WC_Order $order, SV_WC_Payment_Gateway_API_Response $response)
 {
     // Authorize.net Payment Failed ( $response->get_status_message() )
     $order_note = $response->get_status_message();
     // add transaction id if there is one
     if ($response->get_transaction_id()) {
         $order_note .= ' ' . sprintf(__('Transaction ID %s', WC_Authorize_Net_AIM::TEXT_DOMAIN), $response->get_transaction_id());
     }
     $this->mark_order_as_failed($order, $order_note);
     return false;
 }
 /**
  * Adds the standard transaction data to the order
  *
  * @since 1.0.0
  * @param WC_Order $order the order object
  * @param SV_WC_Payment_Gateway_API_Response|null $response optional transaction response
  */
 public function add_transaction_data($order, $response = null)
 {
     // transaction id if available
     if ($response && $response->get_transaction_id()) {
         $this->update_order_meta($order->id, 'trans_id', $response->get_transaction_id());
         // set transaction ID for WC core - remove this and use WC_Order::payment_complete() to add transaction ID after 2.2+ can be required
         update_post_meta($order->id, '_transaction_id', $response->get_transaction_id());
     }
     // transaction date
     $this->update_order_meta($order->id, 'trans_date', current_time('mysql'));
     // if there's more than one environment
     if (count($this->get_environments()) > 1) {
         $this->update_order_meta($order->id, 'environment', $this->get_environment());
     }
     // customer data
     if ($this->supports_customer_id()) {
         $this->add_customer_data($order, $response);
     }
     do_action('wc_payment_gateway_' . $this->get_id() . '_add_transaction_data', $order, $response, $this);
 }