2014-06-10 2 views
1

CI- 가맹점 및 3D 보안을 사용하여 카드 저장을 성공적으로 통합 한 사람이 있습니까?카드 세이브 3D로 체크 아웃

저는 이제 3D 웹 사이트가 내 웹 사이트에 응답하도록했습니다 (문제가있는 다른 사용자를 위해 매개 변수로 'return_url'을 매개 변수로 추가해야하는 것으로 보입니다).하지만 트랜잭션은 항상 인증이 성공한 실제 카드 또는 테스트 용 3D 보안 카드를 사용하지 못했습니다.

불행히도 CI-Merchant 웹 사이트의 Cardsave 드라이버에 대한 문서는 없으며 Paypal의 예만 있습니다.

실패한 트랜잭션이 내 Cardsave 계정의 어느 곳에 나타나지 않으므로 CI-Merchant가 그 시점에서 Cardsave와 통신하고 있는지 확실하지 않습니다.

public function test_live_payment() 
    { 
     $this->load->library('merchant'); 

     $creditcard = $this->input->post('creditcard'); 
     $creditcardtype = $this->input->post('creditcardtype'); 
     $cardmonth = $this->input->post('cardmonth'); 
     $cardyear = $this->input->post('cardyear'); 
     $cardsecurecode = $this->input->post('cardsecurecode'); 
     $cardnameon = $this->input->post('cardnameon'); 
     $address1 = $this->input->post('address1'); 
     $address2 = $this->input->post('address2'); 
     $city = $this->input->post('city'); 
     $postcode = $this->input->post('postcode'); 


     $data['status'] = ''; 
     $data['message'] = ''; 

     $test = TRUE; 

      if ($test) : 

        $settings = array (
        'merchant_id' => 'TEST ACCOUNT', 
        'password' => 'XXXX' 
       ); 



      else : 

       $settings = array (
        'merchant_id' => 'LIVE ACCOUNT', 
        'password' => 'XXXX' 
       ); 


      endif; 


     if ($_POST) : 

      $this->merchant->load('cardsave'); 


      $this->merchant->initialize($settings); 

      $data['transaction_id'] = '999' . rand(1, 999); 

      $params = array(
          'amount' => '1.00', 
          'currency' => 'GBP', 
          'card_no' => $creditcard, 
          'name' => $cardnameon, 
          'exp_month' => $cardmonth, 
          'exp_year' => 20 . $cardyear, 
          'csc' => $cardsecurecode, 
          'transaction_id' => $data['transaction_id'], 
          'description' => 'Test payment', 
          'address1' => $address1, 
          'address2' => $address2, 
          'city' => $city, 
          'postcode' => $postcode, 
          'return_url' => site_url('/test-payment') 
       ); 

       $response = $this->merchant->purchase($params); 


       if ($response->success()) : 
        $gateway_reference = $response->reference(); 

        $data['status'] = 'Success'; 
        $data['message'] = 'The transaction was successfully processed'; 

       else : 

        $message = $response->message(); 

        $data['status'] = 'Failed'; 

        if (! empty($message)) : 
         $data['message'] = $message; 
        else : 
         $data['message'] = 'Transaction failed. No further details received.'; 
        endif; 

       endif; 



     endif; 


     $this->load->view('test_payment_form', $data); 


    } 

답변

1

은, 1. 수익을 보내는 내가 반환 URL을 전달했다 확인하고,과 (2)에 의해 내 자신의 문제를 해결 한 같았다 : 여기

내가 테스트를 위해 사용하고있는 코드의 예 purchase_return() 함수가 포함 된 새 함수의 URL입니다. 내 완성 된 (테스트) 코드는 다음과 같습니다.

public function test_live_payment() 
    { 
     $this->load->library('merchant'); 

     $creditcard = $this->input->post('creditcard'); 
     $creditcardtype = $this->input->post('creditcardtype'); 
     $cardmonth = $this->input->post('cardmonth'); 
     $cardyear = $this->input->post('cardyear'); 
     $cardsecurecode = $this->input->post('cardsecurecode'); 
     $cardnameon = $this->input->post('cardnameon'); 
     $address1 = $this->input->post('address1'); 
     $address2 = $this->input->post('address2'); 
     $city = $this->input->post('city'); 
     $postcode = $this->input->post('postcode'); 


     $data['status'] = ''; 
     $data['message'] = ''; 

     $test = TRUE; 

      if ($test) : 

        $settings = array (
        'merchant_id' => 'TEST ACCOUNT', 
        'password' => 'XXXX' 
       ); 



      else : 

       $settings = array (
        'merchant_id' => 'LIVE ACCOUNT', 
        'password' => 'XXXX' 
       ); 


      endif; 


     if ($_POST) : 

      $this->merchant->load('cardsave'); 


      $this->merchant->initialize($settings); 

      $data['transaction_id'] = '999' . rand(1, 999); 

      $data['transaction_id'] = '999' . rand(1, 999); 

      $newdata = array(
        'transaction_id' => $data['transaction_id'] 
        ); 

      $this->session->set_userdata($newdata); 

      $params = array(
          'amount' => '1.00', 
          'currency' => 'GBP', 
          'card_no' => $creditcard, 
          'name' => $cardnameon, 
          'exp_month' => $cardmonth, 
          'exp_year' => 20 . $cardyear, 
          'csc' => $cardsecurecode, 
          'transaction_id' => $data['transaction_id'], 
          'description' => 'Test payment', 
          'address1' => $address1, 
          'address2' => $address2, 
          'city' => $city, 
          'postcode' => $postcode, 
          'return_url' => site_url('/test-payment-response') 
       ); 

       $response = $this->merchant->purchase($params); 


       if ($response->success()) : 
        $gateway_reference = $response->reference(); 

        $data['status'] = 'Success'; 
        $data['message'] = 'The transaction was successfully processed'; 

       else : 

        $message = $response->message(); 

        $data['status'] = 'Failed'; 

        if (! empty($message)) : 
         $data['message'] = $message; 
        else : 
         $data['message'] = 'Transaction failed. No further details received.'; 
        endif; 

       endif; 



     endif; 


     $this->load->view('test_payment_form', $data); 


    } 



    public function test_response() 
    { 
     $settings = array (
        'merchant_id' => 'TEST ACCOUNT', 
        'password' => 'XXXX' 
       ); 


     $this->load->library('merchant'); 
     $this->merchant->load('cardsave'); 
     $this->merchant->initialize($settings); 

     $data['transaction_id'] = $this->session->userdata('transaction_id'); 


     $params = array(
          'amount' => '1.00', 
          'currency' => 'GBP', 
          'transaction_id' => $data['transaction_id'] 

       ); 

     $response = $this->merchant->purchase_return($params); 

     if ($response->success()) : 
        $gateway_reference = $response->reference(); 

        $data['status'] = 'Success'; 
        $data['message'] = 'The transaction was successfully processed'; 

       else : 

        $message = $response->message(); 

        $data['status'] = 'Failed'; 

        if (! empty($message)) : 
         $data['message'] = $message; 
        else : 
         $data['message'] = 'Transaction failed. No further details received.'; 
        endif; 

       endif; 


     $this->load->view('test_payment_form', $data); 



    } 
관련 문제