SEPA Payment
This commit is contained in:
parent
7ef7a507c7
commit
f117f79bb9
9 changed files with 286 additions and 95 deletions
|
|
@ -79,10 +79,10 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
//make Payone payment
|
||||
public function setPrePayment($payment_method, $amount, $currency, $cc_ret = []){
|
||||
public function setPrePayment($payment_method, $amount, $currency, $ret = []){
|
||||
|
||||
$this->reference = substr(uniqid(true), 0, 16);
|
||||
$this->setMethod($payment_method, $cc_ret);
|
||||
$this->setMethod($payment_method, $ret);
|
||||
|
||||
$this->urls = [
|
||||
'successurl' => route('checkout.transaction_status', ['success', $this->reference]),
|
||||
|
|
@ -138,13 +138,13 @@ class PayoneController extends Controller
|
|||
|
||||
}
|
||||
|
||||
private function setMethod($payment_method, $cc_ret = []){
|
||||
private function setMethod($payment_method, $ret = []){
|
||||
|
||||
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],
|
||||
|
|
@ -153,7 +153,7 @@ class PayoneController extends Controller
|
|||
];
|
||||
}
|
||||
//Online-Überweisung
|
||||
if($payment_method[0] == 'sb'){
|
||||
if($payment_method[0] === 'sb'){
|
||||
$this->method = [
|
||||
"clearingtype" => "sb",
|
||||
"wallettype" => "",
|
||||
|
|
@ -164,7 +164,7 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
//Rechnungskauf
|
||||
/* if($payment_method[0]== 'fnc'){
|
||||
/* if($payment_method[0]=== 'fnc'){
|
||||
$this->method = [
|
||||
"clearingtype" => "fnc",
|
||||
"wallettype" => "",
|
||||
|
|
@ -178,7 +178,22 @@ class PayoneController extends Controller
|
|||
*/
|
||||
}
|
||||
//vorkasse
|
||||
if($payment_method == 'vor'){
|
||||
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'],
|
||||
// "bankcountry" => "DE",
|
||||
];
|
||||
}
|
||||
|
||||
//vorkasse
|
||||
if($payment_method === 'vor'){
|
||||
$this->method = [
|
||||
"clearingtype" => "vor",
|
||||
"wallettype" => "",
|
||||
|
|
@ -186,22 +201,19 @@ class PayoneController extends Controller
|
|||
"request" => "authorization",
|
||||
];
|
||||
}
|
||||
|
||||
//CreditCard
|
||||
if($payment_method == 'cc'){
|
||||
if($payment_method === 'cc'){
|
||||
//need the $cc_ret
|
||||
$this->method = [
|
||||
"clearingtype" => "cc",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "authorization",
|
||||
"pseudocardpan" => $cc_ret['pseudocardpan']
|
||||
"pseudocardpan" => $ret['cc']['pseudocardpan']
|
||||
//"xid" => "3-D Secure transaction ID"
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -209,14 +221,11 @@ class PayoneController extends Controller
|
|||
|
||||
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->urls);
|
||||
|
||||
|
||||
|
||||
$response = Payone::sendRequest($request);
|
||||
/*
|
||||
* status APPROVED / REDIRECT / ERROR / PENDING
|
||||
*/
|
||||
if($response['status'] == 'ERROR'){
|
||||
if($response['status'] === 'ERROR'){
|
||||
PaymentTransaction::create([
|
||||
'shopping_payment_id' => $this->shopping_payment->id,
|
||||
'request' => $this->method['request'],
|
||||
|
|
@ -231,7 +240,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'],
|
||||
|
|
@ -244,7 +253,7 @@ class PayoneController extends Controller
|
|||
|
||||
}
|
||||
|
||||
if($response['status'] == 'APPROVED'){
|
||||
if($response['status'] === 'APPROVED'){
|
||||
// header("Location: " . $response["redirecturl"]); // or other redirect method
|
||||
$payt = PaymentTransaction::create([
|
||||
'shopping_payment_id' => $this->shopping_payment->id,
|
||||
|
|
@ -255,18 +264,25 @@ class PayoneController extends Controller
|
|||
'transmitted_data' => $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"){
|
||||
//sepa
|
||||
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
var_dump($response);
|
||||
die();
|
||||
//txid
|
||||
|
|
@ -276,7 +292,7 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
|
||||
if($response['status'] == 'PENDING'){
|
||||
if($response['status'] === 'PENDING'){
|
||||
var_dump($response);
|
||||
die();
|
||||
//txid
|
||||
|
|
@ -308,6 +324,46 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function checkBankAccount($data, $amount, $currency, $shopping_user)
|
||||
{
|
||||
$this->shopping_user = $shopping_user;
|
||||
$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'],
|
||||
|
||||
// "language" => 'de',
|
||||
];
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->urls);
|
||||
|
||||
|
||||
// dd($request);
|
||||
return Payone::sendRequest($request);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* public function getPDFFile($mandateId)
|
||||
{
|
||||
|
||||
$params['file_reference'] = $mandateId;//"XX-T0000000";
|
||||
$params['file_type'] = 'SEPA_MANDATE';
|
||||
$params['file_format'] = 'PDF';
|
||||
$request = array_merge($this->default, $params);
|
||||
|
||||
return Payone::sendRequest($request);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/* public function checkStatus(){
|
||||
// again, the default values will be needed
|
||||
$capture = array(
|
||||
|
|
@ -327,6 +383,20 @@ class PayoneController extends Controller
|
|||
//debit payment
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $params['bankaccountholder'] = $paymentData['mopt_payone__debit_bankaccountholder'];
|
||||
$params['iban'] = $this->removeWhitespaces($paymentData['mopt_payone__debit_iban']);
|
||||
$params['bic'] = $this->removeWhitespaces($paymentData['mopt_payone__debit_bic']);
|
||||
|
||||
* $params['bankcountry'] = $paymentData['mopt_payone__debit_bankcountry'];
|
||||
$params['bankaccount'] = $this->removeWhitespaces($paymentData['mopt_payone__debit_bankaccount']);
|
||||
$params['bankcode'] = $this->removeWhitespaces($paymentData['mopt_payone__debit_bankcode']);
|
||||
|
||||
|
||||
if (Shopware()->Session()->moptMandateData) {
|
||||
$params['mandate_identification'] = Shopware()->Session()->moptMandateData['mopt_payone__mandateIdentification'];
|
||||
}
|
||||
*
|
||||
* ["clearing_bankaccount"]=> string(10) "2599100003"
|
||||
["clearing_bankcode"]=> string(8) "12345678"
|
||||
["clearing_bankcountry"]=> string(2) "DE"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue