No regular expressions were active.
1 |
|
<?php
|
|
1 |
|
<?php
|
2 |
|
|
|
2 |
|
|
3 |
|
/*********
**********
**********
**********
**********
**********
**********
******
|
|
3 |
|
/*********
**********
**********
**********
**********
**********
**********
******
|
4 |
|
*
D
olphin Sma
rt Communi
ty Builder
|
|
4 |
|
*
D
olphin Sma
rt Communi
ty Builder
|
5 |
|
*
---------
--------
|
|
5 |
|
*
---------
--------
|
6 |
|
* begi
n
: M
on Mar 23
2006
|
|
6 |
|
* begi
n
: M
on Mar 23
2006
|
7 |
|
* copy
right
: (
C) 2006 Bo
onEx Group
|
|
7 |
|
* copy
right
: (
C) 2006 Bo
onEx Group
|
8 |
|
* webs
ite
: h
ttp://www.
boonex.com
/
|
|
8 |
|
* webs
ite
: h
ttp://www.
boonex.com
/
|
9 |
|
* This fil
e is part
of Dolphin
- Smart C
ommunity B
uilder
|
|
9 |
|
* This fil
e is part
of Dolphin
- Smart C
ommunity B
uilder
|
10 |
|
*
|
|
10 |
|
*
|
11 |
|
* Dolphin
is free so
ftware. Th
is work is
licensed
under a Cr
eative Com
mons Attri
bution 3.0
License.
|
|
11 |
|
* Dolphin
is free so
ftware. Th
is work is
licensed
under a Cr
eative Com
mons Attri
bution 3.0
License.
|
12 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
|
12 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
13 |
|
*
|
|
13 |
|
*
|
14 |
|
* Dolphin
is distrib
uted in th
e hope tha
t it will
be useful,
but WITHO
UT ANY WAR
RANTY;
|
|
14 |
|
* Dolphin
is distrib
uted in th
e hope tha
t it will
be useful,
but WITHO
UT ANY WAR
RANTY;
|
15 |
|
* without
even the i
mplied war
ranty of
MERCHANTAB
ILITY or F
ITNESS FOR
A PARTICU
LAR PURPOS
E.
|
|
15 |
|
* without
even the i
mplied war
ranty of
MERCHANTAB
ILITY or F
ITNESS FOR
A PARTICU
LAR PURPOS
E.
|
16 |
|
* See the
Creative C
ommons Att
ribution 3
.0 License
for more
details.
|
|
16 |
|
* See the
Creative C
ommons Att
ribution 3
.0 License
for more
details.
|
17 |
|
* You shou
ld have re
ceived a c
opy of the
Creative
Commons At
tribution
3.0 Licens
e along wi
th Dolphin
,
|
|
17 |
|
* You shou
ld have re
ceived a c
opy of the
Creative
Commons At
tribution
3.0 Licens
e along wi
th Dolphin
,
|
18 |
|
* see lice
nse.txt fi
le; if not
, write to
marketing
@boonex.co
m
|
|
18 |
|
* see lice
nse.txt fi
le; if not
, write to
marketing
@boonex.co
m
|
19 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
|
19 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
20 |
|
|
|
20 |
|
|
21 |
|
/*
|
|
21 |
|
/*
|
22 |
|
|
|
22 |
|
|
23 |
|
2CheckOut.
com v2
|
|
23 |
|
2CheckOut.
com v2
|
24 |
|
|
|
24 |
|
|
25 |
|
*/
|
|
25 |
|
*/
|
26 |
|
|
|
26 |
|
|
27 |
|
// It is r
ecommended
to put fu
ll path to
header fi
le here
|
|
27 |
|
// It is r
ecommended
to put fu
ll path to
header fi
le here
|
28 |
|
// You SHO
ULD put fu
ll path if
this scri
pt is not
in default
folder
|
|
28 |
|
// You SHO
ULD put fu
ll path if
this scri
pt is not
in default
folder
|
29 |
|
if ( !defi
ned('PAYME
NT_MODULE_
AS_HEADER'
) )
|
|
29 |
|
if ( !defi
ned('PAYME
NT_MODULE_
AS_HEADER'
) )
|
30 |
|
{
|
|
30 |
|
{
|
31 |
|
requir
e_once( ".
./inc/head
er.inc.php
" );
|
|
31 |
|
requir
e_once( ".
./inc/head
er.inc.php
" );
|
32 |
|
}
|
|
32 |
|
}
|
33 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'd
b.inc.php'
);
|
|
33 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'd
b.inc.php'
);
|
34 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'c
heckout.in
c.php' );
|
|
34 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'c
heckout.in
c.php' );
|
35 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'u
tils.inc.p
hp' );
|
|
35 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'u
tils.inc.p
hp' );
|
36 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'l
anguages.i
nc.php' );
|
|
36 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'l
anguages.i
nc.php' );
|
37 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'p
rofiles.in
c.php' );
|
|
37 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'p
rofiles.in
c.php' );
|
38 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'p
rof.inc.ph
p' );
|
|
38 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'p
rof.inc.ph
p' );
|
39 |
|
|
|
39 |
|
|
40 |
|
define( 'P
AYMENT_MOD
ULE_NAME',
'2checkou
tv2' );
|
|
40 |
|
define( 'P
AYMENT_MOD
ULE_NAME',
'2checkou
tv2' );
|
41 |
|
initProvid
erConfigur
ation();
|
|
41 |
|
initProvid
erConfigur
ation();
|
42 |
|
if ( strle
n(trim($pr
oviderConf
['Checkout
Filename']
)) )
|
|
42 |
|
if ( strle
n(trim($pr
oviderConf
['Checkout
Filename']
)) )
|
43 |
|
$check
outFilenam
e = trim($
providerCo
nf['Checko
utFilename
']);
|
|
43 |
|
$check
outFilenam
e = trim($
providerCo
nf['Checko
utFilename
']);
|
44 |
|
else
|
|
44 |
|
else
|
45 |
|
$check
outFilenam
e = $dir['
checkout']
. PAYMENT
_MODULE_NA
ME . '.php
';
|
|
45 |
|
$check
outFilenam
e = $dir['
checkout']
. PAYMENT
_MODULE_NA
ME . '.php
';
|
46 |
|
if ( strle
n(trim($pr
oviderConf
['Checkout
URL'])) )
|
|
46 |
|
if ( strle
n(trim($pr
oviderConf
['Checkout
URL'])) )
|
47 |
|
$check
outURL = t
rim($provi
derConf['C
heckoutURL
']);
|
|
47 |
|
$check
outURL = t
rim($provi
derConf['C
heckoutURL
']);
|
48 |
|
else
|
|
48 |
|
else
|
49 |
|
$check
outURL = $
site['chec
kout'] . P
AYMENT_MOD
ULE_NAME .
'.php';
|
|
49 |
|
$check
outURL = $
site['chec
kout'] . P
AYMENT_MOD
ULE_NAME .
'.php';
|
50 |
|
$debugFile
name = $di
r['checkou
t'] . 'deb
ug/' . PAY
MENT_MODUL
E_NAME . '
_debug.txt
';
|
|
50 |
|
$debugFile
name = $di
r['checkou
t'] . 'deb
ug/' . PAY
MENT_MODUL
E_NAME . '
_debug.txt
';
|
51 |
|
|
|
51 |
|
|
52 |
|
/**
|
|
52 |
|
/**
|
53 |
|
* Perform
s payment
module spe
cific conf
iguration
validation
|
|
53 |
|
* Perform
s payment
module spe
cific conf
iguration
validation
|
54 |
|
*
|
|
54 |
|
*
|
55 |
|
* @param
string &$e
rrorMessag
e
- error me
ssage when
return re
sult is no
t true
|
|
55 |
|
* @param
string &$e
rrorMessag
e
- error me
ssage when
return re
sult is no
t true
|
56 |
|
*
|
|
56 |
|
*
|
57 |
|
* @return
bool
- true if
configurat
ion is val
id, false
otherwise
|
|
57 |
|
* @return
bool
- true if
configurat
ion is val
id, false
otherwise
|
58 |
|
*
|
|
58 |
|
*
|
59 |
|
*
|
|
59 |
|
*
|
60 |
|
*/
|
|
60 |
|
*/
|
61 |
|
function m
oduleValid
ateConfigu
ration( &$
errorMessa
ge )
|
|
61 |
|
function m
oduleValid
ateConfigu
ration( &$
errorMessa
ge )
|
62 |
|
{
|
|
62 |
|
{
|
63 |
|
global
$provider
Conf;
|
|
63 |
|
global
$provider
Conf;
|
64 |
|
|
|
64 |
|
|
65 |
|
$commo
mResult =
commonVali
dateConfig
uration( $
errorMessa
ge );
|
|
65 |
|
$commo
mResult =
commonVali
dateConfig
uration( $
errorMessa
ge );
|
66 |
|
if ( !
$commomRes
ult )
|
|
66 |
|
if ( !
$commomRes
ult )
|
67 |
|
re
turn false
;
|
|
67 |
|
re
turn false
;
|
68 |
|
|
|
68 |
|
|
69 |
|
if ( s
trlen(trim
($provider
Conf['Para
m_sid']))
== 0 )
|
|
69 |
|
if ( s
trlen(trim
($provider
Conf['Para
m_sid']))
== 0 )
|
70 |
|
{
|
|
70 |
|
{
|
71 |
|
$e
rrorMessag
e = '\'Acc
ount numbe
r\' field
is empty';
|
|
71 |
|
$e
rrorMessag
e = '\'Acc
ount numbe
r\' field
is empty';
|
72 |
|
re
turn false
;
|
|
72 |
|
re
turn false
;
|
73 |
|
}
|
|
73 |
|
}
|
74 |
|
|
|
74 |
|
|
75 |
|
if ( !
in_array($
providerCo
nf['Param_
pay_method
'], array(
'CC', 'CK'
)) )
|
|
75 |
|
if ( !
in_array($
providerCo
nf['Param_
pay_method
'], array(
'CC', 'CK'
)) )
|
76 |
|
{
|
|
76 |
|
{
|
77 |
|
$e
rrorMessag
e = '\'Pay
method\'
field has
incorrect
value';
|
|
77 |
|
$e
rrorMessag
e = '\'Pay
method\'
field has
incorrect
value';
|
78 |
|
re
turn false
;
|
|
78 |
|
re
turn false
;
|
79 |
|
}
|
|
79 |
|
}
|
80 |
|
|
|
80 |
|
|
81 |
|
if ( s
trlen(trim
($provider
Conf['Para
m_secret_w
ord'])) ==
0 )
|
|
81 |
|
if ( s
trlen(trim
($provider
Conf['Para
m_secret_w
ord'])) ==
0 )
|
82 |
|
{
|
|
82 |
|
{
|
83 |
|
$e
rrorMessag
e = '\'Sec
ret word\'
field is
empty';
|
|
83 |
|
$e
rrorMessag
e = '\'Sec
ret word\'
field is
empty';
|
84 |
|
re
turn false
;
|
|
84 |
|
re
turn false
;
|
85 |
|
}
|
|
85 |
|
}
|
86 |
|
|
|
86 |
|
|
87 |
|
if ( s
trlen(trim
($provider
Conf['Para
m_secret_w
ord'])) >
16 || strp
os($provid
erConf['Pa
ram_secret
_word'], '
') !== fa
lse )
|
|
87 |
|
if ( s
trlen(trim
($provider
Conf['Para
m_secret_w
ord'])) >
16 || strp
os($provid
erConf['Pa
ram_secret
_word'], '
') !== fa
lse )
|
88 |
|
{
|
|
88 |
|
{
|
89 |
|
$e
rrorMessag
e = '\'Sec
ret word\'
field has
incorrect
value';
|
|
89 |
|
$e
rrorMessag
e = '\'Sec
ret word\'
field has
incorrect
value';
|
90 |
|
re
turn false
;
|
|
90 |
|
re
turn false
;
|
91 |
|
}
|
|
91 |
|
}
|
92 |
|
|
|
92 |
|
|
93 |
|
return
true;
|
|
93 |
|
return
true;
|
94 |
|
}
|
|
94 |
|
}
|
95 |
|
|
|
95 |
|
|
96 |
|
/**
|
|
96 |
|
/**
|
97 |
|
* Validat
e if trans
action rea
l and succ
essful
|
|
97 |
|
* Validat
e if trans
action rea
l and succ
essful
|
98 |
|
*
|
|
98 |
|
*
|
99 |
|
* @param
array $dat
aArr
- array wi
th data to
validate
|
|
99 |
|
* @param
array $dat
aArr
- array wi
th data to
validate
|
100 |
|
* @param
string &$e
rrorMessag
e
- error me
ssage when
return re
sult is no
t 1
|
|
100 |
|
* @param
string &$e
rrorMessag
e
- error me
ssage when
return re
sult is no
t 1
|
101 |
|
*
|
|
101 |
|
*
|
102 |
|
* @return
int
- validati
on result
|
|
102 |
|
* @return
int
- validati
on result
|
103 |
|
*
possible
variants:
|
|
103 |
|
*
possible
variants:
|
104 |
|
*
-1 - f
raud attem
pt
|
|
104 |
|
*
-1 - f
raud attem
pt
|
105 |
|
*
0 - t
ransaction
was decli
ned
|
|
105 |
|
*
0 - t
ransaction
was decli
ned
|
106 |
|
*
1 - t
ransaction
was appro
ved
|
|
106 |
|
*
1 - t
ransaction
was appro
ved
|
107 |
|
*
2 - i
nner error
|
|
107 |
|
*
2 - i
nner error
|
108 |
|
*
|
|
108 |
|
*
|
109 |
|
*
|
|
109 |
|
*
|
110 |
|
*/
|
|
110 |
|
*/
|
111 |
|
function m
oduleValid
ateTransac
tion( &$da
taArr, &$e
rrorMessag
e )
|
|
111 |
|
function m
oduleValid
ateTransac
tion( &$da
taArr, &$e
rrorMessag
e )
|
112 |
|
{
|
|
112 |
|
{
|
113 |
|
global
$provider
Conf;
|
|
113 |
|
global
$provider
Conf;
|
114 |
|
|
|
114 |
|
|
115 |
|
if ( $
providerCo
nf['Debug'
] )
|
|
115 |
|
if ( $
providerCo
nf['Debug'
] )
|
116 |
|
{
|
|
116 |
|
{
|
117 |
|
wr
iteDebugLo
g( 'Valida
tion for t
ransaction
', $dataAr
r, false )
;
|
|
117 |
|
wr
iteDebugLo
g( 'Valida
tion for t
ransaction
', $dataAr
r, false )
;
|
118 |
|
}
|
|
118 |
|
}
|
119 |
|
|
|
119 |
|
|
120 |
|
if ( !
commonVali
dateTransa
ction( $da
taArr['car
t_order_id
'], $dataA
rr['total'
], $errorM
essage ) )
|
|
120 |
|
if ( !
commonVali
dateTransa
ction( $da
taArr['car
t_order_id
'], $dataA
rr['total'
], $errorM
essage ) )
|
121 |
|
{
|
|
121 |
|
{
|
122 |
|
re
turn -1;
|
|
122 |
|
re
turn -1;
|
123 |
|
}
|
|
123 |
|
}
|
124 |
|
|
|
124 |
|
|
125 |
|
if ( $
dataArr['c
redit_card
_processed
'] != 'Y'
)
|
|
125 |
|
if ( $
dataArr['c
redit_card
_processed
'] != 'Y'
)
|
126 |
|
{
|
|
126 |
|
{
|
127 |
|
$e
rrorMessag
e = 'Credi
t card is
not proces
sed';
|
|
127 |
|
$e
rrorMessag
e = 'Credi
t card is
not proces
sed';
|
128 |
|
re
turn 0;
|
|
128 |
|
re
turn 0;
|
129 |
|
}
|
|
129 |
|
}
|
130 |
|
|
|
130 |
|
|
131 |
|
if ( $
dataArr['s
id'] != $p
roviderCon
f['Param_s
id'] )
|
|
131 |
|
if ( $
dataArr['s
id'] != $p
roviderCon
f['Param_s
id'] )
|
132 |
|
{
|
|
132 |
|
{
|
133 |
|
$e
rrorMessag
e = 'Wrong
recipient
account n
umber';
|
|
133 |
|
$e
rrorMessag
e = 'Wrong
recipient
account n
umber';
|
134 |
|
re
turn -1;
|
|
134 |
|
re
turn -1;
|
135 |
|
}
|
|
135 |
|
}
|
136 |
|
|
|
136 |
|
|
137 |
|
if ( $
providerCo
nf['Mode']
== 'live'
)
|
|
137 |
|
if ( $
providerCo
nf['Mode']
== 'live'
)
|
138 |
|
$M
D5String =
$provider
Conf['Para
m_secret_w
ord'] . $p
roviderCon
f['Param_s
id'] . $da
taArr['ord
er_number'
] . $dataA
rr['total'
];
|
|
138 |
|
$M
D5String =
$provider
Conf['Para
m_secret_w
ord'] . $p
roviderCon
f['Param_s
id'] . $da
taArr['ord
er_number'
] . $dataA
rr['total'
];
|
139 |
|
else
|
|
139 |
|
else
|
140 |
|
$M
D5String =
$provider
Conf['Para
m_secret_w
ord'] . $p
roviderCon
f['Param_s
id'] . '1'
. $dataAr
r['total']
;
|
|
140 |
|
$M
D5String =
$provider
Conf['Para
m_secret_w
ord'] . $p
roviderCon
f['Param_s
id'] . '1'
. $dataAr
r['total']
;
|
141 |
|
$gener
atedMD5 =
strtoupper
( md5($MD5
String) );
|
|
141 |
|
$gener
atedMD5 =
strtoupper
( md5($MD5
String) );
|
142 |
|
|
|
142 |
|
|
143 |
|
if ( $
providerCo
nf['Debug'
] )
|
|
143 |
|
if ( $
providerCo
nf['Debug'
] )
|
144 |
|
{
|
|
144 |
|
{
|
145 |
|
wr
iteDebugLo
g( 'Calcul
ated MD5 h
ash', $gen
eratedMD5,
false );
|
|
145 |
|
wr
iteDebugLo
g( 'Calcul
ated MD5 h
ash', $gen
eratedMD5,
false );
|
146 |
|
wr
iteDebugLo
g( 'Receiv
ed MD5 has
h', $dataA
rr['key'],
false );
|
|
146 |
|
wr
iteDebugLo
g( 'Receiv
ed MD5 has
h', $dataA
rr['key'],
false );
|
147 |
|
}
|
|
147 |
|
}
|
148 |
|
|
|
148 |
|
|
149 |
|
if ( $
dataArr['k
ey'] != $g
eneratedMD
5 )
|
|
149 |
|
if ( $
dataArr['k
ey'] != $g
eneratedMD
5 )
|
150 |
|
{
|
|
150 |
|
{
|
151 |
|
$e
rrorMessag
e = 'MD5 v
alidation
not passed
';
|
|
151 |
|
$e
rrorMessag
e = 'MD5 v
alidation
not passed
';
|
152 |
|
re
turn -1;
|
|
152 |
|
re
turn -1;
|
153 |
|
}
|
|
153 |
|
}
|
154 |
|
|
|
154 |
|
|
155 |
|
return
1;
|
|
155 |
|
return
1;
|
156 |
|
}
|
|
156 |
|
}
|
157 |
|
|
|
157 |
|
|
158 |
|
/**
|
|
158 |
|
/**
|
159 |
|
* Starts
transactio
n process
for specif
ied transa
ction
|
|
159 |
|
* Starts
transactio
n process
for specif
ied transa
ction
|
160 |
|
*
|
|
160 |
|
*
|
161 |
|
* @param
int $local
TranID
- starting
transacti
on databas
e ID
|
|
161 |
|
* @param
int $local
TranID
- starting
transacti
on databas
e ID
|
162 |
|
* @param
bool $recu
rring
- indicate
s whether
transactio
n recurrin
g or not
|
|
162 |
|
* @param
bool $recu
rring
- indicate
s whether
transactio
n recurrin
g or not
|
163 |
|
* @param
int $recur
ringDays
- if $recu
rring true
, then thi
s value sp
ecifies
|
|
163 |
|
* @param
int $recur
ringDays
- if $recu
rring true
, then thi
s value sp
ecifies
|
164 |
|
*
subscrip
tion days
|
|
164 |
|
*
subscrip
tion days
|
165 |
|
*
|
|
165 |
|
*
|
166 |
|
* @return
bool
- true if
start is s
uccessful,
false oth
erwise
|
|
166 |
|
* @return
bool
- true if
start is s
uccessful,
false oth
erwise
|
167 |
|
*
|
|
167 |
|
*
|
168 |
|
*
|
|
168 |
|
*
|
169 |
|
*/
|
|
169 |
|
*/
|
170 |
|
function m
oduleStart
Transactio
n( $localT
ranID, $re
curring =
false, $re
curringDay
s = 0 )
|
|
170 |
|
function m
oduleStart
Transactio
n( $localT
ranID, $re
curring =
false, $re
curringDay
s = 0 )
|
171 |
|
{
|
|
171 |
|
{
|
172 |
|
global
$provider
Conf;
|
|
172 |
|
global
$provider
Conf;
|
173 |
|
global
$checkout
URL;
|
|
173 |
|
global
$checkout
URL;
|
174 |
|
global
$memberID
; // defin
ed in chec
kout.inc.p
hp
|
|
174 |
|
global
$memberID
; // defin
ed in chec
kout.inc.p
hp
|
175 |
|
global
$cryptKey
;
|
|
175 |
|
global
$cryptKey
;
|
176 |
|
global
$currency
_code;
|
|
176 |
|
global
$currency
_code;
|
177 |
|
global
$prof;
|
|
|
178 |
|
global
$date_for
mat;
|
|
177 |
|
global
$date_for
mat;
|
179 |
|
|
|
178 |
|
|
180 |
|
// val
idate argu
ments
|
|
179 |
|
// val
idate argu
ments
|
181 |
|
$local
TranID = (
int)$local
TranID;
|
|
180 |
|
$local
TranID = (
int)$local
TranID;
|
182 |
|
$recur
ringDays =
(int)$rec
urringDays
;
|
|
181 |
|
$recur
ringDays =
(int)$rec
urringDays
;
|
183 |
|
|
|
182 |
|
|
184 |
|
$tranR
es = db_re
s( "SELECT
DATE_FORM
AT(`Date`,
'$date_f
ormat' ) A
S 'Date',
`Amount`,
`Currency`
, `Status`
, `Data`,
`Descripti
on` FROM `
Transactio
ns`
|
|
183 |
|
$tranR
es = db_re
s( "SELECT
DATE_FORM
AT(`Date`,
'$date_f
ormat' ) A
S 'Date',
`Amount`,
`Currency`
, `Status`
, `Data`,
`Descripti
on` FROM `
Transactio
ns`
|
185 |
|
WH
ERE `ID` =
{$localTr
anID}
|
|
184 |
|
WH
ERE `ID` =
{$localTr
anID}
|
186 |
|
AN
D `Status`
= 'pendin
g'
|
|
185 |
|
AN
D `Status`
= 'pendin
g'
|
187 |
|
AN
D `IDProvi
der` = {$p
roviderCon
f['ID']}"
);
|
|
186 |
|
AN
D `IDProvi
der` = {$p
roviderCon
f['ID']}"
);
|
188 |
|
if ( !
$tranRes |
| mysql_nu
m_rows($tr
anRes) ==
0 )
|
|
187 |
|
if ( !
$tranRes |
| mysql_nu
m_rows($tr
anRes) ==
0 )
|
189 |
|
re
turn false
;
|
|
188 |
|
re
turn false
;
|
190 |
|
$tranA
rr = mysql
_fetch_ass
oc($tranRe
s);
|
|
189 |
|
$tranA
rr = mysql
_fetch_ass
oc($tranRe
s);
|
191 |
|
$tranD
ata = tran
sStringToD
ata( $tran
Arr['Data'
] );
|
|
190 |
|
$tranD
ata = tran
sStringToD
ata( $tran
Arr['Data'
] );
|
192 |
|
|
|
191 |
|
|
193 |
|
$actio
nURL = 'ht
tps://www.
2checkout.
com/2co/bu
yer/purcha
se';
|
|
192 |
|
$actio
nURL = 'ht
tps://www.
2checkout.
com/2co/bu
yer/purcha
se';
|
194 |
|
|
|
193 |
|
|
195 |
|
$formD
ata = arra
y();
|
|
194 |
|
$formD
ata = arra
y();
|
196 |
|
|
|
195 |
|
|
197 |
|
// acc
ount ID
|
|
196 |
|
// acc
ount ID
|
198 |
|
$formD
ata['sid']
= $provid
erConf['Pa
ram_sid'];
|
|
197 |
|
$formD
ata['sid']
= $provid
erConf['Pa
ram_sid'];
|
199 |
|
|
|
198 |
|
|
200 |
|
// tra
nsaction c
ommon data
|
|
199 |
|
// tra
nsaction c
ommon data
|
201 |
|
$formD
ata['cart_
order_id']
= $localT
ranID;
|
|
200 |
|
$formD
ata['cart_
order_id']
= $localT
ranID;
|
202 |
|
$formD
ata['total
'] = sprin
tf( "%.2f"
, (float)$
tranArr['A
mount'] );
|
|
201 |
|
$formD
ata['total
'] = sprin
tf( "%.2f"
, (float)$
tranArr['A
mount'] );
|
203 |
|
$formD
ata['tran_
descriptio
n'] = $tra
nArr['Desc
ription'];
|
|
202 |
|
$formD
ata['tran_
descriptio
n'] = $tra
nArr['Desc
ription'];
|
204 |
|
$formD
ata['pay_m
ethod'] =
$providerC
onf['Param
_pay_metho
d'];
|
|
203 |
|
$formD
ata['pay_m
ethod'] =
$providerC
onf['Param
_pay_metho
d'];
|
205 |
|
$formD
ata['fixed
'] = 'Y';
|
|
204 |
|
$formD
ata['fixed
'] = 'Y';
|
206 |
|
|
|
205 |
|
|
207 |
|
// ret
urn and re
direct
|
|
206 |
|
// ret
urn and re
direct
|
208 |
|
$retur
nURL = ret
urnURLByAc
tion( $tra
nData['act
ion'], $tr
anData['da
ta'] );
|
|
207 |
|
$retur
nURL = ret
urnURLByAc
tion( $tra
nData['act
ion'], $tr
anData['da
ta'] );
|
209 |
|
$formD
ata['retur
n_url'] =
$returnURL
;
|
|
208 |
|
$formD
ata['retur
n_url'] =
$returnURL
;
|
210 |
|
|
|
209 |
|
|
211 |
|
// tes
t mode
|
|
210 |
|
// tes
t mode
|
212 |
|
if ( $
providerCo
nf['Mode']
!= 'live'
)
|
|
211 |
|
if ( $
providerCo
nf['Mode']
!= 'live'
)
|
213 |
|
{
|
|
212 |
|
{
|
214 |
|
$f
ormData['d
emo'] = 'Y
';
|
|
213 |
|
$f
ormData['d
emo'] = 'Y
';
|
215 |
|
}
|
|
214 |
|
}
|
216 |
|
|
|
215 |
|
|
217 |
|
Redire
ct($action
URL, $form
Data, 'pos
t', $provi
derConf['C
aption']);
|
|
216 |
|
Redire
ct($action
URL, $form
Data, 'pos
t', $provi
derConf['C
aption']);
|
218 |
|
exit()
;
|
|
217 |
|
exit()
;
|
219 |
|
}
|
|
218 |
|
}
|
220 |
|
|
|
219 |
|
|
221 |
|
/**
|
|
220 |
|
/**
|
222 |
|
* Perform
s server s
ide call p
ayment pro
cessing
|
|
221 |
|
* Perform
s server s
ide call p
ayment pro
cessing
|
223 |
|
*
|
|
222 |
|
*
|
224 |
|
* @param
bool $subs
cribe
- indicate
s if payme
nt is subc
riptional
payment
|
|
223 |
|
* @param
bool $subs
cribe
- indicate
s if payme
nt is subc
riptional
payment
|
225 |
|
* @param
int $newTr
andID
- if payme
nt subscri
ptional, t
hen $newTr
andID spec
fies
|
|
224 |
|
* @param
int $newTr
andID
- if payme
nt subscri
ptional, t
hen $newTr
andID spec
fies
|
226 |
|
*
new tran
saction ID
created b
y script
|
|
225 |
|
*
new tran
saction ID
created b
y script
|
227 |
|
*
|
|
226 |
|
*
|
228 |
|
* @return
bool
- true if
payment is
successfu
l, false o
therwise
|
|
227 |
|
* @return
bool
- true if
payment is
successfu
l, false o
therwise
|
229 |
|
*
|
|
228 |
|
*
|
230 |
|
*
|
|
229 |
|
*
|
231 |
|
*/
|
|
230 |
|
*/
|
232 |
|
function m
oduleAccep
tPayment(
$subscribe
, $newTran
dID = 0 )
|
|
231 |
|
function m
oduleAccep
tPayment(
$subscribe
, $newTran
dID = 0 )
|
233 |
|
{
|
|
232 |
|
{
|
234 |
|
global
$provider
Conf;
|
|
233 |
|
global
$provider
Conf;
|
235 |
|
|
|
234 |
|
|
236 |
|
$error
Message =
'';
|
|
235 |
|
$error
Message =
'';
|
237 |
|
|
|
236 |
|
|
238 |
|
if ( $
providerCo
nf['Debug'
] )
|
|
237 |
|
if ( $
providerCo
nf['Debug'
] )
|
239 |
|
{
|
|
238 |
|
{
|
240 |
|
wr
iteDebugLo
g( 'Paymen
t event',
'Payment s
tart', fal
se );
|
|
239 |
|
wr
iteDebugLo
g( 'Paymen
t event',
'Payment s
tart', fal
se );
|
241 |
|
}
|
|
240 |
|
}
|
242 |
|
|
|
241 |
|
|
243 |
|
if ( !
isset($_PO
ST['cart_o
rder_id'])
|| !isset
($_POST['o
rder_numbe
r']) )
|
|
242 |
|
if ( !
isset($_PO
ST['cart_o
rder_id'])
|| !isset
($_POST['o
rder_numbe
r']) )
|
244 |
|
{
|
|
243 |
|
{
|
245 |
|
Pr
intErrorPa
ge( _t('_n
o data giv
en') );
|
|
244 |
|
Pr
intErrorPa
ge( _t('_n
o data giv
en') );
|
246 |
|
re
turn false
;
|
|
245 |
|
re
turn false
;
|
247 |
|
}
|
|
246 |
|
}
|
248 |
|
|
|
247 |
|
|
249 |
|
$trans
actionData
= $_POST;
|
|
248 |
|
$trans
actionData
= $_POST;
|
250 |
|
$res =
moduleVal
idateTrans
action( $t
ransaction
Data, $err
orMessage
);
|
|
249 |
|
$res =
moduleVal
idateTrans
action( $t
ransaction
Data, $err
orMessage
);
|
251 |
|
|
|
250 |
|
|
252 |
|
$local
TranID = (
int)$trans
actionData
['cart_ord
er_id'];
|
|
251 |
|
$local
TranID = (
int)$trans
actionData
['cart_ord
er_id'];
|
253 |
|
|
|
252 |
|
|
254 |
|
if ( $
res != 2 )
|
|
253 |
|
if ( $
res != 2 )
|
255 |
|
{
|
|
254 |
|
{
|
256 |
|
fi
nishTransa
ction( $lo
calTranID,
$transact
ionData['o
rder_numbe
r'], $res
== 1 );
|
|
255 |
|
fi
nishTransa
ction( $lo
calTranID,
$transact
ionData['o
rder_numbe
r'], $res
== 1 );
|
257 |
|
}
|
|
256 |
|
}
|
258 |
|
|
|
257 |
|
|
259 |
|
if ( $
res == 1 )
|
|
258 |
|
if ( $
res == 1 )
|
260 |
|
{
|
|
259 |
|
{
|
261 |
|
$p
urchaseRes
= purchas
eTransacti
on( $local
TranID, $r
es );
|
|
260 |
|
$p
urchaseRes
= purchas
eTransacti
on( $local
TranID, $r
es );
|
262 |
|
if
( !$purch
aseRes )
|
|
261 |
|
if
( !$purch
aseRes )
|
263 |
|
{
|
|
262 |
|
{
|
264 |
|
$errorMe
ssage = 'P
urchase fa
iled';
|
|
263 |
|
$errorMe
ssage = 'P
urchase fa
iled';
|
265 |
|
$res = 0
;
|
|
264 |
|
$res = 0
;
|
266 |
|
}
|
|
265 |
|
}
|
267 |
|
}
|
|
266 |
|
}
|
268 |
|
|
|
267 |
|
|
269 |
|
proces
sValidatio
nResult( $
res, $erro
rMessage,
$localTran
ID );
|
|
268 |
|
proces
sValidatio
nResult( $
res, $erro
rMessage,
$localTran
ID );
|
270 |
|
return
( $res ==
1 );
|
|
269 |
|
return
( $res ==
1 );
|
271 |
|
}
|
|
270 |
|
}
|
272 |
|
|
|
271 |
|
|
273 |
|
|
|
272 |
|
|
274 |
|
|
|
273 |
|
|
275 |
|
if ( !defi
ned('PAYME
NT_MODULE_
AS_HEADER'
) )
|
|
274 |
|
if ( !defi
ned('PAYME
NT_MODULE_
AS_HEADER'
) )
|
276 |
|
{
|
|
275 |
|
{
|
277 |
|
$valid
ateRes = m
oduleValid
ateConfigu
ration( $e
rrorMessag
e );
|
|
276 |
|
$valid
ateRes = m
oduleValid
ateConfigu
ration( $e
rrorMessag
e );
|
278 |
|
if ( !
$validateR
es )
|
|
277 |
|
if ( !
$validateR
es )
|
279 |
|
{
|
|
278 |
|
{
|
280 |
|
Pr
intErrorPa
ge( $error
Message );
|
|
279 |
|
Pr
intErrorPa
ge( $error
Message );
|
281 |
|
ex
it();
|
|
280 |
|
ex
it();
|
282 |
|
}
|
|
281 |
|
}
|
283 |
|
|
|
282 |
|
|
284 |
|
if ( $
providerCo
nf['Debug'
] )
|
|
283 |
|
if ( $
providerCo
nf['Debug'
] )
|
285 |
|
{
|
|
284 |
|
{
|
286 |
|
wr
iteDebugLo
g( '2Check
out checko
ut externa
l call', '
----------
----', tru
e );
|
|
285 |
|
wr
iteDebugLo
g( '2Check
out checko
ut externa
l call', '
----------
----', tru
e );
|
287 |
|
wr
iteDebugLo
g( 'Conf',
$provider
Conf, fals
e );
|
|
286 |
|
wr
iteDebugLo
g( 'Conf',
$provider
Conf, fals
e );
|
288 |
|
wr
iteDebugLo
g( 'GET',
$_GET, fal
se );
|
|
287 |
|
wr
iteDebugLo
g( 'GET',
$_GET, fal
se );
|
289 |
|
wr
iteDebugLo
g( 'POST',
$_POST, f
alse );
|
|
288 |
|
wr
iteDebugLo
g( 'POST',
$_POST, f
alse );
|
290 |
|
}
|
|
289 |
|
}
|
291 |
|
|
|
290 |
|
|
292 |
|
module
AcceptPaym
ent( false
);
|
|
291 |
|
module
AcceptPaym
ent( false
);
|
293 |
|
}
|
|
292 |
|
}
|
294 |
|
|
|
293 |
|
|
295 |
|
?>
|
|
294 |
|
?>
|