sharee.bike/copri4/main/src/scripts/payone_post_Payment.pl

98 lines
3.3 KiB
Perl
Raw Normal View History

2021-12-30 12:05:56 +01:00
#!/usr/bin/perl
#
#Autor ragu@gnu-systems.de
#sharee payone POST
#
#managemandate
#sudo su www-data -c "/var/www/copri4/shareeapp-primary/src/scripts/payone_post_Payment.pl shareeapp-fr01 managemandate contentadr 21250"
#
#captureSEPA
#sudo su www-data -c "/var/www/copri4/shareeapp-primary/src/scripts/payone_post_Payment.pl shareeapp-fr01 preauthorizationSEPA contentadr 22027 28845"
#sudo su www-data -c "/var/www/copri4/shareeapp-primary/src/scripts/payone_post_Payment.pl shareeapp-fr01 captureSEPA contenttrans '' 28845"
#
use vars qw($syshost);
BEGIN {
$syshost = $ARGV[0] || die 'syshost not defined';
}
2022-01-09 18:31:20 +01:00
use lib "/var/www/copri-bike/$syshost/src";
2021-12-30 12:05:56 +01:00
use strict;
use warnings;
use POSIX;
use CGI ':standard';
use Lib::Config;
use Mod::Libenzdb;
use Mod::Payment;
use Config::General;
use Data::Dumper;
use Sys::Hostname;
my $hostname = hostname;
my $q = new CGI;
my $cf = new Config;
my %varenv = $cf->envonline("$syshost");
print "$varenv{dbname}\n";
my $db = new Libenzdb;
my $pay = new Payment;
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
my $owner = 178;#payone API
my $todo = $ARGV[1];
my $table = $ARGV[2];
my $ctadr_id = $ARGV[3];
my $ctt_id = $ARGV[4];
my $sequenz = $ARGV[5] || 0;
my $set_time = $ARGV[6] || "";#no_time
my $renewed = $ARGV[7] || "";#for requesting new txid via script loop_payone_capture.pl
my $request_state = $ARGV[8] || "";#if request state=occupied , then never delete adr4xml
my $globalconf_file = "/var/www/copri4/shareeconf/global.cfg";
my $conf = Config::General->new($globalconf_file);
my %globalconf = $conf->getall;
#print Dumper(\%globalconf);
my $refpre = $globalconf{operator}{$varenv{dbname}}->{oprefix};#FR KN ...
my $payone_conf = $globalconf{operator}{$varenv{dbname}}{payone_conf} || $globalconf{payone_conf};
my $ctadr = { c_id => 0 };
my $ctt = { c_id => 0 };
$ctadr = $db->get_contentrow("contentadr",$ctadr_id,"","","","","","") if($ctadr_id);
$ctt = $db->get_contentrow("contenttrans",$ctt_id,"","","","","","") if($ctt_id);
#managemandate SEPA
#1.
#sudo su www-data -c "./src/scripts/payone_post.pl $varenv{syshost} managemandate contentadr $ctadr_id"
if($todo eq "managemandate" && $table eq "contentadr" && $ctadr->{c_id} > 0){
$pay->managemandate_main(\%varenv,$ctadr,$ctt,$owner);
}
#preauthorizationSEPA
#2.
#sudo su www-data -c "./src/scripts/payone_post.pl $varenv{syshost} preauthorizationSEPA contentadr $ctadr_id $ctt_id"
if($todo eq "preauthorizationSEPA" && $table eq "contentadr" && $ctadr->{c_id} > 0 && $ctt->{c_id} > 0){
$pay->preauthorizationSEPA_main(\%varenv,$ctadr,$ctt,$owner);
}
#captureSEPA
#3.
#sudo su www-data -c "./src/scripts/payone_post.pl $varenv{syshost} captureSEPA contenttrans '' $ctt_id"
if($todo eq "captureSEPA" && $table eq "contenttrans" && $ctt->{c_id} > 0){
$pay->captureSEPA_main(\%varenv,$ctadr,$ctt,$owner);
}
#preauthorizationCC
#1.PayoneCC creditcardcheck ajaxCall
#2.
#sudo su www-data -c "./src/scripts/payone_post.pl $varenv{syshost} preauthorizationCC contentadr $ctadr_id $ctt_id"
if($todo eq "preauthorizationCC" && $table eq "contentadr" && $ctadr->{c_id} > 0 && $ctt->{c_id} > 0){
$pay->preauthorizationCC_main(\%varenv,$ctadr,$ctt,$owner);
}
#captureCC
#3.
#
if($todo eq "captureCC" && $table eq "contenttrans" && $ctt->{c_id} > 0){
$pay->captureCC_main(\%varenv,$ctadr,$ctt,$owner);
}