Initial import: Carteasy Shop (Dev-Stand)

This commit is contained in:
Thomas Bartelt
2026-04-20 01:03:43 +02:00
commit d504f8a05d
3845 changed files with 761050 additions and 0 deletions
+124
View File
@@ -0,0 +1,124 @@
<?php
/*
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
* @package Carteasy
* @copyright Copyright (C) 2005 - 2011 Wlanium
* @license proprietary
* @author Thomas Bartelt
* Carteasy is a web shop system
*/
class ExpressCheckout extends NVP {
protected $order_toal;
protected $shoppingCart;
function __construct($return_url, $cancel_url, $order_toal, $shopppingCart = false) {
parent::__construct($return_url, $cancel_url);
$this->order_toal = round($order_toal, 2);
$this->shoppingCart = $shopppingCart;
} // end __construct
// TODO get rid of this function and give link as result in set_express_checkout on success
public function get_link() {
if (Config::get_value('paypal_dev_mode') == 1) {
return 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token='.$this->return_array['TOKEN']; // sandbox
} else {
return 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token='.$this->return_array['TOKEN']; // production
}
} // end get_link
public function get_token() {
return $this->return_array['TOKEN'];
} // end get_token
public function set_express_checkout() {
$this->postfields = ""
."PAYMENTREQUEST_0_PAYMENTACTION="."Sale"
."&PAYMENTREQUEST_0_AMT=".$this->order_toal
."&PAYMENTREQUEST_0_ITEMAMT=".$this->order_toal
// ."&L_PAYMENTREQUEST_0_NAME0=Ihre+Bestellung"
// ."&L_PAYMENTREQUEST_0_QTY0=1"
// ."&L_PAYMENTREQUEST_0_AMT0=".$this->order_toal
."&RETURNURL=".$this->return_url
."&CANCELURL=".$this->cancel_url
."&LOCALECODE=".'DE'
."&PAYMENTREQUEST_0_CURRENCYCODE=".$this->currency
."&NOSHIPPING="."1"
."&ALLOWNOTE="."0"
."&useraction=commit";
if (is_array($this->shoppingCart)) {
if (is_array($this->shoppingCart['items'])) {
$itemPos = 0;
$itemSum = 0;
foreach ($this->shoppingCart['items'] as $item) {
$itemPrice = round($item->price_sum_gross / $item->quantity, 2);
$itemSum += $itemPrice * $item->quantity;
$this->postfields .= "&L_PAYMENTREQUEST_0_NAME".$itemPos."=".urlencode($item->name);
$this->postfields .= "&L_PAYMENTREQUEST_0_QTY".$itemPos."=".$item->quantity;
$this->postfields .= "&L_PAYMENTREQUEST_0_AMT".$itemPos."=".$itemPrice;
++$itemPos;
}
if ($this->order_toal > $itemSum) {
$this->postfields .= "&L_PAYMENTREQUEST_0_NAME".$itemPos."=".urlencode('Versand und Gebühren');
$this->postfields .= "&L_PAYMENTREQUEST_0_QTY".$itemPos."=1";
$this->postfields .= "&L_PAYMENTREQUEST_0_AMT".$itemPos."=".round($this->order_toal - $itemSum, 2);
}
}
}
$return = $this->do_post_action('SetExpressCheckout', $this->postfields);
if ($return['ACK'] == 'Success') {
return true;
}
return false;
} // end set_express_checkout
public function get_express_checkout_details($token) {
$this->postfields = "TOKEN=".$token;
$return = $this->do_post_action('GetExpressCheckoutDetails', $this->postfields);
if ($return['ACK'] == 'Success') {
return true;
}
return false;
} // end get_express_checkout_details
public function do_express_checkout_payment($token, $payer_id) {
$this->postfields = "PAYMENTREQUEST_0_PAYMENTACTION=Sale"
."&PAYERID=".$payer_id
."&TOKEN=".$token
."&PAYMENTREQUEST_0_AMT=".$this->order_toal
."&PAYMENTREQUEST_0_CURRENCYCODE=".$this->currency;
$return = $this->do_post_action('DoExpressCheckoutPayment', $this->postfields);
if ($return['ACK'] == 'Success') {
return true;
}
return false;
} // end do_express_checkout_payment
} // end ExpressCheckout
/* EOF */
+125
View File
@@ -0,0 +1,125 @@
<?php
/*
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
* @package Carteasy
* @copyright Copyright (C) 2005 - 2011 Wlanium
* @license proprietary
* @author Thomas Bartelt
* Carteasy is a web shop system
*/
include_once './core/config.class.php';
class NVP {
protected $version;
protected $api_url;
protected $return_url;
protected $cancel_url;
protected $currency;
protected $return_array;
private $paypal_api_signature;
private $paypal_api_user;
private $paypal_api_password;
private $login;
public function __construct($return_url, $cancel_url) {
$this->version = '64.0';
$this->api_url = 'https://api-3t.paypal.com/nvp'; // production
$this->return_url = $return_url;
$this->cancel_url = $cancel_url;
$this->currency = 'EUR';
$this->paypal_api_signature = false;
if (Config::has_key('paypal_api_signature')) {
if (Config::is_set('paypal_api_signature')) {
$this->paypal_api_signature = Config::get_value('paypal_api_signature');
}
}
$this->paypal_api_user = false;
if (Config::has_key('paypal_api_user')) {
if (Config::is_set('paypal_api_user')) {
$this->paypal_api_user = Config::get_value('paypal_api_user');
}
}
$this->paypal_api_password = false;
if (Config::has_key('paypal_api_password')) {
if (Config::is_set('paypal_api_password')) {
$this->paypal_api_password = Config::get_value('paypal_api_password');
}
}
if (Config::get_value('paypal_dev_mode') == 1) {
$this->api_url = 'https://api-3t.sandbox.paypal.com/nvp'; // sandbox
$this->paypal_api_signature = 'AQU0e5vuZCvSg-XJploSa.sGUDlpAiVewZsIqHUPhDVRs0dqRGVEiYLk';
$this->paypal_api_user = 'seller_1278426179_biz_api1.ta-edv.de';
$this->paypal_api_password = '1278426184';
}
$this->login = "USER=".$this->paypal_api_user
."&PWD=".$this->paypal_api_password
."&SIGNATURE=".$this->paypal_api_signature
."&VERSION=".$this->version;
} // end __construct
protected function do_post_action($method, $postfields) {
$ch = curl_init($this->api_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/3.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "METHOD=".$method."&".$this->login."&".$postfields);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 40);
//echo "METHOD=".$method."&".$this->login."&".$postfields;
//exit();
$data = curl_exec($ch);
curl_close($ch);
$data = urldecode($data);
$data_array = explode('&', $data);
foreach ($data_array as $value) {
$temp = explode('=', $value);
$return_array[$temp[0]] = $temp[1];
}
$this->return_array = $return_array;
return $return_array;
} // end do_post_action
public function get_return_array() {
return $this->return_array;
} // end get_return_array
public function get_error() {
if ($this->return_array['ACK'] != 'Success') {
return array(
'ERRORCODE' => $this->return_array['L_ERRORCODE0'],
'SHORTMESSAGE' => $this->return_array['L_SHORTMESSAGE0'],
'LONGMESSAGE' => $this->return_array['L_LONGMESSAGE0'],
'RAWDATA' => $this->return_array,
'POSTFIELDS' => $this->postfields
);
}
return false;
} // end get_error
} // end NVP
/* EOF */
+5
View File
@@ -0,0 +1,5 @@
<?php
class RecurringPayment {
}
+71
View File
@@ -0,0 +1,71 @@
<?php
include_once './core/order.class.php';
include_once './core/paypalrefund.class.php';
include_once './core/paypal/nvp.class.php';
class Transaction {
private $nvp;
private $currency;
function __construct() {
$this->nvp = new NVP();
$this->currency = 'EUR';
}
public function get_transaction_details ($order_id) {
$order = new Order(Registry::get('base'));
$order->set_id($order_id);
$order_data = $order->get_data();
$postfields = "TRANSACTIONID=".$order_data->paypal_transaction_id;
$data = $this->nvp->do_post_action('GetTransactionDetails', $postfields);
if ($data['ACK'] == 'Success') {
$return_object = new stdClass();
$return_object->email = $data['EMAIL'];
$return_object->payer_status = $data['PAYERSTATUS'];
$return_object->paypal_fees = $data['FEEAMT'];
$return_object->payment_status = $data['PAYMENTSTATUS'];
$return_object->transaction_id = $order_data->paypal_transaction_id;
return $return_object;
}
return false;
}
public function refund_transaction ($paypal_refund_id) {
$paypal_refund = new PaypalRefund(Registry::get('base'));
$paypal_refund->set_id($paypal_refund_id);
$paypal_refund_data = $paypal_refund->get_data();
if ($paypal_refund_data->refund_type == 1) {
$postfields = "TRANSACTIONID=".$paypal_refund_data->paypal_transaction_id
."&REFUNDTYPE=Full"
."&CURRENCYCODE=".$this->currency;
} else {
$postfields = "TRANSACTIONID=".$paypal_refund_data->paypal_transaction_id
."&REFUNDTYPE=Partial"
."&AMT=".$paypal_refund_data->refund_amount
."&CURRENCYCODE=".$this->currency;
}
$data = $this->nvp->do_post_action('RefundTransaction', $postfields);
if ($data['ACK'] == 'Success') {
$return_object = new stdClass();
$return_object->refund_transaction_id = $data['REFUNDTRANSACTIONID'];
$return_object->fee_refund_amt = $data['FEEREFUNDAMT'];
$return_object->gross_refund_amt = $data['GROSSREFUNDAMT'];
$return_object->net_refund_amt = $data['NETREFUNDAMT'];
$return_object->refund_time = $data['TIMESTAMP'];
return $return_object;
}
return false;
}
}