promotion 1.0

This commit is contained in:
Kevin Adametz 2021-12-25 02:51:22 +01:00
parent 1cc8e025a1
commit 570d428b1c
60 changed files with 1596 additions and 272 deletions

View file

@ -59,6 +59,8 @@ class PayController extends Controller
private $reference;
private $payment_method;
public function __construct() {
}
@ -77,6 +79,7 @@ class PayController extends Controller
public function setPrePayment($payment_method, $amount, $currency, $ret = []){
$this->reference = $this->shopping_order->created_at->format('Ym').$this->shopping_order->id;//substr(uniqid('m', false), 0, 16);
$this->payment_method = $payment_method;
$this->setMethod($payment_method, $ret);
$this->prepayment = [
@ -86,7 +89,6 @@ class PayController extends Controller
"param" => $this->shopping_order->id,
];
$this->shopping_payment = ShoppingPayment::create([
'shopping_order_id' => $this->shopping_order->id,
'clearingtype' => $this->method["clearingtype"],
@ -119,6 +121,15 @@ class PayController extends Controller
private function setMethod($payment_method, $ret = []){
//vorkasse
if($payment_method === 'non'){
$this->method = [
"clearingtype" => "non",
"wallettype" => "",
'onlinebanktransfertype' => "",
"request" => "authorization",
];
}
if($payment_method === 'vor'){
$this->method = [
"clearingtype" => "vor",
@ -138,12 +149,21 @@ class PayController extends Controller
];
}
//Rechnungskauf
if($payment_method === 'pp'){
$this->method = [
"clearingtype" => "pp",
"wallettype" => "",
'onlinebanktransfertype' => "",
"request" => "CAPTURE",
];
}
}
public function ResponseData($identifier){
public function ResponseData($identifier, $payment_for = false){
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->urls);
//RECHNUNG MIV
$payt = PaymentTransaction::create([
'shopping_payment_id' => $this->shopping_payment->id,
@ -155,10 +175,26 @@ class PayController extends Controller
'txaction' => 'prev',
'mode' => $this->shopping_payment->mode,
]);
//paypal
if($this->payment_method === 'pp'){
$paypal = new PayPalController;
$redirect = $paypal->payment($this->shopping_payment, $payt, $identifier, $this->shopping_order->promotion_user_id);
Util::setUserHistoryValue(['status'=>4], $identifier);
return $redirect;
}
Util::setUserHistoryValue(['status'=>5], $identifier);
return redirect(route('user_checkout_final', [$payt->id, $this->reference, $identifier]));
switch ($payment_for) {
case 4: //promotion
return redirect(route('web_promotion_goto', ['thanksorder', $this->shopping_order->promotion_user_id, $payt->id, $this->reference, $identifier]));
break;
default:
return redirect(route('user_checkout_final', [$payt->id, $this->reference, $identifier]));
break;
}
}
}