/** * Close auth * * @param string $amazon_authorization_id */ public function close_authorization($amazon_authorization_id) { if ($this->log->get('gateway') == 'amazon-payments') { $response = $this->gateway->api_request(array('Action' => 'CloseAuthorization', 'AmazonAuthorizationId' => $amazon_authorization_id)); if (is_wp_error($response)) { return; } if (isset($response['Error']['Message'])) { $this->log->set('amazon-status', $response['Error']['Message'])->save(); } else { wpsc_delete_purchase_meta($this->log->get('id'), 'amazon_authorization_id'); $this->log->set('amazon-status', sprintf(__('Authorization closed (Auth ID: %s)', 'wpsc'), $amazon_authorization_id))->save(); $this->log->set('processed', WPSC_Purchase_Log::CLOSED_ORDER)->save(); } } }
/** * Void a refund request * * @param string $transaction_id */ public function void_refund($transaction_id) { if ($this->log->get('gateway') == 'worldpay') { $params = array('amount' => $this->log->get('totalprice'), 'transactionId' => $transaction_id); $response = $this->gateway->execute('Payments/Void', $params); if (is_wp_error($response)) { throw new Exception($response->get_error_message()); } wpsc_delete_purchase_meta($this->log->get('id'), 'worldpay_refunded'); wpsc_delete_purchase_meta($this->log->get('id'), 'worldpay_refund_id'); $this->log->set('processed', WPSC_Purchase_Log::ACCEPTED_PAYMENT)->save(); $this->log->set('wp_order_status', 'Completed')->save(); $this->log->set('worldpay-status', sprintf(__('Refund Voided (Transaction ID: %s)', 'wp-e-commerce'), $response['ResponseBody']->transaction->transactionId))->save(); $this->log->set('transactid', $response['ResponseBody']->transaction->transactionId)->save(); } }