2011-02-17 2 views
0

메신저 내 샐비어 지불 통합을 테스트하려고했지만 아무 소용이 없습니다. 여기 세이 지 지불 테스트 오류

내 코드입니다 :

private function init_sagepay(){ 
    extract(static::$post); 
    $settings = global_data::get_settings(); 
    $strConnectTo = "TEST"; 
    $strVirtualDir = "VSPForm-Kit"; 
    $strYourSiteFQDN = global_data::get_web_root(); 
    $strVSPVendorName = $settings->sagepay_vendor; 
    $strEncryptionPassword = "z5phUfjdEB5ZX2ZY"; 
    $strCurrency = static::$currency; 
    $strVendorEMail = $settings->sagepay_email; 
    $strTransactionType = "PAYMENT"; 

    $strProtocol = "2.23"; 
    if ($strConnectTo == "LIVE") 
     $strPurchaseURL = "https://live.sagepay.com/gateway/service/vspform-register.vsp"; 
    elseif ($strConnectTo == "TEST") 
     $strPurchaseURL = "https://test.sagepay.com/gateway/service/vspform-register.vsp"; 
    elseif($strConnectTo == 'TTEST') 
     $strPurchaseURL = 'https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorRegisterTx'; 
    else 
     $strPurchaseURL = "https://test.sagepay.com/Simulator/VSPDirectGateway.asp"; 

    $details = self::get_member_details(); 
    $thisOrderDeteails = 'order details...'; 
    $ThisVendorTxCode = 'fdsdgfd'; 
    $ThisAmount = $total; 
    $ThisCurrency = static::$currency; 
    $ThisDescription = "description..."; 
    $ThisCustomerEmail = $details->email; 
    $ThisCustomerName = $details->first_name . " " . $details->last_name; 
    $ThisVendorEmail = $strVendorEMail; 
    $ThisApplyAVSCV2 = 1; 
    $ThisApply3DSecure = 1; 
    $ThisDeliveryAddress = $address_line_1 . ", " . $address_line_2 . ", " . $address_line_3 . ", " . $address_line_4 . ", " . $country; 
    $ThisDeliveryPostCode = $postcode; 
    $address_full = $ThisDeliveryAddress . ' ' . $ThisDeliveryPostCode; 

    $ThisBillingAddress = $details->address_line_1 . ", " . $details->address_line_2 . ", " . $details->address_line_3 . ", " . $details->address_line_4 . ", " . $details->country; 
    $ThisBillingPostCode = $details->postcode; 

    $ThisContactNumber = $details->home_number; 
    $ThisContactFax = $details->fax_number; 
    $ThisAllowGiftAid = ''; 

    $ThisShoppingBasket = 'Basket=' . count($items) . ':'; 
    foreach($items as $item) { 
     preg_match("#^\[([^\]]+)\]\[([^\]]+)\]\[([^\]]+)\]$#is", $item, $match); 
     $ThisShoppingBasket .= $match[2] . ':' . $match[1] . ':' . static::$cp . ($match[3]/$match[1]) . static::$cp . ':0.00:' . static::$cp . $match[3] . ':'; 
    } 
    $ThisShoppingBasket .= 'Delivery:1:£4.99'; 

    $stuff = "VendorTxCode=" . $ThisVendorTxCode . "&"; 
    $stuff .= "Amount=" . $ThisAmount . "&"; 
    $stuff .= "Currency=" . $ThisCurrency . "&"; 
    $stuff .= "Description=" . $ThisDescription . "&"; 
    $stuff .= "SuccessURL=" . $strYourSiteFQDN . "&"; 
    $stuff .= "FailureURL=" . $strYourSiteFQDN . "&"; 

    $varArray = array('CustomerEmail','VendorEmail','CustomerName','DeliveryAddress','DeliveryPostCode','BillingAddress','BillingPostCode','ContactNumber','ContactFax','AllowGiftAid','ApplyAVSCV2','Apply3DSecure'); 
    foreach($varArray as $var) { 
     if(${'This' . $var}) { 
      $stuff .= $var . '=' . ${'This' . $var} . '&'; 
     } 
    } 
    if($ThisShoppingBasket) { 
     $stuff .= $ThisShoppingBasket; 
    } 
    $stuff .= "EMailMessage=For an update on the status of your order please email us at $ThisVendorEmail"; 
    echo $stuff; 
    $crypt = self::base64Encode(self::SimpleXor($stuff,$strEncryptionPassword));  
    ob_start(); 
    ?> 
    <form action="<?php echo $strPurchaseURL; ?>" method="post" id="sageForm" name="form1"> 
     <input TYPE="hidden" name="VPSProtocol" value="<?php echo $strProtocol; ?>"> 
     <input TYPE="hidden" name="TxType" value="<?php echo $strTransactionType; ?>"> 
     <input TYPE="hidden" name="Vendor" value="<?php echo $strVSPVendorName; ?>"> 
     <input TYPE="hidden" name="Crypt" value="<?php echo $crypt; ?>">  
     <input name="sbbutton" type="submit" value="Checkout" class="wpcf7-submit">     
    </form>  
    <?php 
    return ob_get_clean(); 
} 

오류 받고 "TEST"메신저를 사용 :

VPSProtocol=2.23 
Status=INVALID 
StatusDetail=The VendorTxCode you supplied is an invalid length. VendorTxCodes should be between 1 to 40 characters long 

: 오류를 받고 "TTEST"메신저를 사용하는 경우

Status Detail: 5005 : The Vendor configuration is missing or invalid 

을 나는 이것을 알아낼 수 없다. 누구든지 아이디어가 있다면 그것은 greatfuly 감사하겠습니다.

편집 : $ 물건은 밖으로 메아리 :

VendorTxCode=fdsdgfd&Amount=45.60&Currency=GBP&Description=description...&SuccessURL=http://localhost/ecom_framework/&FailureURL=http://localhost/ecom_framework/&[email protected]&[email protected]&CustomerName=Luke Snowden&DeliveryAddress=mansfield, nottinghamshire, mansfield, nottinghamshire, United Kingdom&DeliveryPostCode=ng19 8pw&BillingAddress=mansfield, nottinghamshire, mansfield, nottinghamshire, United Kingdom&BillingPostCode=ng19 8pw&ContactNumber=0165656567&ApplyAVSCV2=1&Apply3DSecure=1&Basket=3:Blue Hat - black :2:£2£:0.00:£4.00:Blue Hat - brown :3:£3£:0.00:£9.00:Blue Hat - grey :4:£4£:0.00:£16.00:Delivery:1:£4.99EMailMessage=For an update on the status of your order please email us at [email protected] 
+0

배열, 왜 사용하지 않습니까? 이 코드는이 길이의 절반보다 작을 수 있습니다. – meagar

+1

위의 코드가 작동하지 않는 이유를 파악한 후에 작업하겠습니다. –

+1

전화 번호 및 암호화 암호와 같은 중요한 데이터를 제거하는 것이 좋습니다 ... – richsage

답변

1

당신은 직접 또는 양식 통합 방법을 통해 거래를 만들려고 노력하고 있습니까?

http://www.sagepay.com/developers/

과 그들이해야 무엇을 확인하십시오 당신이에서 a를 Purchse URL을 믹스 업 ... 갱신 구매 URL을 만든 것처럼 보인다.

0

5005 오류를 방지하려면 유효한 Sage Pay 계정에 게시하고 공급자 이름이 올바른지 확인해야합니다.

VendorTxCode 필드는 40 자로 제한됩니다. 문자열을 올바르게 작성하지 않으면 VendorTxCode 앰퍼샌드 뒤에있는 모든 항목을 실수로 필드에 게시 할 수 있습니다.