| 1 | package Business::Giropay; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Business::Giropay - Giropay payments API | ||
| 6 | |||
| 7 | =head1 VERSION | ||
| 8 | |||
| 9 | Version 0.103 | ||
| 10 | |||
| 11 | =cut | ||
| 12 | |||
| 13 | 1 | our $VERSION = '0.103'; | |
| 14 | |||
| 15 | 1 | ▶ | use Business::Giropay::Request::Bankstatus; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | use Business::Giropay::Request::Issuer; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 1 | ▶ | use Business::Giropay::Request::Status; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | 1 | ▶ | use Business::Giropay::Request::Transaction; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 1 | ▶ | use Business::Giropay::Notification; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | 1 | with 'Business::Giropay::Role::Core', 'Business::Giropay::Role::Network', | |
| 23 | 'Business::Giropay::Role::Urls'; | ||
| 24 | 1 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | |||
| 26 | 0 | ▶ | sub bankstatus { |
|
Subroutine
bankstatus: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 27 | 0 | my ( $self, @args ) = @_; | |
| 28 | 0 | my $request = Business::Giropay::Request::Bankstatus->new( | |
| 29 | network => $self->network, | ||
| 30 | merchantId => $self->merchantId, | ||
| 31 | projectId => $self->projectId, | ||
| 32 | sandbox => $self->sandbox, | ||
| 33 | secret => $self->secret, | ||
| 34 | @args, | ||
| 35 | ); | ||
| 36 | 0 | return $request->submit; | |
| 37 | } | ||
| 38 | |||
| 39 | 0 | ▶ | sub issuer { |
|
Subroutine
issuer: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | 0 | my $self = shift; | |
| 41 | 0 | my $request = Business::Giropay::Request::Issuer->new( | |
| 42 | network => $self->network, | ||
| 43 | merchantId => $self->merchantId, | ||
| 44 | projectId => $self->projectId, | ||
| 45 | sandbox => $self->sandbox, | ||
| 46 | secret => $self->secret, | ||
| 47 | ); | ||
| 48 | 0 | return $request->submit; | |
| 49 | } | ||
| 50 | |||
| 51 | 0 | ▶ | sub status { |
|
Subroutine
status: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 52 | 0 | my ( $self, @args ) = @_; | |
| 53 | 0 | my $request = Business::Giropay::Request::Status->new( | |
| 54 | network => $self->network, | ||
| 55 | merchantId => $self->merchantId, | ||
| 56 | projectId => $self->projectId, | ||
| 57 | secret => $self->secret, | ||
| 58 | @args, | ||
| 59 | ); | ||
| 60 | 0 | return $request->submit; | |
| 61 | } | ||
| 62 | |||
| 63 | 0 | ▶ | sub transaction { |
|
Subroutine
transaction: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 64 | 0 | my ( $self, @args ) = @_; | |
| 65 | 0 | my $request = Business::Giropay::Request::Transaction->new( | |
| 66 | network => $self->network, | ||
| 67 | merchantId => $self->merchantId, | ||
| 68 | projectId => $self->projectId, | ||
| 69 | sandbox => $self->sandbox, | ||
| 70 | secret => $self->secret, | ||
| 71 | urlRedirect => $self->urlRedirect, | ||
| 72 | urlNotify => $self->urlNotify, | ||
| 73 | @args, | ||
| 74 | ); | ||
| 75 | 0 | return $request->submit; | |
| 76 | } | ||
| 77 | |||
| 78 | 0 | ▶ | sub notification { |
|
Subroutine
notification: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 79 | 0 | my ( $self, @args ) = @_; | |
| 80 | 0 | return Business::Giropay::Notification->new( | |
| 81 | merchantId => $self->merchantId, | ||
| 82 | projectId => $self->projectId, | ||
| 83 | secret => $self->secret, | ||
| 84 | @args, | ||
| 85 | ); | ||
| 86 | } | ||
| 87 | |||
| 88 | =head1 DESCRIPTION | ||
| 89 | |||
| 90 | B<Business::Giropay> implement's Giropay's GiroCheckout API to make direct | ||
| 91 | calls to Giropay's payments server. | ||
| 92 | |||
| 93 | Giropay facilitates payments via various provider networks in addition to | ||
| 94 | their own. This module currently supports the following networks: | ||
| 95 | |||
| 96 | =over | ||
| 97 | |||
| 98 | =item eps - EPS (Austria) | ||
| 99 | |||
| 100 | =item giropay - Giropay's own network (Germany) | ||
| 101 | |||
| 102 | =item ideal - iDEAL (The Netherlands) | ||
| 103 | |||
| 104 | =back | ||
| 105 | |||
| 106 | Contributions to allow this module to support other networks available via | ||
| 107 | Giropay are most welcome. | ||
| 108 | |||
| 109 | =head1 SYNOPSIS | ||
| 110 | |||
| 111 | use Business::Giropay; | ||
| 112 | |||
| 113 | my $giropay = Business::Giropay->new( | ||
| 114 | network => 'giropay', | ||
| 115 | merchantId => '123456789', | ||
| 116 | projectId => '1234567', | ||
| 117 | sandbox => 1, | ||
| 118 | secret => 'project_secret', | ||
| 119 | ); | ||
| 120 | |||
| 121 | my $response = $giropay->transaction( | ||
| 122 | merchantTxId => 'tx-10928374', | ||
| 123 | amount => 2938, # 29.38 in cents | ||
| 124 | currency => 'EUR', | ||
| 125 | purpose => 'Test Transaction', | ||
| 126 | bic => 'TESTDETT421', | ||
| 127 | urlRedirect => 'https://www.example.com/return_page', | ||
| 128 | urlNotify => 'https://www.example.com/api/giropay/notify', | ||
| 129 | ); | ||
| 130 | |||
| 131 | if ( $response->success ) { | ||
| 132 | # all is good so redirect customer to GiroCheckout | ||
| 133 | } | ||
| 134 | else { | ||
| 135 | # transaction request failed | ||
| 136 | } | ||
| 137 | |||
| 138 | C<urlRedirect> and C<urlNotify> can also be passed to C<new>: | ||
| 139 | |||
| 140 | use Business::Giropay; | ||
| 141 | |||
| 142 | my $giropay = Business::Giropay->new( | ||
| 143 | network => 'giropay', | ||
| 144 | merchantId => '123456789', | ||
| 145 | projectId => '1234567', | ||
| 146 | urlRedirect => 'https://www.example.com/return_page', | ||
| 147 | urlNotify => 'https://www.example.com/api/giropay/notify', | ||
| 148 | sandbox => 1, | ||
| 149 | secret => 'project_secret', | ||
| 150 | ); | ||
| 151 | |||
| 152 | my $response = $giropay->transaction( | ||
| 153 | merchantTxId => 'tx-10928374', | ||
| 154 | amount => 2938, # 29.38 in cents | ||
| 155 | currency => 'EUR', | ||
| 156 | purpose => 'Test Transaction', | ||
| 157 | bic => 'TESTDETT421', | ||
| 158 | ); | ||
| 159 | |||
| 160 | if ( $response->success ) { | ||
| 161 | # all is good so redirect customer to GiroCheckout | ||
| 162 | } | ||
| 163 | else { | ||
| 164 | # transaction request failed | ||
| 165 | } | ||
| 166 | |||
| 167 | |||
| 168 | Elsewhere in your C<urlNotify> route: | ||
| 169 | |||
| 170 | my $notification = $giropay->notification( %request_params ); | ||
| 171 | |||
| 172 | if ( $notification->success ) { | ||
| 173 | # save stuff in DB - customer probably still on bank site | ||
| 174 | } | ||
| 175 | else { | ||
| 176 | # bad stuff happened - make a note of it | ||
| 177 | } | ||
| 178 | |||
| 179 | And in the C<urlRedirect> route: | ||
| 180 | |||
| 181 | my $notification = $giropay->notification( %request_params ); | ||
| 182 | |||
| 183 | if ( $notification->success ) { | ||
| 184 | # we should already have earlier notification but check anyway | ||
| 185 | # in case customer came back before we received it then thank | ||
| 186 | # customer for purchase | ||
| 187 | } | ||
| 188 | else { | ||
| 189 | # bad stuff - check out the details and tell the customer | ||
| 190 | } | ||
| 191 | |||
| 192 | |||
| 193 | =head1 ATTRIBUTES | ||
| 194 | |||
| 195 | See L<Business::Giropay::Role::Core/ATTRIBUTES> for full details of the | ||
| 196 | following attributes that can be passed to C<new>. | ||
| 197 | |||
| 198 | =over | ||
| 199 | |||
| 200 | =item * network | ||
| 201 | |||
| 202 | =item * merchantId | ||
| 203 | |||
| 204 | =item * projectId | ||
| 205 | |||
| 206 | =item * sandbox | ||
| 207 | |||
| 208 | =item * secret | ||
| 209 | |||
| 210 | =back | ||
| 211 | |||
| 212 | See L<Business::Giropay::Role::Urls/ATTRIBUTES> for full details of the | ||
| 213 | following attributes that can be passed to C<new>. | ||
| 214 | |||
| 215 | =over | ||
| 216 | |||
| 217 | =item * urlRedirect | ||
| 218 | |||
| 219 | =item * urlNotify | ||
| 220 | |||
| 221 | =back | ||
| 222 | |||
| 223 | =head1 METHODS | ||
| 224 | |||
| 225 | B<NOTE:> it is not necessary to pass in any attributes that were already | ||
| 226 | passed to C<new> since they are passed through automatically. | ||
| 227 | |||
| 228 | =head2 bankstatus %attributes | ||
| 229 | |||
| 230 | This API call checks if a bank supports the giropay/eps payment method. | ||
| 231 | |||
| 232 | Returns a L<Business::Giropay::Response::Bankstatus> object. | ||
| 233 | |||
| 234 | See L<Business::Giropay::Request::Bankstatus/ATTRIBUTES> for full details of | ||
| 235 | the following attribute that can be passed to this method: | ||
| 236 | |||
| 237 | =over | ||
| 238 | |||
| 239 | =item * bic | ||
| 240 | |||
| 241 | =back | ||
| 242 | |||
| 243 | =head2 issuer | ||
| 244 | |||
| 245 | Returns a L<Business::Giropay::Response::Issuer> object which includes a | ||
| 246 | list which contains all supported giropay/eps/ideal issuer banks. | ||
| 247 | |||
| 248 | =head2 transaction %attributes | ||
| 249 | |||
| 250 | This API call creates the start of a transaction and returns a | ||
| 251 | L<Business::Giropay::Response::Transaction> object. If the response indicates | ||
| 252 | success then customer can be redirected to | ||
| 253 | L<Business::Giropay::Response::Transaction/redirect> to complete payment. | ||
| 254 | |||
| 255 | Returns a L<Business::Giropay::Response::Transaction> object. | ||
| 256 | |||
| 257 | See L<Business::Giropay::Request::Transaction/ATTRIBUTES> for full details of | ||
| 258 | the following attributes that can be passed to this method: | ||
| 259 | |||
| 260 | =over | ||
| 261 | |||
| 262 | =item * merchantTxId | ||
| 263 | |||
| 264 | =item * amount | ||
| 265 | |||
| 266 | =item * currency | ||
| 267 | |||
| 268 | =item * purpose | ||
| 269 | |||
| 270 | =item * bic | ||
| 271 | |||
| 272 | =item * urlRedirect | ||
| 273 | |||
| 274 | =item * urlNotify | ||
| 275 | |||
| 276 | =back | ||
| 277 | |||
| 278 | =head2 notification %query_params | ||
| 279 | |||
| 280 | Accepts query parameters and returns a L<Business::Giropay::Notification> | ||
| 281 | object. | ||
| 282 | |||
| 283 | =head2 status %attributes | ||
| 284 | |||
| 285 | Returns a L<Business::Giropay::Response::Status> object with details of | ||
| 286 | the requested transaction. | ||
| 287 | |||
| 288 | See L<Business::Giropay::Request::Status/ATTRIBUTES> for full details of | ||
| 289 | the following attribute that can be passed to this method: | ||
| 290 | |||
| 291 | =over | ||
| 292 | |||
| 293 | =item * reference | ||
| 294 | |||
| 295 | =back | ||
| 296 | |||
| 297 | =head1 SEE ALSO | ||
| 298 | |||
| 299 | L<GiroCheckout API|http://api.girocheckout.de/en:start> which has links for | ||
| 300 | the various payment network types (giropay, eps, etc). For L</status> see | ||
| 301 | L<http://api.girocheckout.de/en:tools:transaction_status>. | ||
| 302 | |||
| 303 | =head1 TODO | ||
| 304 | |||
| 305 | Add more of Giropay's payment networks. | ||
| 306 | |||
| 307 | =head1 AUTHOR | ||
| 308 | |||
| 309 | Peter Mottram (SysPete) <peter@sysnix.com> | ||
| 310 | |||
| 311 | =head1 CONTRIBUTORS | ||
| 312 | |||
| 313 | Alexandr Ciornii (chorny) | ||
| 314 | |||
| 315 | =head1 ACKNOWLEDGEMENTS | ||
| 316 | |||
| 317 | Many thanks to L<CALEVO Equestrian|https://www.calevo.com/> for sponsoring | ||
| 318 | development of this module. | ||
| 319 | |||
| 320 | =head1 LICENSE AND COPYRIGHT | ||
| 321 | |||
| 322 | Copyright 2016 Peter Mottram (SysPete) <peter@sysnix.com> | ||
| 323 | |||
| 324 | This program is free software; you can redistribute it and/or modify it | ||
| 325 | under the terms of Perl itself. | ||
| 326 | |||
| 327 | =cut | ||
| 328 | |||
| 329 | 1 | 1; | |