This commit is contained in:
Nick Bebout 2011-03-12 02:45:06 +00:00
parent d88bf4b46a
commit 02322d6ed1
73 changed files with 19532 additions and 23747 deletions

81
paypal_reply/paypal_bilan Executable file
View file

@ -0,0 +1,81 @@
#!/usr/bin/perl
use strict;
use warnings;
my $total_usd_received ;
my $total_usd_invoice ;
my $total_eur_received ;
my $total_eur_invoice ;
my $nb_invoice ;
my $line ;
while( $line = <> ) {
next if ( $line =~ /^Date, Heure, Fuseau horaire, Nom, Type, Etat, Devise, Montant, Numéro d'avis de réception, Solde,/ ) ;
#print( "A1 $line" ) ;
chomp( $line ) ;
#print ("A2 $line\n" );
my $line2 = '",' . $line . '"' ;
my( $Nothing, $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat, $Devise, $Montant, $Numero_davis_de_reception, $Solde )
= split( '","', $line2 ) ;
#print ( "[$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
if (
'Paiement sur site marchand reçu' eq $Type
and 'USD' eq $Devise
and 'Terminé' eq $Etat
) {
$Montant =~tr/,/./;
#print "$Montant\n" ;
my $Montant2_usd;
$Montant2_usd = 15 if ( 14.11 == $Montant or 14.19 == $Montant ) ;
$Montant2_usd = 25 if ( 23.72 == $Montant or 23.85 == $Montant ) ;
$Montant2_usd = 35 if ( 33.33 == $Montant or 33.51 == $Montant ) ;
$Montant2_usd = 50 if ( 47.75 == $Montant or 14.19 == $Montant ) ;
$Montant2_usd = 125 if ( 119.82 == $Montant or 119.82 == $Montant ) ;
$Montant2_usd = 135 if ( 129.43 == $Montant or 129.43 == $Montant ) ;
#print "$Montant $Montant2_usd\n" ;
$total_usd_received += $Montant ;
$total_usd_invoice += $Montant2_usd ;
$nb_invoice++ ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Terminé' eq $Etat
) {
$Montant =~tr/,/./;
#print "$Montant\n" ;
my $Montant2_eur;
$Montant2_eur = 22 if ( 20.88 == $Montant or 20.99 == $Montant ) ;
$Montant2_eur = 30 if ( 28.58 == $Montant or 28.73 == $Montant ) ;
$Montant2_eur = 110 if ( 105.46 == $Montant ) ;
#print "$Montant $Montant2_eur\n" ;
$total_eur_received += $Montant ;
$total_eur_invoice += $Montant2_eur ;
$nb_invoice++ ;
}
}
print "USD banque $total_usd_received\n" ;
print "USD invoice $total_usd_invoice\n" ;
my $total_eur_from_usd ;
$total_eur_from_usd = int( ( $total_usd_invoice / 1.2981 ) + 0.5 ) ; # au 30 nov 2010 http://fr.finance.yahoo.com/devises/convertisseur/#from=EUR;to=USD;amt=1
print "EUR from USD $total_eur_from_usd\n" ;
#$total_eur = int( ( $total_eur_invoice / 1.3 ) + 0.5 ) ;
#print "EUR $total_eur_from_usd\n" ;
print "EUR banque $total_eur_received\n" ;
print "EUR invoice $total_eur_invoice\n" ;
my $total_eur = $total_eur_from_usd + $total_eur_invoice ;
print "EUR total $total_eur\n" ;
print "Nb invoice $nb_invoice\n" ;

View file

@ -1,6 +1,6 @@
#!/usr/bin/perl
# $Id: paypal_build_reply,v 1.8 2010/12/29 23:51:23 gilles Exp gilles $
# $Id: paypal_build_reply,v 1.10 2011/02/02 22:31:41 gilles Exp gilles $
use warnings;
use strict;
@ -8,13 +8,22 @@ use strict;
my ($msg_id_file, $msg_id);
my ($amount, $name, $email);
my (
$buyer, $object, $support, $description,
$paypal_line, $paypal_info,
$buyer, $description,
$url_source, $url_exe, $url, $release,
);
$msg_id_file = $ARGV[1];
$msg_id = firstline($msg_id_file);
while(<>) {
next if ( ! /^(.*Num.+ro de transaction :.*)$/ );
$paypal_line = $1;
$paypal_info = "===== Paypal id =====\n$paypal_line\n";
last;
}
while(<>) {
next if ( ! /^Vous avez re.*paiement d'un montant de (.*) de la part de (.*) \((.*)\)/);
($amount, $name, $email) = ($1, $2, $3);
@ -25,33 +34,7 @@ $url_source = firstline('/g/var/paypal_reply/url_source');
$url_exe = firstline('/g/var/paypal_reply/url_exe');
$release = firstline('/g/var/paypal_reply/url_release');
# source code wanted
if (('$35,00 USD' eq $amount) or ('$50,00 USD' eq $amount)) {
$object = 'imapsync source code';
$support = '';
$url = $url_source;
}
# win32 binary wanted
if (('$25,00 USD' eq $amount) or ('$15,00 USD' eq $amount)) {
$object = 'imapsync.exe binary';
$support = '';
$url = $url_exe;
}
# source code + technical support wanted
if ('$135,00 USD' eq $amount) {
$object = 'imapsync source code';
$support = "\nI'm ready to help you by email until success (I hope).\n";
$url = $url_source;
}
# win32 binary + technical support wanted
if ('$125,00 USD' eq $amount) {
$object = 'imapsync.exe binary';
$support = "\nI'm ready to help you by email until success (I hope).\n";
$url = $url_exe;
}
#print "[$amount] [$name] [$email] [$paypal_line]\n";
@ -80,7 +63,7 @@ while(<>) {
my $address = 'gilles.lamiral@laposte.net';
my $address2 = 'gilles@lamiral.info';
my $rcstag = '$Id: paypal_build_reply,v 1.8 2010/12/29 23:51:23 gilles Exp gilles $';
my $rcstag = '$Id: paypal_build_reply,v 1.10 2011/02/02 22:31:41 gilles Exp gilles $';
my $message = <<EOM
X-Comment: $rcstag
@ -88,16 +71,24 @@ In-Reply-To: $msg_id
From: Gilles LAMIRAL <$address>
To: <$email>
Bcc: Gilles LAMIRAL <$address>, <$address2>
Subject: [imapsync download] $object release $release [$email]
Subject: [imapsync download] imapsync release $release [$email]
Hello $name,
You will find the latest $object release $release at the following link:
$url
You will find the latest imapsync source code release $release at the following link:
$url_source
You will find the latest imapsync.exe binary release $release at the following link:
$url_exe
Next imapsync releases will be available for one year without extra payment.
Just keep this message and ask for the new links.
(I will build an automatic subscription tool later)
I thank you for buying and using imapsync,
I wish you successful transfers!
$support
$paypal_info
$buyer
$description
==== Vendeur ====
@ -123,7 +114,7 @@ EOM
print $message;
#print "[$amount] [$name] [$email] [$object]\n";
#print "[$amount] [$name] [$email] [$paypal_line]\n";
sub firstline {

View file

@ -1,6 +1,6 @@
#!/bin/sh
# $Id: paypal_functions,v 1.10 2011/01/11 01:41:31 gilles Exp gilles $
# $Id: paypal_functions,v 1.12 2011/02/02 22:32:26 gilles Exp gilles $
@ -60,8 +60,8 @@ get_mail() {
extract_mail() {
test -z "`ls $tmpdir/msg_in/`" && echo no mail && return
mkdir -p $tmpdir/msg_out/
test -z "`ls $tmpdir/msg_in/`" && echo no mail && return
(
cd $tmpdir/msg_out/
test -z "`ls .`" || rm -rf *_d
@ -70,23 +70,10 @@ extract_mail() {
#ls -d $tmpdir/msg_out/
}
extract_mail_test() {
test -z "`ls $tmpdir/msg_in/`" && echo no mail && return
mkdir -p $tmpdir/msg_out/
(
cd $tmpdir/msg_out/
test -z "`ls .`" || rm -rf *_d
paypal_mimeexplode ../msg_in/*
)
#ls -d $tmpdir/msg_out/
}
convert_utf8() {
test -z "`ls $tmpdir/msg_out/`" && echo no mail && return
mkdir -p $tmpdir/msg_out_utf8/
test -z "`ls $tmpdir/msg_out/`" && echo no mail && return
for f in $tmpdir/msg_out/*_d/*.txt; do
b=`basename "$f"`
d=`dirname "$f"`
@ -94,9 +81,15 @@ convert_utf8() {
d_utf8="$tmpdir/msg_out_utf8/$bd"
f_utf8="$d_utf8/$b"
test -d "$d_utf8" && continue
echo converting "$f" to "$f_utf8"
mkdir "$d_utf8"
8859_utf8 "$f" > "$f_utf8"
if file "$f" | grep -i UTF-8 > /dev/null
then
echo copying "$f" to "$f_utf8"
cp "$f" "$f_utf8"
else
echo converting "$f" to "$f_utf8"
8859_utf8 "$f" > "$f_utf8"
fi
done
}
@ -123,6 +116,20 @@ build_reply() {
done
}
build_reply_arg() {
for f in "$@"; do
#echo "$f"
d=`dirname "$f"`
bd=`basename "$d"`
file_id=`troncate_last_2_chars $bd`
d_reply="$tmpdir/msg_reply/$file_id"
test -f "$d_reply/$file_id.txt" && continue
mkdir -p "$d_reply"
echo building "$d_reply/$file_id.txt"
paypal_build_reply "$f" "$tmpdir/msg_id/$file_id"
done
}
send_reply() {
mkdir -p $tmpdir/msg_sent/
@ -134,8 +141,10 @@ send_reply() {
test -f "$d_sent/$b" && continue
mkdir -p "$d_sent"
test X"--send" = X"$1" && paypal_send --send "$f" && touch "$d_sent/$b"
#test X"--send" = X"$1" && touch "$d_sent/$b"
test X"" = X"$1" && paypal_send "$f"
done
mailq
}
paypal_all() {