Php sage薪酬测试错误
我试图测试我的sage薪酬整合,但没有用 这是我的密码:Php sage薪酬测试错误,php,opayo,Php,Opayo,我试图测试我的sage薪酬整合,但没有用 这是我的密码: private function init_sagepay(){ extract( static::$post ); $settings = global_data::get_settings(); $strConnectTo = "TEST"; $strVirtualDir = "VSPForm-Kit"; $strYourSiteFQDN = global_data::get_web_root(
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();
}
使用“测试”时,我收到一个错误:
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/&CustomerEmail=luke@actwebdesigns.co.uk&VendorEmail=luke@actwebdesigns.co.uk&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 luke@fgfdgf.co.uk
您是否试图通过直接或表单集成方法进行交易? 看起来你和Purches URL搞混了。。。 从以下位置更新您的购买URL:
并确保它们是它们应该是的。您需要确保您正在向有效的Sage Pay帐户发布,并确保vendorname是正确的,以停止5005错误
VendorTxCode字段限制为40个字符。如果您没有正确构建字符串,那么您可能会错误地将VendorTxCode和之后的所有内容发布到您的字段中 数组,为什么不使用它们?此代码的长度可能不到此长度的一半。我将在弄清楚上述内容不起作用的原因后处理此代码。删除敏感数据(如您的电话号码和加密密码)可能是一个好主意……而且您肯定提供了正确的供应商名称,我想。。。
VendorTxCode=fdsdgfd&Amount=45.60&Currency=GBP&Description=description...&SuccessURL=http://localhost/ecom_framework/&FailureURL=http://localhost/ecom_framework/&CustomerEmail=luke@actwebdesigns.co.uk&VendorEmail=luke@actwebdesigns.co.uk&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 luke@fgfdgf.co.uk