23-01-2026
This commit is contained in:
parent
a939cd51ef
commit
a8b395e20d
248 changed files with 29342 additions and 4805 deletions
|
|
@ -49,14 +49,14 @@ class PayoneController extends Controller
|
|||
private $method = [];
|
||||
private $prepayment = [];
|
||||
|
||||
/* private $onlineTransfer = [];
|
||||
/* private $onlineTransfer = [];
|
||||
private $creditCard = []; */
|
||||
private $deliveryData = [];
|
||||
|
||||
|
||||
|
||||
|
||||
// private $payment_method;
|
||||
// private $payment_method;
|
||||
private $urls = [];
|
||||
|
||||
private $shopping_user;
|
||||
|
|
@ -65,21 +65,25 @@ class PayoneController extends Controller
|
|||
|
||||
private $reference;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->default = \Config::get('payone.defaults');
|
||||
}
|
||||
|
||||
public function init($shopping_user, $shopping_order){
|
||||
public function init($shopping_user, $shopping_order)
|
||||
{
|
||||
$this->shopping_user = $shopping_user;
|
||||
$this->shopping_order = $shopping_order;
|
||||
$this->default['mode'] = $this->shopping_order->mode;
|
||||
}
|
||||
|
||||
public function getShoppingPayment(){
|
||||
public function getShoppingPayment()
|
||||
{
|
||||
return $this->shopping_payment;
|
||||
}
|
||||
public function setAboPayment($user_abo, $amount, $currency){
|
||||
public function setAboPayment($user_abo, $amount, $currency)
|
||||
{
|
||||
$this->reference = substr(uniqid('m', false), 0, 16);
|
||||
|
||||
$this->method = [
|
||||
|
|
@ -91,16 +95,16 @@ class PayoneController extends Controller
|
|||
'onlinebanktransfertype' => '',
|
||||
"request" => "authorization",
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
$this->aboInitPayment = [
|
||||
'recurrence'=>'recurring',
|
||||
'customer_is_present'=>'no',
|
||||
'recurrence' => 'recurring',
|
||||
'customer_is_present' => 'no',
|
||||
'request' => 'authorization',
|
||||
'amount' => $amount
|
||||
];
|
||||
|
||||
$this->prepayment = [
|
||||
];
|
||||
|
||||
$this->prepayment = [
|
||||
"reference" => $this->reference, // a unique reference, e.g. order number
|
||||
"amount" => $amount, // amount in smallest currency unit, i.e. cents
|
||||
"currency" => $currency,
|
||||
|
|
@ -122,50 +126,49 @@ class PayoneController extends Controller
|
|||
]);
|
||||
}
|
||||
//make Payone payment
|
||||
public function setPrePayment($payment_method, $amount, $currency, $ret = []){
|
||||
public function setPrePayment($payment_method, $amount, $currency, $ret = [])
|
||||
{
|
||||
|
||||
$this->reference = substr(uniqid('m', false), 0, 16);
|
||||
$this->setMethod($payment_method, $ret);
|
||||
|
||||
$this->urls = [
|
||||
'successurl' => route('checkout.transaction_status', ['success', $this->reference]),
|
||||
'successurl' => route('checkout.transaction_status', ['success', $this->reference]),
|
||||
'errorurl' => route('checkout.transaction_status', ['error', $this->reference]),
|
||||
'backurl' => route('checkout.transaction_status', ['cancel', $this->reference]),
|
||||
];
|
||||
|
||||
$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,
|
||||
];
|
||||
//init Abo
|
||||
if($this->shopping_order->is_abo){
|
||||
if($this->method["clearingtype"] === "cc"){
|
||||
"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
|
||||
if ($this->shopping_order->is_abo) {
|
||||
if ($this->method["clearingtype"] === "cc") {
|
||||
$this->aboInitPayment = [
|
||||
'recurrence'=>'recurring',
|
||||
'customer_is_present'=>'yes',
|
||||
'recurrence' => 'recurring',
|
||||
'customer_is_present' => 'yes',
|
||||
'request' => 'authorization',
|
||||
'amount' => $amount,
|
||||
];
|
||||
$this->method['request'] = 'authorization';
|
||||
|
||||
];
|
||||
$this->method['request'] = 'authorization';
|
||||
}
|
||||
|
||||
if($this->method["clearingtype"] === "wlt"){
|
||||
|
||||
if ($this->method["clearingtype"] === "wlt") {
|
||||
//payment for Abo PayPal
|
||||
$this->aboInitPayment = [
|
||||
'recurrence'=>'recurring',
|
||||
'customer_is_present'=>'yes',
|
||||
'request' => 'authorization',
|
||||
'amount' => $amount,
|
||||
'add_paydata[redirection_mode]' => 'DIRECT_TO_MERCHANT',
|
||||
];
|
||||
$this->setDeliverylData($this->shopping_user);
|
||||
$this->method['request'] = 'authorization';
|
||||
}
|
||||
|
||||
}
|
||||
$this->aboInitPayment = [
|
||||
'recurrence' => 'recurring',
|
||||
'customer_is_present' => 'yes',
|
||||
'request' => 'authorization',
|
||||
'amount' => $amount,
|
||||
'add_paydata[redirection_mode]' => 'DIRECT_TO_MERCHANT',
|
||||
];
|
||||
$this->setDeliverylData($this->shopping_user);
|
||||
$this->method['request'] = 'authorization';
|
||||
}
|
||||
}
|
||||
|
||||
$this->shopping_payment = ShoppingPayment::create([
|
||||
'shopping_order_id' => $this->shopping_order->id,
|
||||
|
|
@ -186,7 +189,8 @@ class PayoneController extends Controller
|
|||
return $this->reference;
|
||||
}
|
||||
|
||||
public function setPersonalData(){
|
||||
public function setPersonalData()
|
||||
{
|
||||
$this->personalData = [
|
||||
"firstname" => $this->shopping_user->billing_firstname,
|
||||
"lastname" => $this->shopping_user->billing_lastname, // mandatory
|
||||
|
|
@ -195,7 +199,7 @@ class PayoneController extends Controller
|
|||
"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" => ($this->shopping_user->billing_country) ? strtoupper($this->shopping_user->billing_country->code) : "DE", // mandatory
|
||||
"language" => "DE",
|
||||
];
|
||||
|
||||
|
|
@ -210,27 +214,25 @@ class PayoneController extends Controller
|
|||
"shipping_city" => "Frankfurt am Main",
|
||||
"shipping_country" => "DE"
|
||||
);*/
|
||||
|
||||
}
|
||||
|
||||
private function setMethod($payment_method, $ret = []){
|
||||
private function setMethod($payment_method, $ret = [])
|
||||
{
|
||||
|
||||
if($payment_method){
|
||||
if(strpos($payment_method, '#')){
|
||||
if ($payment_method) {
|
||||
if (strpos($payment_method, '#')) {
|
||||
$payment_method = explode('#', $payment_method);
|
||||
//wallet Paypal
|
||||
if($payment_method[0] === 'wlt'){
|
||||
if ($payment_method[0] === 'wlt') {
|
||||
$this->method = [
|
||||
"clearingtype" => "wlt",
|
||||
"wallettype" => $payment_method[1],
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "authorization"
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
//Online-Überweisung
|
||||
if($payment_method[0] === 'sb'){
|
||||
if ($payment_method[0] === 'sb') {
|
||||
$this->method = [
|
||||
"clearingtype" => "sb",
|
||||
"wallettype" => "",
|
||||
|
|
@ -241,18 +243,18 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
//Rechnungskauf
|
||||
if($payment_method[0] === 'fnc'){
|
||||
//MIVITA
|
||||
if(isset($payment_method[1]) && $payment_method[1] === 'MIV'){
|
||||
$this->method = [
|
||||
"clearingtype" => "fnc",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "MIV",
|
||||
"request" => "authorization",
|
||||
];
|
||||
}
|
||||
//PAYONE
|
||||
/* $this->method = [
|
||||
if ($payment_method[0] === 'fnc') {
|
||||
//MIVITA
|
||||
if (isset($payment_method[1]) && $payment_method[1] === 'MIV') {
|
||||
$this->method = [
|
||||
"clearingtype" => "fnc",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "MIV",
|
||||
"request" => "authorization",
|
||||
];
|
||||
}
|
||||
//PAYONE
|
||||
/* $this->method = [
|
||||
"clearingtype" => "fnc",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "",
|
||||
|
|
@ -262,10 +264,9 @@ class PayoneController extends Controller
|
|||
"add_paydata[payment_type]" => "Payolution-Invoicing",
|
||||
];*/
|
||||
}
|
||||
|
||||
}
|
||||
//vorkasse
|
||||
if($payment_method === 'elv'){
|
||||
if ($payment_method === 'elv') {
|
||||
$this->method = [
|
||||
"clearingtype" => "elv",
|
||||
"wallettype" => "",
|
||||
|
|
@ -274,13 +275,13 @@ class PayoneController extends Controller
|
|||
"mandate_identification" => $ret['elv']['mandate_identification'],
|
||||
"iban" => $ret['elv']['iban'],
|
||||
"bic" => $ret['elv']['bic'],
|
||||
"bankaccountholder" =>$ret['elv']['bankaccountholder'],
|
||||
// "bankcountry" => "DE",
|
||||
"bankaccountholder" => $ret['elv']['bankaccountholder'],
|
||||
// "bankcountry" => "DE",
|
||||
];
|
||||
}
|
||||
|
||||
//vorkasse
|
||||
if($payment_method === 'vor'){
|
||||
if ($payment_method === 'vor') {
|
||||
$this->method = [
|
||||
"clearingtype" => "vor",
|
||||
"wallettype" => "",
|
||||
|
|
@ -290,7 +291,7 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
//CreditCard
|
||||
if($payment_method === 'cc'){
|
||||
if ($payment_method === 'cc') {
|
||||
//need the $cc_ret
|
||||
$this->method = [
|
||||
"clearingtype" => "cc",
|
||||
|
|
@ -304,18 +305,19 @@ class PayoneController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function onlyPaymentResponse(){
|
||||
public function onlyPaymentResponse()
|
||||
{
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->aboInitPayment, $this->urls);
|
||||
$response = Payone::sendRequest($request);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function ResponseData($is_abo = false){
|
||||
public function ResponseData($is_abo = false)
|
||||
{
|
||||
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->aboInitPayment, $this->urls);
|
||||
//dd($request);
|
||||
//RECHNUNG MIV
|
||||
if($this->shopping_payment->clearingtype === 'fnc' && $this->shopping_payment->onlinebanktransfertype === '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'],
|
||||
|
|
@ -326,23 +328,22 @@ class PayoneController extends Controller
|
|||
'txaction' => 'invoice_open',
|
||||
'mode' => $this->shopping_payment->mode,
|
||||
]);
|
||||
Util::setUserHistoryValue(['status'=>5]);
|
||||
if($is_abo){
|
||||
Util::setUserHistoryValue(['status' => 5]);
|
||||
if ($is_abo) {
|
||||
return $this->reference;
|
||||
}
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
}
|
||||
|
||||
$response = Payone::sendRequest($request);
|
||||
/*
|
||||
* status APPROVED / REDIRECT / ERROR / PENDING
|
||||
*/
|
||||
if($response['status'] === 'ERROR'){
|
||||
if ($response['status'] === 'ERROR') {
|
||||
MyLog::writeLog(
|
||||
'payone',
|
||||
'error',
|
||||
'PayPal Preauthorization Fehler: ' . $response['errormessage'],
|
||||
'payone',
|
||||
'error',
|
||||
'PayPal Preauthorization Fehler: ' . $response['errormessage'],
|
||||
$response
|
||||
);
|
||||
PaymentTransaction::create([
|
||||
|
|
@ -354,8 +355,8 @@ class PayoneController extends Controller
|
|||
'status' => $response['status'],
|
||||
'mode' => $this->shopping_payment->mode,
|
||||
]);
|
||||
Util::setUserHistoryValue(['status'=>3]);
|
||||
if($is_abo){
|
||||
Util::setUserHistoryValue(['status' => 3]);
|
||||
if ($is_abo) {
|
||||
return $response;
|
||||
}
|
||||
\Session::flash('errormessage', $response['errormessage']);
|
||||
|
|
@ -364,7 +365,7 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
|
||||
if($response['status'] === 'REDIRECT'){
|
||||
if ($response['status'] === 'REDIRECT') {
|
||||
PaymentTransaction::create([
|
||||
'shopping_payment_id' => $this->shopping_payment->id,
|
||||
'request' => $this->method['request'],
|
||||
|
|
@ -374,17 +375,16 @@ class PayoneController extends Controller
|
|||
'mode' => $this->shopping_payment->mode,
|
||||
|
||||
]);
|
||||
Util::setUserHistoryValue(['status'=>4]);
|
||||
if($is_abo){
|
||||
Util::setUserHistoryValue(['status' => 4]);
|
||||
if ($is_abo) {
|
||||
return $response;
|
||||
}
|
||||
return redirect()->away($response["redirecturl"]);
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
if($response['status'] === 'APPROVED'){
|
||||
// header("Location: " . $response["redirecturl"]); // or other redirect method
|
||||
if ($response['status'] === 'APPROVED') {
|
||||
// header("Location: " . $response["redirecturl"]); // or other redirect method
|
||||
$payt = PaymentTransaction::create([
|
||||
'shopping_payment_id' => $this->shopping_payment->id,
|
||||
'request' => $this->method['request'],
|
||||
|
|
@ -395,24 +395,24 @@ class PayoneController extends Controller
|
|||
'mode' => $this->shopping_payment->mode,
|
||||
|
||||
]);
|
||||
Util::setUserHistoryValue(['status'=>5]);
|
||||
if($is_abo){
|
||||
Util::setUserHistoryValue(['status' => 5]);
|
||||
if ($is_abo) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
if($payt->shopping_payment->clearingtype === "vor"){
|
||||
if ($payt->shopping_payment->clearingtype === "vor") {
|
||||
//vorkasse
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
}
|
||||
|
||||
if($payt->shopping_payment->clearingtype === "cc"){
|
||||
if ($payt->shopping_payment->clearingtype === "cc") {
|
||||
//creditcard
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
}
|
||||
|
||||
if($payt->shopping_payment->clearingtype === "elv"){
|
||||
if ($payt->shopping_payment->clearingtype === "elv") {
|
||||
//sepa
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
|
|
@ -427,11 +427,11 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
|
||||
if($response['status'] === 'PENDING'){
|
||||
if ($response['status'] === 'PENDING') {
|
||||
MyLog::writeLog(
|
||||
'payone',
|
||||
'error',
|
||||
'Error:1000 Status PENDING App\Http\Controllers\Pay\PayoneController::ResponseData response status PENDING',
|
||||
'payone',
|
||||
'error',
|
||||
'Error:1000 Status PENDING App\Http\Controllers\Pay\PayoneController::ResponseData response status PENDING',
|
||||
$response
|
||||
);
|
||||
die();
|
||||
|
|
@ -441,9 +441,9 @@ class PayoneController extends Controller
|
|||
//Debtor ID (PAYONE)
|
||||
}
|
||||
MyLog::writeLog(
|
||||
'payone',
|
||||
'error',
|
||||
'Error:1001 Der Zahlungsanbieter ist nicht erreichbar, die Zahlung konnte nicht durchgeführt werden. App\Http\Controllers\Pay\PayoneController::ResponseData error no response status',
|
||||
'payone',
|
||||
'error',
|
||||
'Error:1001 Der Zahlungsanbieter ist nicht erreichbar, die Zahlung konnte nicht durchgeführt werden. App\Http\Controllers\Pay\PayoneController::ResponseData error no response status',
|
||||
$response
|
||||
);
|
||||
abort(403, 'Der Zahlungsanbieter ist nicht erreichbar, die Zahlung konnte nicht durchgeführt werden. Bitte versuchen Sie es später erneut. Fehlercode: 1001');
|
||||
|
|
@ -456,7 +456,7 @@ class PayoneController extends Controller
|
|||
{
|
||||
$this->prepayment = [
|
||||
"request" => "creditcardcheck", // create account receivable and instantly book the amount
|
||||
"cardholder" => $data['cc_cardholder_first']." ".$data['cc_cardholder_last'],
|
||||
"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'],
|
||||
|
|
@ -489,29 +489,30 @@ class PayoneController extends Controller
|
|||
return Payone::sendRequest($request);
|
||||
}
|
||||
|
||||
public function setDeliverylData($shopping_user){
|
||||
if($shopping_user->same_as_billing == true){
|
||||
$this->deliveryData = [
|
||||
'shipping_firstname' => $shopping_user->billing_firstname,
|
||||
'shipping_lastname' => $shopping_user->billing_lastname,
|
||||
'shipping_zip' => $shopping_user->billing_zipcode,
|
||||
'shipping_city' => $shopping_user->billing_city,
|
||||
'shipping_country' => $shopping_user->billing_country->code,
|
||||
'shipping_street' => $shopping_user->billing_address,
|
||||
];
|
||||
}else{
|
||||
public function setDeliverylData($shopping_user)
|
||||
{
|
||||
if ($shopping_user->same_as_billing == true) {
|
||||
$this->deliveryData = [
|
||||
'shipping_firstname' => $shopping_user->shipping_firstname,
|
||||
'shipping_lastname' => $shopping_user->shipping_lastname,
|
||||
'shipping_zip' => $shopping_user->shipping_zipcode,
|
||||
'shipping_city' => $shopping_user->shipping_city,
|
||||
'shipping_country' => $shopping_user->shipping_country->code,
|
||||
'shipping_street' => $shopping_user->shipping_address,
|
||||
'shipping_firstname' => $shopping_user->billing_firstname,
|
||||
'shipping_lastname' => $shopping_user->billing_lastname,
|
||||
'shipping_zip' => $shopping_user->billing_zipcode,
|
||||
'shipping_city' => $shopping_user->billing_city,
|
||||
'shipping_country' => $shopping_user->billing_country->code,
|
||||
'shipping_street' => $shopping_user->billing_address,
|
||||
];
|
||||
} else {
|
||||
$this->deliveryData = [
|
||||
'shipping_firstname' => $shopping_user->shipping_firstname,
|
||||
'shipping_lastname' => $shopping_user->shipping_lastname,
|
||||
'shipping_zip' => $shopping_user->shipping_zipcode,
|
||||
'shipping_city' => $shopping_user->shipping_city,
|
||||
'shipping_country' => $shopping_user->shipping_country->code,
|
||||
'shipping_street' => $shopping_user->shipping_address,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/* public function getPDFFile($mandateId)
|
||||
/* public function getPDFFile($mandateId)
|
||||
{
|
||||
|
||||
$params['file_reference'] = $mandateId;//"XX-T0000000";
|
||||
|
|
@ -582,7 +583,7 @@ class PayoneController extends Controller
|
|||
* bic
|
||||
* bankcountry*/
|
||||
|
||||
/* * Card type
|
||||
/* * Card type
|
||||
V Visa
|
||||
M MasterCard
|
||||
A American Express
|
||||
|
|
@ -597,11 +598,4 @@ class PayoneController extends Controller
|
|||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue