Schema/Result/PaymentOrder.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 28 / 28 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Schema/Result/OrderlinesShipping.pm ↑ Summary Schema/Result/Permission.pm »
1 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Interchange6::Schema::Result::PaymentOrder;
4  
5 =head1 NAME
6  
7 Interchange6::Schema::Result::PaymentOrder
8  
9 =cut
10  
11 2 use Interchange6::Schema::Candy -components =>
12 2 ▶ [qw(InflateColumn::DateTime TimeStamp)];
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =head1 DESCRIPTION
15  
16 The C<payment_sessions_id> is used to store the session id provided by the gateway.
17 For example, with L<Business::OnlinePayment::IPayment> you put the session id into
18 the HTML form for the silent CGI mode.
19  
20 The C<sessions_id> is used here so we can track down payments without orders.
21 We usually turn a guest user into a real user after confirmation of a successful payment,
22 so we need the session information here in the case the payment is made but
23 the confirmation didn't reach the online shop.
24  
25 =head1 ACCESSORS
26  
27 =head2 payment_orders_id
28  
29 Primary key.
30  
31 =cut
32  
33 2 primary_column payment_orders_id => {
34 data_type => "integer",
35 is_auto_increment => 1,
36 sequence => "payment_orders_payment_orders_id_seq",
37 };
38  
39 =head2 payment_mode
40  
41 Payment mode, e.g.: PayPal.
42  
43 Defaults to empty string.
44  
45 =cut
46  
47 2 column payment_mode =>
48 { data_type => "varchar", default_value => "", size => 32 };
49  
50 =head2 payment_action
51  
52 Payment action, e.g.: charge.
53  
54 Defaults to empty string.
55  
56 =cut
57  
58 2 column payment_action =>
59 { data_type => "varchar", default_value => "", size => 32 };
60  
61 =head2 payment_id
62  
63 Payment ID.
64  
65 Defaults to empty string.
66  
67 =cut
68  
69 2 column payment_id =>
70 { data_type => "varchar", default_value => "", size => 32 };
71  
72 =head2 auth_code
73  
74 Payment auth code.
75  
76 Defaults to empty string.
77  
78 =cut
79  
80 2 column auth_code => {
81 data_type => "varchar",
82 default_value => "",
83 size => 255
84 };
85  
86 =head2 users_id
87  
88 FK on L<Interchange6::Schema::Result::User/users_id>.
89  
90 Is nullable.
91  
92 =cut
93  
94 2 column users_id =>
95 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 };
96  
97 =head2 sessions_id
98  
99 FK on L<Interchange6::Schema::Result::Session/sessions_id>.
100  
101 Is nullable.
102  
103 =cut
104  
105 2 column sessions_id => {
106 data_type => "varchar",
107 is_foreign_key => 1,
108 is_nullable => 1,
109 size => 255
110 };
111  
112 =head2 orders_id
113  
114 FK on L<Interchange6::Schema::Result::Order/orders_id>.
115  
116 Is nullable.
117  
118 =cut
119  
120 2 column orders_id =>
121 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 };
122  
123 =head2 amount
124  
125 Amount of payment.
126  
127 =cut
128  
129 2 column amount => {
130 data_type => "numeric",
131 default_value => "0.0",
132 size => [ 11, 2 ],
133 };
134  
135 =head2 status
136  
137 Status of this payment.
138  
139 Defaults to empty string.
140  
141 =cut
142  
143 2 column status =>
144 { data_type => "varchar", default_value => "", size => 32 };
145  
146 =head2 payment_sessions_id
147  
148 FK on L<Interchange::Schema::Result::Session/sessions_id>.
149  
150 =cut
151  
152 2 column payment_sessions_id => {
153 data_type => "varchar",
154 default_value => "",
155 size => 255
156 };
157  
158 =head2 payment_error_code
159  
160 Error message returned from payment gateway.
161  
162 Defaults to empty string.
163  
164 =cut
165  
166 2 column payment_error_code =>
167 { data_type => "varchar", default_value => "", size => 32 };
168  
169 =head2 payment_error_message
170  
171 Error message returned from payment gateway.
172  
173 Is nullable.
174  
175 =cut
176  
177 2 column payment_error_message => { data_type => "text", is_nullable => 1 };
178  
179 =head2 payment_fee
180  
181 Some gateways (notably PayPal) charge a fee for each transaction. This
182 column should be used to store the transaction fee (if any).
183  
184 =cut
185  
186 2 column payment_fee => {
187 data_type => "numeric",
188 default_value => "0.0",
189 size => [ 11, 2 ],
190 };
191  
192 =head2 created
193  
194 Date and time when this record was created returned as L<DateTime> object.
195 Value is auto-set on insert.
196  
197 =cut
198  
199 2 column created =>
200 { data_type => "datetime", set_on_create => 1 };
201  
202 =head2 last_modified
203  
204 Date and time when this record was last modified returned as L<DateTime> object.
205 Value is auto-set on insert and update.
206  
207 =cut
208  
209 2 column last_modified => {
210 data_type => "datetime",
211 set_on_create => 1,
212 set_on_update => 1,
213 };
214  
215 =head1 RELATIONS
216  
217 =head2 order
218  
219 Type: belongs_to
220  
221 Related object: L<Interchange6::Schema::Result::Order>
222  
223 =cut
224  
225 2 belongs_to
226 order => "Interchange6::Schema::Result::Order",
227 "orders_id",
228 {
229 is_deferrable => 1,
230 on_delete => "CASCADE",
231 on_update => "CASCADE",
232 join_type => "left"
233 };
234  
235 =head2 user
236  
237 Type: belongs_to
238  
239 Related object: L<Interchange6::Schema::Result::User>
240  
241 =cut
242  
243 2 belongs_to
244 user => "Interchange6::Schema::Result::User",
245 "users_id",
246 {
247 is_deferrable => 1,
248 on_delete => "CASCADE",
249 on_update => "CASCADE",
250 join_type => "left"
251 };
252  
253 =head2 session
254  
255 Type: belongs_to
256  
257 Related object: L<Interchange6::Schema::Result::Session>
258  
259 =cut
260  
261 2 belongs_to
262 session => "Interchange6::Schema::Result::Session",
263 "sessions_id",
264 { join_type => 'left', on_delete => 'SET NULL' };
265  
266 2 1;
« Schema/Result/OrderlinesShipping.pm ↑ Summary Schema/Result/Permission.pm »