payment reference

This commit is contained in:
Rainer Gümpelein 2022-02-20 09:10:00 +01:00
parent 32213a7b46
commit 10d3b3d67f
2 changed files with 58 additions and 66 deletions

View file

@ -7,7 +7,7 @@ package Payment;
#Adapted from payone_post.pl
#
#enable for syntax check
#use lib "/var/www/copri-bike/shareedms-primary/src";
use lib "/var/www/copri-bike/shareedms-primary/src";
use strict;
use warnings;
@ -133,16 +133,26 @@ sub preauthorizationSEPA_main {
}
}
my $preauth_amount = 0;
my $reference = "";
#for testing payment-data
if($ctt_rec->{c_id} && $ctt_rec->{c_id} == 1 && $ctt_rec->{reference}){
$ctt = $ctt_rec;
$preauth_amount = $ctt->{int15};#int15 should only used for testing payment-data
$reference = $ctt_rec->{reference};
}else{
$preauth_amount = $ctt->{int01};
$ctt->{reference} = $dbt->{operator}->{$varenv->{dbname}}->{oprefix} . "-S-" . $ctt->{ct_name};
$reference = $dbt->{operator}->{$varenv->{dbname}}->{oprefix} . "-S-" . $ctt->{ct_name};
}
#if reference still set then count
if($ctt->{txt25}){
if($ctt->{txt25} =~ /\d-\d$/){
my ($refbase,$sub) = split(/-/,$ctt->{txt25});
$sub++;
$reference = "$refbase-$sub";
}else{
$reference = "$ctt->{txt25}-1";
}
}
if($ctadr->{c_id} && $ctt->{c_id} && $preauth_amount > 0){
@ -178,7 +188,7 @@ sub preauthorizationSEPA_main {
currency => "$currency",
iban => uc($ctadr->{txt22}),
bic => uc($ctadr->{txt23}),
reference => "$ctt->{reference}"
reference => "$reference"
};
$preauth_request->{ip} = "$ctadr->{txt25}" if($ctadr->{txt25} && $ctadr->{txt25} =~ /\d+\.\d+\.\d+\.\d+/);
my $request = { %$payone_conf, %$preauth_request};
@ -265,14 +275,26 @@ sub preauthorizationCC_main {
}
}
my $preauth_amount = 0;
my $reference = "";
#for testing payment-data
if($ctt_rec->{c_id} && $ctt_rec->{c_id} == 1 && $ctt_rec->{reference}){
$ctt = $ctt_rec;
$preauth_amount = $ctt->{int15};#int15 should only used for testing payment-data
$reference = $ctt_rec->{reference};
}else{
$preauth_amount = $ctt->{int01};
$ctt->{reference} = $dbt->{operator}->{$varenv->{dbname}}->{oprefix} . "-C-" . $ctt->{ct_name};
$reference = $dbt->{operator}->{$varenv->{dbname}}->{oprefix} . "-C-" . $ctt->{ct_name};
}
#if reference still set then count
if($ctt->{txt25}){
if($ctt->{txt25} =~ /\d-\d$/){
my ($refbase,$sub) = split(/-/,$ctt->{txt25});
$sub++;
$reference = "$refbase-$sub";
}else{
$reference = "$ctt->{txt25}-1";
}
}
if($ctadr->{c_id} && $ctt->{c_id} && $preauth_amount > 0){
@ -306,7 +328,7 @@ sub preauthorizationCC_main {
country => "$ctadr->{txt10}",
pseudocardpan => "$ctadr->{ct_name}",
ecommercemode => "internet", # wird zu 3Dscheck,
reference => "$ctt->{reference}"
reference => "$reference"
};
# https://docs.payone.com/display/public/PLATFORM/Special+remarks+-+Recurring+transactions+credit+card
# https://docs.payone.com/display/public/INT/Best+Practices+for+PSD2#tab-3DS+2.0+Best+Case