order-check

($ap_gateway->get_option(‘sslverify’) == ‘yes’),
‘body’ => array(
‘userName’=> ‘testguiddini’,
‘password’=> ‘guiddini2017’,
‘orderId’ => $gatewayOrderId,
)
);

$gatewayApiUrl = $ap_gateway->get_option(‘order-status-request’);

$response = wp_remote_post($gatewayApiUrl, $params);

if(is_wp_error($response)) {
throw new Exception($response->get_error_message());
}

//$fh = fopen(“/tmp/text.txt”,’w’);
//fwrite($fh, “order_id”.$order_id);
//fwrite($fh, “\n\n”);
//fwrite($fh, “gatewayOrderId”.$gatewayOrderId);
//fwrite($fh, “\n\n”);
//fwrite($fh, $response[‘body’]);
//fclose($fh);

$json = json_decode($response[‘body’]);

// Mark order status
if(!isset($json->ErrorCode) || $json->ErrorCode == 0) {
$order->update_status(‘completed’, __(‘Payment completed’));

// Reduce stock levels
$order->reduce_order_stock();

// Remove cart
WC()->cart->empty_cart();

} else {
$order->update_status(‘failed’, __(‘Payment completed’));

}

// Redirect to endpoint
wp_redirect($endpoint);

Compare items
  • Total (0)
Compare
0