1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
imapsync/W/paypal_reply/paypal_build_reply

217 lines
5.4 KiB
Plaintext
Raw Normal View History

2011-07-11 23:24:12 +02:00
#!/usr/bin/perl
2013-04-22 21:50:50 +02:00
# $Id: paypal_build_reply,v 1.21 2013/03/27 14:42:59 gilles Exp gilles $
2011-07-11 23:24:12 +02:00
use warnings;
use strict;
use Getopt::Long;
my ($msg_id_file, $msg_id);
my ($amount, $name, $email);
my (
$paypal_line, $paypal_info,
$buyer, $description, $object,
2012-07-21 04:18:22 +02:00
$url, $release, $release_exe,
2011-07-11 23:24:12 +02:00
);
my $help ;
my $debug ;
my $numopt = scalar(@ARGV);
my $opt_ret = GetOptions(
"help" => \$help,
"debug!" => \$debug,
);
usage() and exit if ($help or ! $numopt) ;
$msg_id_file = $ARGV[1];
$msg_id = firstline($msg_id_file);
$debug and print "Hi!\n" ;
while(<>) {
next if ( ! /^(.*Num.+ro de transaction.*)$/ );
$paypal_line = $1;
$paypal_info = "===== Paypal id =====\n$paypal_line\n";
$debug and print "$paypal_info" ;
last;
}
while(<>) {
if ( /^Vous avez re.*paiement d'un montant de (.*) de la part de (.*) \((.*)\)/) {
($amount, $name, $email) = ($1, $2, $3);
2013-02-09 03:40:54 +01:00
$debug and print "1 ($amount, $name, $email)\n" ;
2011-07-11 23:24:12 +02:00
last;
}
if ( /^Vous avez re.*paiement d'un montant de (.*) de la part de (.*)/) {
($amount, $name, $email) = ($1, "", $2);
2013-02-09 03:40:54 +01:00
$debug and print "2 ($amount, $name, $email)\n" ;
2011-07-11 23:24:12 +02:00
last;
}
}
$release = firstline( '/g/public_html/imapsync/VERSION' ) ;
$release_exe = firstline( '/g/public_html/imapsync/VERSION_EXE' ) ;
my $path_last = firstline( '/g/public_html/imapsync/dist/path_last.txt' ) ;
$url = "http://ks.lamiral.info/imapsync/dist/$path_last/" ;
2013-02-09 03:40:54 +01:00
$debug and print "[$amount] [$name] [$email] [$paypal_line]\n";
2011-07-11 23:24:12 +02:00
while(<>) {
if ( /^Acheteur/ ) {
$buyer .= "===== Acheteur =====\n";
2013-02-09 03:40:54 +01:00
$debug and print "1 $buyer\n" ;
2011-07-11 23:24:12 +02:00
last;
}
if ( /^Informations sur l'acheteur/ ) {
$buyer .= "===== Acheteur =====\n";
chomp( $name = <> );
$buyer .= "$name\n" ;
2013-02-09 03:40:54 +01:00
$debug and print "2 $buyer\n" ;
2011-07-11 23:24:12 +02:00
last;
}
}
while(<>) {
$buyer .= $_ if ( ! /^-----------------------------------/ );
last if ( /^-----------------------------------/ );
}
2013-02-09 03:40:54 +01:00
$debug and print "3 $buyer\n" ;
2011-07-11 23:24:12 +02:00
2013-02-09 03:40:54 +01:00
while(<>) {
$debug and print "Search Description [$_]\n" ;
next if ( ! /Description..?:(.*)/ );
2011-07-11 23:24:12 +02:00
$object = $1 ;
$description = "===== Details =====\n";
$description .= $_;
last;
}
2013-02-09 03:40:54 +01:00
$debug and print "[$object] [$description]\n";
2011-07-11 23:24:12 +02:00
while(<>) {
$debug and print "LINE:$_" ;
$description .= $_;
last if ( /^Paiement envoy/ );
last if ( /^N.*d'avis de r.*ception/ );
}
my $address = 'gilles.lamiral@laposte.net';
my $address2 = 'gilles@lamiral.info';
2013-04-22 21:50:50 +02:00
my $rcstag = '$Id: paypal_build_reply,v 1.21 2013/03/27 14:42:59 gilles Exp gilles $';
2011-07-11 23:24:12 +02:00
my $download_info = "You will find the latest imapsync.exe binary (release $release_exe)
and the latest imapsync source code (release $release) at the following link:
$url" ;
2012-04-17 00:28:48 +02:00
my $next_releases =
2013-04-22 21:50:50 +02:00
"Next imapsync releases will be available to you for lifetime without extra payment.
2012-04-17 00:28:48 +02:00
You'll be subscribed to a newsletter [imapsync_update] announcing new releases.
Just keep this message and ask for the new links in case you miss the newsletter.
2013-04-22 21:50:50 +02:00
Run imapsync without any argument to know if a new release is available.
A permanent link to last release is http://imapsync.lamiral.info/paypal_return.shtml
also written on the invoice you'll receive soon (I edit invoices once a week or on demand)." ;
2012-04-17 00:28:48 +02:00
2011-07-11 23:24:12 +02:00
my $thanks_software = "I thank you for buying and using imapsync,
I wish you successful transfers!" ;
my $thanks_support = "I thank you for buying support and using imapsync,
I wish you successful transfers, I will help you to succeed." ;
my $support_info = 'Now you have access to imapsync professional support.
You can contact me (Gilles LAMIRAL) by email or phone.
Email address: gilles.lamiral@laposte.net.
Professionnal phone number: +33 951 84 42 42 (France)
Mobile phone number: +33 620 79 76 06 (France).
I can call you back for free in many countries on landline telephone numbers
and to mobile numbers in the United States and France. So do not hesitate
to send me a note if you need vocal support.' ;
my $text_software = "$download_info\n
$next_releases\n
You will receive an invoice soon.\n
$thanks_software" ;
my $text_support = "$support_info\n
You will receive an invoice soon.\n
$thanks_support" ;
my $subject_software = "[imapsync download] imapsync release $release [$email]" ;
my $subject_support = "[imapsync support] imapsync release $release [$email]" ;
my $subject ;
my $text ;
2012-07-21 04:18:22 +02:00
if ( $object =~ m{imapsync support} ) {
2011-07-11 23:24:12 +02:00
$text = $text_support ;
$subject = $subject_support ;
}else{
$text = $text_software ;
$subject = $subject_software ;
}
my $message = <<EOM
X-Comment: $rcstag
In-Reply-To: $msg_id
From: Gilles LAMIRAL <$address>
To: <$email>
Bcc: Gilles LAMIRAL <$address>, <$address2>
Subject: $subject
Hello $name,
$text
$paypal_info
$buyer
$description
==== Vendeur ====
Gilles LAMIRAL
4 La Billais
35580 Baulon
FRANCE
Tel: +33 951 84 42 42
Mob: +33 620 79 76 06
Fax: +33 956 84 42 42
email: $address
2013-04-22 21:50:50 +02:00
--
2011-07-11 23:24:12 +02:00
Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
EOM
;
=pod
=cut
print $message;
2012-07-21 04:18:22 +02:00
$debug and print "[$amount] [$name] [$email] [$paypal_line] [$object]\n";
2011-07-11 23:24:12 +02:00
sub firstline {
# extract the first line of a file (without \n)
my($file) = @_;
my $line = "";
open FILE, $file or die("error [$file]: $! ");
chomp($line = <FILE>);
close FILE;
$line = ($line) ? $line: "error !EMPTY! [$file]";
return $line;
}