| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::Giropay::Notification; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::Giropay::Notification - payment notification object |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
10
|
1
|
|
|
1
|
|
3
|
use Digest::HMAC_MD5 'hmac_md5_hex'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
32
|
|
|
11
|
1
|
|
|
1
|
|
3
|
use Business::Giropay::Types qw/Int Str/; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
4
|
|
|
12
|
1
|
|
|
1
|
|
328
|
use Moo; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
4
|
|
|
13
|
|
|
|
|
|
|
with 'Business::Giropay::Role::Core'; |
|
14
|
1
|
|
|
1
|
|
225
|
use namespace::clean; |
|
|
1
|
|
|
|
|
13
|
|
|
|
1
|
|
|
|
|
4
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# see http://api.girocheckout.de/en:girocheckout:resultcodes |
|
17
|
|
|
|
|
|
|
my %messages = ( |
|
18
|
|
|
|
|
|
|
4000 => 'transaction successful', |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# giropay |
|
21
|
|
|
|
|
|
|
4001 => 'bank offline', |
|
22
|
|
|
|
|
|
|
4002 => 'online banking account invalid', |
|
23
|
|
|
|
|
|
|
4500 => 'Zahlungsaugang unbekannt', |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Lastschrift |
|
26
|
|
|
|
|
|
|
4051 => 'invalid bank account', |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Kreditkarte |
|
29
|
|
|
|
|
|
|
4101 => 'issuing country invalid or unknown', |
|
30
|
|
|
|
|
|
|
4102 => '3D-Secure or MasterCard SecureCode authorization failed', |
|
31
|
|
|
|
|
|
|
4103 => 'validation date of card exceeded', |
|
32
|
|
|
|
|
|
|
4104 => 'invalid or unknown card type', |
|
33
|
|
|
|
|
|
|
4105 => 'limited-use card', |
|
34
|
|
|
|
|
|
|
4106 => 'invalid pseudo-cardnumber', |
|
35
|
|
|
|
|
|
|
4107 => 'card stolen, suspicious or marked to move in', |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# PayPal |
|
38
|
|
|
|
|
|
|
4151 => 'invalid PayPal token', |
|
39
|
|
|
|
|
|
|
4152 => 'post-processing necessary at PayPal', |
|
40
|
|
|
|
|
|
|
4153 => 'change PayPal payment method', |
|
41
|
|
|
|
|
|
|
4154 => 'PayPal-payment is not completed', |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Allgemein |
|
44
|
|
|
|
|
|
|
4501 => 'timeout / no user input', |
|
45
|
|
|
|
|
|
|
4502 => 'user aborted', |
|
46
|
|
|
|
|
|
|
4503 => 'duplicate transaction', |
|
47
|
|
|
|
|
|
|
4504 => 'suspicion of manipulation or payment method temporarily blocked', |
|
48
|
|
|
|
|
|
|
4505 => 'payment method blocked or rejected', |
|
49
|
|
|
|
|
|
|
4900 => 'transaction rejected ', |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Age verification (giropay) |
|
52
|
|
|
|
|
|
|
4020 => 'age verification successful', |
|
53
|
|
|
|
|
|
|
4021 => 'age verification not possible', |
|
54
|
|
|
|
|
|
|
4022 => 'age verification unsuccessful', |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 reference |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Unique GiroCheckout transaction ID. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Should match L |
|
64
|
|
|
|
|
|
|
from an earlier request. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
has reference => ( |
|
69
|
|
|
|
|
|
|
is => 'ro', |
|
70
|
|
|
|
|
|
|
isa => Str, |
|
71
|
|
|
|
|
|
|
required => 1, |
|
72
|
|
|
|
|
|
|
init_arg => 'gcReference', |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 merchantTxId |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Merchant transaction ID. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Should match L |
|
80
|
|
|
|
|
|
|
from an earlier request. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
has merchantTxId => ( |
|
85
|
|
|
|
|
|
|
is => 'ro', |
|
86
|
|
|
|
|
|
|
isa => Str, |
|
87
|
|
|
|
|
|
|
required => 1, |
|
88
|
|
|
|
|
|
|
init_arg => 'gcMerchantTxId', |
|
89
|
|
|
|
|
|
|
); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 backendTxId |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Payment processor transaction ID. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
has backendTxId => ( |
|
98
|
|
|
|
|
|
|
is => 'ro', |
|
99
|
|
|
|
|
|
|
isa => Str, |
|
100
|
|
|
|
|
|
|
required => 1, |
|
101
|
|
|
|
|
|
|
init_arg => 'gcBackendTxId', |
|
102
|
|
|
|
|
|
|
); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 amount |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
If a decimal currency is used, the amount has to be in the smallest unit of |
|
107
|
|
|
|
|
|
|
value, eg. cent, penny. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
has amount => ( |
|
112
|
|
|
|
|
|
|
is => 'ro', |
|
113
|
|
|
|
|
|
|
isa => Int, |
|
114
|
|
|
|
|
|
|
required => 1, |
|
115
|
|
|
|
|
|
|
init_arg => 'gcAmount', |
|
116
|
|
|
|
|
|
|
); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 currency |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Three letter currency code. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
has currency => ( |
|
125
|
|
|
|
|
|
|
is => 'ro', |
|
126
|
|
|
|
|
|
|
isa => Str, |
|
127
|
|
|
|
|
|
|
required => 1, |
|
128
|
|
|
|
|
|
|
init_arg => 'gcCurrency', |
|
129
|
|
|
|
|
|
|
); |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 resultPayment |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Payment result code. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
has resultPayment => ( |
|
138
|
|
|
|
|
|
|
is => 'ro', |
|
139
|
|
|
|
|
|
|
isa => Int, |
|
140
|
|
|
|
|
|
|
required => 1, |
|
141
|
|
|
|
|
|
|
init_arg => 'gcResultPayment', |
|
142
|
|
|
|
|
|
|
); |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 message |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
The descriptive message for L. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
has message => ( |
|
151
|
|
|
|
|
|
|
is => 'ro', |
|
152
|
|
|
|
|
|
|
lazy => 1, |
|
153
|
|
|
|
|
|
|
default => sub { $messages{ $_[0]->resultPayment } || '' }, |
|
154
|
|
|
|
|
|
|
); |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 hash |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Payment result code. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
has hash => ( |
|
163
|
|
|
|
|
|
|
is => 'ro', |
|
164
|
|
|
|
|
|
|
isa => Str, |
|
165
|
|
|
|
|
|
|
required => 1, |
|
166
|
|
|
|
|
|
|
init_arg => 'gcHash', |
|
167
|
|
|
|
|
|
|
); |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 METHODS |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 BUILD |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Check that the hash matches what we expect. Die on mismatch |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub BUILD { |
|
178
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
179
|
|
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
my $verify = hmac_md5_hex( |
|
181
|
|
|
|
|
|
|
join( '', |
|
182
|
|
|
|
|
|
|
$self->reference, $self->merchantTxId, $self->backendTxId, |
|
183
|
|
|
|
|
|
|
$self->amount, $self->currency, $self->resultPayment ), |
|
184
|
|
|
|
|
|
|
$self->secret |
|
185
|
|
|
|
|
|
|
); |
|
186
|
|
|
|
|
|
|
|
|
187
|
0
|
0
|
|
|
|
|
croak( |
|
188
|
|
|
|
|
|
|
"Returned HMAC hash ", $self->hash, |
|
189
|
|
|
|
|
|
|
" does not match expected hash ", $verify |
|
190
|
|
|
|
|
|
|
) unless $verify eq $self->hash; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
1; |