Veyton – Payment Paypal – This payment method is currently not avaiable, please contact our customer support or choose other payment method

Bei einem Multisprachigfähgien Shop wird der Fehler “This payment method is currently not avaiable, please contact our customer support or choose other payment method” unter dem Englischen Shop gemeldet.

Alle Einrichtung unter Backend geprüft. Nichts ungewöhnliches gefunden. Durch Debug kann das festgestellt werden, dass die Url für Paypal unter dem englischen Shop nicht richtig übermittelt werden.

Funktionsaufruf

$this->paypalAuthCall(‘checkout’);

in der Datei plugins/xt_paypal/classes/class.xt_paypal.php liefert keinen gültigen URL , sondern immer mit ERROR_PAYMENT zurück.

Inspektion der $_SESSION findet man den Teil $_SESSION[‘nvpReqArray’] nicht, wobei diese unter anderen Shops immer zu sehen ist. Unter dieser Variable werden die Daten zum Payment gespeichert.

Da ich nicht weiss, welche spezielle Änderungen für den Shop bzw. für den englischen Shop durchgeführt wurden, baue ich hier einfach bei Fehlern einen eigenen Aufruf ein.

$this->paypalAuthCall(‘checkout’);

//Begin meiner Codes, Bestellungsdaten für Paypal vorbereiten aus $_SESSION  .

if (strstr($this->payPalURL, ‘ERROR_PAYMENT’) ) {

$_nvp_data[‘LocaleCode’] = $_SESSION[‘customer’]->customer_default_address[‘customers_country_code’];

$p_item = 0;
foreach ($_SESSION[‘cart’]->show_content as $basket_item) {
$_nvp_data[‘L_NAME’.$p_item] = $basket_item[‘products_name’];
$_nvp_data[‘L_NUMBER’.$p_item] = $basket_item[‘products_model’];
$_nvp_data[‘L_QTY’.$p_item] = round(floatval($basket_item[‘products_quantity’]), 2);
$_nvp_data[‘L_TAXAMT’.$p_item] = round($basket_item[‘products_tax’][‘plain’], 2);
$_nvp_data[‘L_AMT’.$p_item] = round($basket_item[‘products_price’][‘plain_otax’], 2);

$_nvp_data[‘ITEMAMT’] +=  $_nvp_data[‘L_AMT’.$p_item] * $_nvp_data[‘L_QTY’.$p_item];
$_nvp_data[‘TAXAMT’] +=  $_nvp_data[‘L_TAXAMT’.$p_item] * $_nvp_data[‘L_QTY’.$p_item];

$p_item ++;
}

$_nvp_data[‘L_NAME’.$p_item] = $_SESSION[‘cart’]->show_sub_content[‘shipping’][‘products_name’];
$_nvp_data[‘L_NUMBER’.$p_item] = $_SESSION[‘cart’]->show_sub_content[‘shipping’][‘products_model’];
$_nvp_data[‘L_QTY’.$p_item] = round(floatval($_SESSION[‘cart’]->show_sub_content[‘shipping’][‘products_quantity’]), 2);
$_nvp_data[‘L_TAXAMT’.$p_item] = round($_SESSION[‘cart’]->show_sub_content[‘shipping’][‘products_tax’][‘plain’], 2);
$_nvp_data[‘L_AMT’.$p_item] = round($_SESSION[‘cart’]->show_sub_content[‘shipping’][‘products_price’][‘plain_otax’], 2);

$_nvp_data[‘ITEMAMT’] +=  $_nvp_data[‘L_AMT’.$p_item] * $_nvp_data[‘L_QTY’.$p_item];
$_nvp_data[‘TAXAMT’] +=  $_nvp_data[‘L_TAXAMT’.$p_item] * $_nvp_data[‘L_QTY’.$p_item];

$_nvp_data[‘ITEMAMT’] =  round($_nvp_data[‘ITEMAMT’], 2);
$_nvp_data[‘TAXAMT’] =  round($_nvp_data[‘TAXAMT’], 2);

$_nvp_data[‘Amt’] = $_nvp_data[‘ITEMAMT’] + $_nvp_data[‘TAXAMT’];

//echo ‘<pre>';
//print_r($_nvp_data);
//echo ‘</pre>';

$this->payPalURL = $this->PPHttpPost($_nvp_data);
}

// End meiner Codes

$url = $this->payPalURL.’&useraction=commit';

 

//used by PPHttpPost, to get needed values
protected function getNVP ($action, $key = null)
{
if ($key == null) {
return($this->default[$action]);
} else {
if (array_key_exists($key, $this->default[$action])) {
return($this->default[$action][$key]);
} else {
throw new Exception(“Value “.$key.” cannot be found.”);
}
}
}

protected function PPHttpPost($_nvp_data = array(), $methodName_ = “SetExpressCheckout”)
{
$nvp_data = $_nvp_data;

$API_UserName = urlencode($this->API_UserName);
$API_Password = urlencode($this->API_Password);
$API_Signature = urlencode($this->API_Signature);
$API_Endpoint = $this->API_Endpoint;

$nvp_data[“RETURNURL”] = $this->RETURN_URL;
$nvp_data[“CANCELURL”] = $this->CANCEL_URL;
$nvp_data[“NOTIFYURL”] = $this->NOTIFY_URL;
$nvp_data[“PAYMENTACTION”] = $this->PaymentType;
$nvp_data[“CURRENCYCODE”] = ‘EUR';
$version = urlencode($this->version);

$nvpStr = ”;

foreach ($nvp_data as $key=>$value) {
$nvpStr .= ‘&’.$key.’=’.urlencode($value);
}

// setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);

// turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);

// NVPRequest for submitting to server
$nvpreq = “METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr”;
// setting the nvpreq as POST FIELD to curl
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

// getting response from server
$httpResponse = curl_exec($ch);

if(!$httpResponse) {
exit(“$methodName_ failed: “.curl_error($ch).'(‘.curl_errno($ch).’)’);
}

// Extract the RefundTransaction response details
$httpResponseAr = explode(“&”, $httpResponse);

$httpParsedResponseAr = array();
foreach ($httpResponseAr as $i => $value) {
$tmpAr = explode(“=”, $value);
if(sizeof($tmpAr) > 1) {
$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
}
}

if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists(‘ACK’, $httpParsedResponseAr)) {
exit(“Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.”);
}

if(“Success” == $httpParsedResponseAr[“ACK”]) {
$token = $httpParsedResponseAr[‘TOKEN’];
$nvpStr = ”;
foreach ($nvp_data as $key=>$value) {
$nvpStr .= ‘&’.$key.’=’.urlencode($value);
}

//return “https://www.paypal.com/webscr?cmd=_express-checkout&token=$token$nvpStr”;
return $this->EXPRESS_URL.$token;
} else  {
return $nvp_data[“CANCELURL”];
}
}

//Wichtiger Hinweis: Teil der Codes sind aus Internet übernommen und modifiziert.

class.xt_paypal.php

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *


× 2 = fourteen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>