3.03
[Business-OnlinePayment.git] / notes_for_module_writers_v3
1 These are the module writer's notes for v3.  See the regular
2 "notes_for_module_writers" file first.
3
4
5 - If your gateway is HTTPS-based, use (or convert to)
6   Business::OnlinePayment::HTTPS !!
7   Note: The correct thing for modern B:OP: gateway modules that need to
8    speak HTTPS to do is to use Business::OnlinePayment::HTTPS and depend on
9    "Net::HTTPS::Any" (since B:OP itself doesn't).
10
11
12 - Handling failures:
13
14     - If your processor module encounters a setup problem, communication
15       error or other problem that's prevents the card from even being
16       run, you should die (or croak) with a useful error message.  Setting
17       is_success to 0 and returning normally should only be done when the
18       transaction *processing* was sucessful (or at least elicited some sort
19       of result from the gateway), but the transaction itself returned a
20       "normal" decline status of some sort.
21       
22     - (NEW IN 3.00_04) You should set "failure_status" depending on the
23       specific failure result, if (and only if) the failure results from one
24       of the defined statuses:
25
26       - "expired"
27       - "nsf" (non-sufficient funds / credit limit)
28       - "stolen"
29       - "pickup"
30       - "blacklisted"
31       - "inactive" (inactive card or not authorized for card-not-present) (?)
32       - "decline" (other card/transaction declines only, not other errors)
33   
34       You should use code like this so your module can work with B:OP versions
35       before 3.00_04:
36
37         $self->build_subs('failure_status') unless $self->can('failure_status');
38
39       (or add "failure_status" to your build_subs call if you have one during
40       initialization)
41
42
43 - (NEW IN 3.01) Introspection:
44
45   - Add an _info subroutine to your module that returns a hashref of
46     information:
47
48       sub _info {
49         {
50           'info_compat'           => '0.01', # always 0.01 for now,
51                                              # 0.02 will have requirements
52           'gateway_name'          => 'Example Gateway',
53           'gateway_url'           => 'http://www.example.com/',
54           'module_version'        => $VERSION,
55           'supported_types'       => [ qw( CC ECHECK ) ],
56           'token_support'         => 0, #card storage/tokenization support
57           'test_transaction'      => 0, #set true if ->test_transaction(1) works
58           'supported_actions'     => [
59                                        'Normal Authorization',
60                                        'Authorization Only',
61                                        'Post Authorization',
62                                        'Void',
63                                        'Credit',
64                                      ],
65         };
66       }
67
68     # or a more complicated case:
69
70       sub _info {
71         {
72           'info_compat'           => '0.01', # always 0.01 for now,
73                                              # 0.02 will have requirements
74           'gateway_name'          => 'Example Gateway',
75           'gateway_url'           => 'http://www.example.com/',
76           'module_version'        => $VERSION,
77           'module_notes'          => 'usage notes',
78           'supported_types'       => [ qw( CC ECHECK ) ],
79           'token_support'         => 1,
80           'test_transaction'      => 1,
81           'supported_actions'     => { 'CC' => [
82                                          'Normal Authorization',
83                                          'Authorization Only',
84                                          'Post Authorization',
85                                          'Void',
86                                          'Credit',
87                                          'Recurring Authorization',
88                                          'Modify Recurring Authorization',
89                                          'Cancel Recurring Authorization',
90                                        ],
91                                        'ECHECK' => [
92                                          'Normal Authorization',
93                                          'Void',
94                                          'Credit',
95                                        ],
96                                      },
97           'CC_void_requires_card' => 1,
98           'ECHECK_void_requires_account' => 1, #routing_code, account_number, name 
99         };
100       }
101
102
103 - authorization and order_number (NEWLY DOCUMENTED IN 3.01):
104
105   Gateways will return one or two values from Authorization Only and
106   Normal Authorization transactions that must be submitted back with a
107   Post Authorization, Void, or Credit transaction.
108
109   If the gateway returns one value, return this as "authorization"
110
111   If the gateway returns two values, return one as "authorization" and the
112   other as "order_number".  Typically "authorization" is the more low-level
113   value returned from the underlying processing network while "order_number"
114   is a unique tranaction id generated by the gateway.
115