Sage Pay测试错误

发布于 2024-10-17 13:35:06 字数 5851 浏览 0 评论 0原文

我正在尝试测试我的 Sage Pay 集成,但无济于事。

这是我的代码:

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”时,我收到错误:

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

当使用“TTEST”时,我收到错误:

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

我似乎根本无法弄清楚这一点。如果有人有任何想法,我们将不胜感激。

编辑:$stuff 回显:

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]

im trying to test my sage pay integration but to no avail.

Here is my code:

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();
}

when using "TEST" im getting an error:

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

when using "TTEST" im getting an error:

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

I cannot seem to figure this out at all. If anyone has any ideas it would be greatfuly appreciated.

EDIT: $stuff echos out:

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]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏花。依旧 2024-10-24 13:35:06

您是否尝试通过直接或表单集成方法进行交易?
看来您混淆了购买网址...
更新您的购买网址:

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

并确保它们是他们应该的。

Are you trying to make a transaction through Direct or Form-integration method?
Looks like you have made a mix-up with the Purchse Urls...
update your purchase Urls from :

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

and make sure they are what they should be.

み零 2024-10-24 13:35:06

您需要确保您发布到有效的 Sage Pay 帐户并确保供应商名称正确以阻止 5005 错误。

VendorTxCode 字段限制为 40 个字符。如果您没有正确构建字符串,则可能会错误地将 VendorTxCode & 符号后面的所有内容发布到您的字段中。

You need to ensure you are posting to a valid Sage Pay account and ensure that the vendorname is correct to stop the 5005 error.

The VendorTxCode field is limited to 40 characters. If you are not building your string correctly you may be posting everything after the VendorTxCode ampersand into your field in error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文