20-02-2026
This commit is contained in:
parent
a8b395e20d
commit
a00c42e770
252 changed files with 28785 additions and 8907 deletions
|
|
@ -21,7 +21,6 @@ fnc Financing
|
|||
'pref' => 'Vorauskasse',
|
||||
];*/
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Pay;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
|
@ -31,36 +30,39 @@ use App\Services\MyLog;
|
|||
use App\Services\Payone;
|
||||
use Util;
|
||||
|
||||
|
||||
class PayoneController extends Controller
|
||||
{
|
||||
|
||||
const PREAUTHORIZATION = 'preauthorization';
|
||||
|
||||
const AUTHORIZATION = 'authorization';
|
||||
|
||||
const CAPTURE = 'capture';
|
||||
|
||||
const REFUND = 'refund';
|
||||
|
||||
const DEBIT = 'debit';
|
||||
|
||||
private $default = [];
|
||||
|
||||
private $personalData = [];
|
||||
|
||||
private $aboInitPayment = [];
|
||||
|
||||
private $method = [];
|
||||
|
||||
private $prepayment = [];
|
||||
|
||||
/* private $onlineTransfer = [];
|
||||
private $creditCard = []; */
|
||||
private $deliveryData = [];
|
||||
|
||||
|
||||
|
||||
|
||||
// private $payment_method;
|
||||
private $urls = [];
|
||||
|
||||
private $shopping_user;
|
||||
|
||||
private $shopping_order;
|
||||
|
||||
private $shopping_payment;
|
||||
|
||||
private $reference;
|
||||
|
|
@ -82,40 +84,40 @@ class PayoneController extends Controller
|
|||
{
|
||||
return $this->shopping_payment;
|
||||
}
|
||||
|
||||
public function setAboPayment($user_abo, $amount, $currency)
|
||||
{
|
||||
$this->reference = substr(uniqid('m', false), 0, 16);
|
||||
|
||||
$amount = intval($amount);
|
||||
$this->method = [
|
||||
"clearingtype" => $user_abo->clearingtype,
|
||||
"wallettype" => $user_abo->wallettype,
|
||||
"pseudocardpan" => isset($user_abo->carddata['pseudocardpan']) ? $user_abo->carddata['pseudocardpan'] : '',
|
||||
"cardexpiredate" => isset($user_abo->carddata['cardexpiredate']) ? $user_abo->carddata['cardexpiredate'] : '',
|
||||
'clearingtype' => $user_abo->clearingtype,
|
||||
'wallettype' => $user_abo->wallettype,
|
||||
'pseudocardpan' => isset($user_abo->carddata['pseudocardpan']) ? $user_abo->carddata['pseudocardpan'] : '',
|
||||
'cardexpiredate' => isset($user_abo->carddata['cardexpiredate']) ? $user_abo->carddata['cardexpiredate'] : '',
|
||||
'userid' => $user_abo->payone_userid,
|
||||
'onlinebanktransfertype' => '',
|
||||
"request" => "authorization",
|
||||
'request' => 'authorization',
|
||||
];
|
||||
|
||||
|
||||
$this->aboInitPayment = [
|
||||
'recurrence' => 'recurring',
|
||||
'customer_is_present' => 'no',
|
||||
'request' => 'authorization',
|
||||
'amount' => $amount
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
$this->prepayment = [
|
||||
"reference" => $this->reference, // a unique reference, e.g. order number
|
||||
"amount" => $amount, // amount in smallest currency unit, i.e. cents
|
||||
"currency" => $currency,
|
||||
"param" => $this->shopping_order->id,
|
||||
'reference' => $this->reference, // a unique reference, e.g. order number
|
||||
'amount' => $amount, // amount in smallest currency unit, i.e. cents
|
||||
'currency' => $currency,
|
||||
'param' => $this->shopping_order->id,
|
||||
];
|
||||
|
||||
$this->shopping_payment = ShoppingPayment::create([
|
||||
'shopping_order_id' => $this->shopping_order->id,
|
||||
'clearingtype' => $this->method["clearingtype"],
|
||||
'wallettype' => $this->method["wallettype"],
|
||||
'onlinebanktransfertype' => $this->method["onlinebanktransfertype"],
|
||||
'clearingtype' => $this->method['clearingtype'],
|
||||
'wallettype' => $this->method['wallettype'],
|
||||
'onlinebanktransfertype' => $this->method['onlinebanktransfertype'],
|
||||
'carddata' => $user_abo->carddata,
|
||||
'reference' => $this->reference,
|
||||
'amount' => $amount,
|
||||
|
|
@ -125,9 +127,11 @@ class PayoneController extends Controller
|
|||
'mode' => $this->shopping_order->mode,
|
||||
]);
|
||||
}
|
||||
//make Payone payment
|
||||
|
||||
// make Payone payment
|
||||
public function setPrePayment($payment_method, $amount, $currency, $ret = [])
|
||||
{
|
||||
$amount = intval($amount);
|
||||
|
||||
$this->reference = substr(uniqid('m', false), 0, 16);
|
||||
$this->setMethod($payment_method, $ret);
|
||||
|
|
@ -139,30 +143,30 @@ class PayoneController extends Controller
|
|||
];
|
||||
|
||||
$this->prepayment = [
|
||||
"reference" => $this->reference, // a unique reference, e.g. order number
|
||||
"amount" => $amount, // amount in smallest currency unit, i.e. cents
|
||||
"currency" => $currency,
|
||||
"param" => $this->shopping_order->id,
|
||||
'reference' => $this->reference, // a unique reference, e.g. order number
|
||||
'amount' => $amount, // amount in smallest currency unit, i.e. cents
|
||||
'currency' => $currency,
|
||||
'param' => $this->shopping_order->id,
|
||||
];
|
||||
//init Abo
|
||||
// init Abo
|
||||
if ($this->shopping_order->is_abo) {
|
||||
if ($this->method["clearingtype"] === "cc") {
|
||||
if ($this->method['clearingtype'] === 'cc') {
|
||||
$this->aboInitPayment = [
|
||||
'recurrence' => 'recurring',
|
||||
'customer_is_present' => 'yes',
|
||||
'request' => 'authorization',
|
||||
'amount' => $amount,
|
||||
'amount' => $amount,
|
||||
];
|
||||
$this->method['request'] = 'authorization';
|
||||
}
|
||||
|
||||
if ($this->method["clearingtype"] === "wlt") {
|
||||
//payment for Abo PayPal
|
||||
if ($this->method['clearingtype'] === 'wlt') {
|
||||
// payment for Abo PayPal
|
||||
$this->aboInitPayment = [
|
||||
'recurrence' => 'recurring',
|
||||
'customer_is_present' => 'yes',
|
||||
'request' => 'authorization',
|
||||
'amount' => $amount,
|
||||
'amount' => $amount,
|
||||
'add_paydata[redirection_mode]' => 'DIRECT_TO_MERCHANT',
|
||||
];
|
||||
$this->setDeliverylData($this->shopping_user);
|
||||
|
|
@ -172,9 +176,9 @@ class PayoneController extends Controller
|
|||
|
||||
$this->shopping_payment = ShoppingPayment::create([
|
||||
'shopping_order_id' => $this->shopping_order->id,
|
||||
'clearingtype' => $this->method["clearingtype"],
|
||||
'wallettype' => $this->method["wallettype"],
|
||||
'onlinebanktransfertype' => $this->method["onlinebanktransfertype"],
|
||||
'clearingtype' => $this->method['clearingtype'],
|
||||
'wallettype' => $this->method['wallettype'],
|
||||
'onlinebanktransfertype' => $this->method['onlinebanktransfertype'],
|
||||
'carddata' => isset($ret['cc']) ? $ret['cc'] : null,
|
||||
'reference' => $this->reference,
|
||||
'amount' => $amount,
|
||||
|
|
@ -186,21 +190,22 @@ class PayoneController extends Controller
|
|||
]);
|
||||
|
||||
$this->default['mode'] = $this->shopping_order->mode;
|
||||
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
public function setPersonalData()
|
||||
{
|
||||
$this->personalData = [
|
||||
"firstname" => $this->shopping_user->billing_firstname,
|
||||
"lastname" => $this->shopping_user->billing_lastname, // mandatory
|
||||
"street" => $this->shopping_user->billing_address,
|
||||
"zip" => $this->shopping_user->billing_zipcode,
|
||||
"city" => $this->shopping_user->billing_city,
|
||||
"country" => ($this->shopping_user->billing_country) ? $this->shopping_user->billing_country->code : "DE", // mandatory
|
||||
"email" => $this->shopping_user->billing_email,
|
||||
'firstname' => $this->shopping_user->billing_firstname,
|
||||
'lastname' => $this->shopping_user->billing_lastname, // mandatory
|
||||
'street' => $this->shopping_user->billing_address,
|
||||
'zip' => $this->shopping_user->billing_zipcode,
|
||||
'city' => $this->shopping_user->billing_city,
|
||||
'country' => ($this->shopping_user->billing_country) ? $this->shopping_user->billing_country->code : 'DE', // mandatory
|
||||
'email' => $this->shopping_user->billing_email,
|
||||
// "language" => ($this->shopping_user->billing_country) ? strtoupper($this->shopping_user->billing_country->code) : "DE", // mandatory
|
||||
"language" => "DE",
|
||||
'language' => 'DE',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -222,38 +227,38 @@ class PayoneController extends Controller
|
|||
if ($payment_method) {
|
||||
if (strpos($payment_method, '#')) {
|
||||
$payment_method = explode('#', $payment_method);
|
||||
//wallet Paypal
|
||||
// wallet Paypal
|
||||
if ($payment_method[0] === 'wlt') {
|
||||
$this->method = [
|
||||
"clearingtype" => "wlt",
|
||||
"wallettype" => $payment_method[1],
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "authorization"
|
||||
'clearingtype' => 'wlt',
|
||||
'wallettype' => $payment_method[1],
|
||||
'onlinebanktransfertype' => '',
|
||||
'request' => 'authorization',
|
||||
];
|
||||
}
|
||||
//Online-Überweisung
|
||||
// Online-Überweisung
|
||||
if ($payment_method[0] === 'sb') {
|
||||
$this->method = [
|
||||
"clearingtype" => "sb",
|
||||
"wallettype" => "",
|
||||
"onlinebanktransfertype" => $payment_method[1], // this is the type for Sofort.com
|
||||
"bankcountry" => "DE", // we need to know the country of the customer's bank, i.e. of the invoice address
|
||||
"request" => "authorization",
|
||||
'clearingtype' => 'sb',
|
||||
'wallettype' => '',
|
||||
'onlinebanktransfertype' => $payment_method[1], // this is the type for Sofort.com
|
||||
'bankcountry' => 'DE', // we need to know the country of the customer's bank, i.e. of the invoice address
|
||||
'request' => 'authorization',
|
||||
];
|
||||
}
|
||||
|
||||
//Rechnungskauf
|
||||
// Rechnungskauf
|
||||
if ($payment_method[0] === 'fnc') {
|
||||
//MIVITA
|
||||
// MIVITA
|
||||
if (isset($payment_method[1]) && $payment_method[1] === 'MIV') {
|
||||
$this->method = [
|
||||
"clearingtype" => "fnc",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "MIV",
|
||||
"request" => "authorization",
|
||||
'clearingtype' => 'fnc',
|
||||
'wallettype' => '',
|
||||
'onlinebanktransfertype' => 'MIV',
|
||||
'request' => 'authorization',
|
||||
];
|
||||
}
|
||||
//PAYONE
|
||||
// PAYONE
|
||||
/* $this->method = [
|
||||
"clearingtype" => "fnc",
|
||||
"wallettype" => "",
|
||||
|
|
@ -265,41 +270,41 @@ class PayoneController extends Controller
|
|||
];*/
|
||||
}
|
||||
}
|
||||
//vorkasse
|
||||
// vorkasse
|
||||
if ($payment_method === 'elv') {
|
||||
$this->method = [
|
||||
"clearingtype" => "elv",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "authorization",
|
||||
"mandate_identification" => $ret['elv']['mandate_identification'],
|
||||
"iban" => $ret['elv']['iban'],
|
||||
"bic" => $ret['elv']['bic'],
|
||||
"bankaccountholder" => $ret['elv']['bankaccountholder'],
|
||||
'clearingtype' => 'elv',
|
||||
'wallettype' => '',
|
||||
'onlinebanktransfertype' => '',
|
||||
'request' => 'authorization',
|
||||
'mandate_identification' => $ret['elv']['mandate_identification'],
|
||||
'iban' => $ret['elv']['iban'],
|
||||
'bic' => $ret['elv']['bic'],
|
||||
'bankaccountholder' => $ret['elv']['bankaccountholder'],
|
||||
// "bankcountry" => "DE",
|
||||
];
|
||||
}
|
||||
|
||||
//vorkasse
|
||||
// vorkasse
|
||||
if ($payment_method === 'vor') {
|
||||
$this->method = [
|
||||
"clearingtype" => "vor",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "authorization",
|
||||
'clearingtype' => 'vor',
|
||||
'wallettype' => '',
|
||||
'onlinebanktransfertype' => '',
|
||||
'request' => 'authorization',
|
||||
];
|
||||
}
|
||||
|
||||
//CreditCard
|
||||
// CreditCard
|
||||
if ($payment_method === 'cc') {
|
||||
//need the $cc_ret
|
||||
// need the $cc_ret
|
||||
$this->method = [
|
||||
"clearingtype" => "cc",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "authorization",
|
||||
"pseudocardpan" => $ret['cc']['pseudocardpan'],
|
||||
//"xid" => "3-D Secure transaction ID"
|
||||
'clearingtype' => 'cc',
|
||||
'wallettype' => '',
|
||||
'onlinebanktransfertype' => '',
|
||||
'request' => 'authorization',
|
||||
'pseudocardpan' => $ret['cc']['pseudocardpan'],
|
||||
// "xid" => "3-D Secure transaction ID"
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -309,6 +314,7 @@ class PayoneController extends Controller
|
|||
{
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->aboInitPayment, $this->urls);
|
||||
$response = Payone::sendRequest($request);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
|
@ -316,11 +322,10 @@ class PayoneController extends Controller
|
|||
{
|
||||
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->aboInitPayment, $this->urls);
|
||||
//RECHNUNG MIV
|
||||
if ($this->shopping_payment->clearingtype === 'fnc' && $this->shopping_payment->onlinebanktransfertype === 'MIV') {
|
||||
$payt = PaymentTransaction::create([
|
||||
'shopping_payment_id' => $this->shopping_payment->id,
|
||||
'request' => $this->method['request'],
|
||||
'request' => $this->method['request'],
|
||||
'txid' => 0,
|
||||
'userid' => 0,
|
||||
'status' => 'FNCMIV',
|
||||
|
|
@ -332,6 +337,7 @@ class PayoneController extends Controller
|
|||
if ($is_abo) {
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
}
|
||||
|
|
@ -343,7 +349,7 @@ class PayoneController extends Controller
|
|||
MyLog::writeLog(
|
||||
'payone',
|
||||
'error',
|
||||
'PayPal Preauthorization Fehler: ' . $response['errormessage'],
|
||||
'PayPal Preauthorization Fehler: '.$response['errormessage'],
|
||||
$response
|
||||
);
|
||||
PaymentTransaction::create([
|
||||
|
|
@ -352,6 +358,7 @@ class PayoneController extends Controller
|
|||
'errorcode' => $response['errorcode'],
|
||||
'errormessage' => $response['errormessage'],
|
||||
'customermessage' => $response['customermessage'],
|
||||
'transmitted_data' => $request,
|
||||
'status' => $response['status'],
|
||||
'mode' => $this->shopping_payment->mode,
|
||||
]);
|
||||
|
|
@ -361,10 +368,10 @@ class PayoneController extends Controller
|
|||
}
|
||||
\Session::flash('errormessage', $response['errormessage']);
|
||||
\Session::flash('customermessage', $response['customermessage']);
|
||||
|
||||
return redirect(route('checkout.checkout_card'));
|
||||
}
|
||||
|
||||
|
||||
if ($response['status'] === 'REDIRECT') {
|
||||
PaymentTransaction::create([
|
||||
'shopping_payment_id' => $this->shopping_payment->id,
|
||||
|
|
@ -379,7 +386,8 @@ class PayoneController extends Controller
|
|||
if ($is_abo) {
|
||||
return $response;
|
||||
}
|
||||
return redirect()->away($response["redirecturl"]);
|
||||
|
||||
return redirect()->away($response['redirecturl']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
@ -387,7 +395,7 @@ class PayoneController extends Controller
|
|||
// header("Location: " . $response["redirecturl"]); // or other redirect method
|
||||
$payt = PaymentTransaction::create([
|
||||
'shopping_payment_id' => $this->shopping_payment->id,
|
||||
'request' => $this->method['request'],
|
||||
'request' => $this->method['request'],
|
||||
'txid' => $response['txid'],
|
||||
'userid' => $response['userid'],
|
||||
'status' => $response['status'],
|
||||
|
|
@ -400,33 +408,32 @@ class PayoneController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
if ($payt->shopping_payment->clearingtype === "vor") {
|
||||
//vorkasse
|
||||
if ($payt->shopping_payment->clearingtype === 'vor') {
|
||||
// vorkasse
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($payt->shopping_payment->clearingtype === "cc") {
|
||||
//creditcard
|
||||
if ($payt->shopping_payment->clearingtype === 'cc') {
|
||||
// creditcard
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($payt->shopping_payment->clearingtype === "elv") {
|
||||
//sepa
|
||||
if ($payt->shopping_payment->clearingtype === 'elv') {
|
||||
// sepa
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
}
|
||||
|
||||
var_dump($response);
|
||||
die();
|
||||
//txid
|
||||
//Payment process ID (PAYONE)
|
||||
//userid
|
||||
//Debtor ID (PAYONE)
|
||||
exit();
|
||||
// txid
|
||||
// Payment process ID (PAYONE)
|
||||
// userid
|
||||
// Debtor ID (PAYONE)
|
||||
}
|
||||
|
||||
|
||||
if ($response['status'] === 'PENDING') {
|
||||
MyLog::writeLog(
|
||||
'payone',
|
||||
|
|
@ -434,11 +441,11 @@ class PayoneController extends Controller
|
|||
'Error:1000 Status PENDING App\Http\Controllers\Pay\PayoneController::ResponseData response status PENDING',
|
||||
$response
|
||||
);
|
||||
die();
|
||||
//txid
|
||||
//Payment process ID (PAYONE)
|
||||
//userid
|
||||
//Debtor ID (PAYONE)
|
||||
exit();
|
||||
// txid
|
||||
// Payment process ID (PAYONE)
|
||||
// userid
|
||||
// Debtor ID (PAYONE)
|
||||
}
|
||||
MyLog::writeLog(
|
||||
'payone',
|
||||
|
|
@ -449,22 +456,20 @@ class PayoneController extends Controller
|
|||
abort(403, 'Der Zahlungsanbieter ist nicht erreichbar, die Zahlung konnte nicht durchgeführt werden. Bitte versuchen Sie es später erneut. Fehlercode: 1001');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function checkCreditCard($data)
|
||||
{
|
||||
$this->prepayment = [
|
||||
"request" => "creditcardcheck", // create account receivable and instantly book the amount
|
||||
"cardholder" => $data['cc_cardholder_first'] . " " . $data['cc_cardholder_last'],
|
||||
"cardpan" => $data['cc_cardpan'],
|
||||
"cardexpiredate" => substr($data['cc_cardexpireyear'], -2) . $data['cc_cardexpiremonth'],
|
||||
"cardtype" => $data['cc_cardtype'],
|
||||
"cardcvc2" => $data['cc_cardcvc2'],
|
||||
"storecarddata" => 'yes',
|
||||
"language" => 'de',
|
||||
'request' => 'creditcardcheck', // create account receivable and instantly book the amount
|
||||
'cardholder' => $data['cc_cardholder_first'].' '.$data['cc_cardholder_last'],
|
||||
'cardpan' => $data['cc_cardpan'],
|
||||
'cardexpiredate' => substr($data['cc_cardexpireyear'], -2).$data['cc_cardexpiremonth'],
|
||||
'cardtype' => $data['cc_cardtype'],
|
||||
'cardcvc2' => $data['cc_cardcvc2'],
|
||||
'storecarddata' => 'yes',
|
||||
'language' => 'de',
|
||||
];
|
||||
$request = array_merge($this->default, $this->prepayment);
|
||||
|
||||
return Payone::sendRequest($request);
|
||||
}
|
||||
|
||||
|
|
@ -474,18 +479,19 @@ class PayoneController extends Controller
|
|||
$this->setPersonalData();
|
||||
|
||||
$this->prepayment = [
|
||||
"clearingtype" => "elv",
|
||||
"amount" => $amount, // amount in smallest currency unit, i.e. cents
|
||||
"currency" => $currency,
|
||||
"request" => "managemandate", // create account receivable and instantly book the amount
|
||||
"bankaccountholder" => $data['elv_bankaccountholder'],
|
||||
"iban" => $data['elv_iban'],
|
||||
"bic" => $data['elv_bic'],
|
||||
'clearingtype' => 'elv',
|
||||
'amount' => $amount, // amount in smallest currency unit, i.e. cents
|
||||
'currency' => $currency,
|
||||
'request' => 'managemandate', // create account receivable and instantly book the amount
|
||||
'bankaccountholder' => $data['elv_bankaccountholder'],
|
||||
'iban' => $data['elv_iban'],
|
||||
'bic' => $data['elv_bic'],
|
||||
|
||||
// "language" => 'de',
|
||||
];
|
||||
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->urls);
|
||||
|
||||
return Payone::sendRequest($request);
|
||||
}
|
||||
|
||||
|
|
@ -524,9 +530,6 @@ class PayoneController extends Controller
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/* public function checkStatus(){
|
||||
// again, the default values will be needed
|
||||
$capture = array(
|
||||
|
|
@ -541,9 +544,8 @@ class PayoneController extends Controller
|
|||
|
||||
} */
|
||||
|
||||
|
||||
//set for clearingtype
|
||||
//debit payment
|
||||
// set for clearingtype
|
||||
// debit payment
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
|
@ -596,6 +598,6 @@ class PayoneController extends Controller
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue