2015-01-14 3 views
0

sagepay에서 거래 환불 코드를 작성하는 동안 오류가 발생했습니다. 3047 : 잘못된 VPSTxId 형식입니다. 내가 여기에 사용 코드는 다음과 같습니다Sagepay 환불 오류 - 3047 : 잘못된 VPSTxId 형식

if ($this->config->get('sagepay_direct_v3_test') == 'live') { 
     $url = 'https://live.sagepay.com/gateway/service/refund.vsp'; 
     $payment_data['VPSProtocol'] = '3.00'; 
    } elseif ($this->config->get('sagepay_direct_v3_test') == 'test') { 
     $url = 'https://test.sagepay.com/gateway/service/refund.vsp'; 
     $payment_data['VPSProtocol'] = '3.00'; 
    } 


    $this->load->model('checkout/order'); 
    $this->load->model('payment/sagepay_direct_v3'); 
    $order_info = $this->model_checkout_order->getOrder($order_id); 

    $sagepay_direct_v3_order = $this->getOrder($order_info['advance_order_confirmed_id']); 


    $params = array(); 
    $params['VPSProtocol'] = urlencode($payment_data['VPSProtocol']); 
    $params['TxType'] = urlencode('REFUND'); 
    $params['Vendor'] = urlencode($this->config->get('sagepay_direct_v3_vendor')); 
    $params['VendorTxCode'] = $this->request->get['order_id'] . 'T' . strftime("%Y%m%d%H%M%S") . mt_rand(1, 999);    
    $params['Amount'] = $this->currency->format($order_info['total'], $order_info['currency_code'], false, false); 
    $params['Currency'] = $this->currency->getCode(); 
    $params['Description'] = urlencode(substr($this->config->get('config_name'), 0, 100)); 
    $params['RelatedVPSTxId'] = urlencode($sagepay_direct_v3_order['VPSTxId']); 
    $params['RelatedVendorTxCode'] = urlencode($this->request->get['order_id'] . 'T' . strftime("%Y%m%d%H%M%S") . mt_rand(1, 999));   
    $params['RelatedSecurityKey'] = urlencode($sagepay_direct_v3_order['SecurityKey']); 
    $params['RelatedTxAuthNo'] = urlencode($sagepay_direct_v3_order['TxAuthNo']); 
    $response = $this->model_payment_sagepay_direct_v3->sendCurl($url, $params); 
var_dump($response); 

어떤 도움을 주 시겠어요?

답변

0

당신이 RelatedVPSTxId (및 다른 필드)를 urlencoding하고 있기 때문입니다.

Rik