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/Orderline.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_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_nullable => 1,
108 size => 255
109 };
110  
111 =head2 orders_id
112  
113 FK on L<Interchange6::Schema::Result::Order/orders_id>.
114  
115 Is nullable.
116  
117 =cut
118  
119 2 column orders_id =>
120 { data_type => "integer", is_nullable => 1 };
121  
122 =head2 amount
123  
124 Amount of payment.
125  
126 Defaults to 0.
127  
128 =cut
129  
130 2 column amount => {
131 data_type => "numeric",
132 default_value => 0,
133 size => [ 21, 3 ],
134 };
135  
136 =head2 status
137  
138 Status of this payment.
139  
140 Defaults to empty string.
141  
142 =cut
143  
144 2 column status =>
145 { data_type => "varchar", default_value => "", size => 32 };
146  
147 =head2 payment_sessions_id
148  
149 FK on L<Interchange::Schema::Result::Session/sessions_id>.
150  
151 =cut
152  
153 2 column payment_sessions_id => {
154 data_type => "varchar",
155 default_value => "",
156 size => 255
157 };
158  
159 =head2 payment_error_code
160  
161 Error message returned from payment gateway.
162  
163 Defaults to empty string.
164  
165 =cut
166  
167 2 column payment_error_code =>
168 { data_type => "varchar", default_value => "", size => 32 };
169  
170 =head2 payment_error_message
171  
172 Error message returned from payment gateway.
173  
174 Is nullable.
175  
176 =cut
177  
178 2 column payment_error_message => { data_type => "text", is_nullable => 1 };
179  
180 =head2 payment_fee
181  
182 Some gateways (notably PayPal) charge a fee for each transaction. This
183 column should be used to store the transaction fee (if any).
184  
185 =cut
186  
187 2 column payment_fee => {
188 data_type => "numeric",
189 default_value => 0,
190 size => [ 12, 3 ],
191 };
192  
193 =head2 created
194  
195 Date and time when this record was created returned as L<DateTime> object.
196 Value is auto-set on insert.
197  
198 =cut
199  
200 2 column created =>
201 { data_type => "datetime", set_on_create => 1 };
202  
203 =head2 last_modified
204  
205 Date and time when this record was last modified returned as L<DateTime> object.
206 Value is auto-set on insert and update.
207  
208 =cut
209  
210 2 column last_modified => {
211 data_type => "datetime",
212 set_on_create => 1,
213 set_on_update => 1,
214 };
215  
216 =head1 RELATIONS
217  
218 =head2 order
219  
220 Type: belongs_to
221  
222 Related object: L<Interchange6::Schema::Result::Order>
223  
224 =cut
225  
226 2 belongs_to
227 order => "Interchange6::Schema::Result::Order",
228 "orders_id",
229 {
230 is_deferrable => 1,
231 on_delete => "CASCADE",
232 on_update => "CASCADE",
233 join_type => "left"
234 };
235  
236 =head2 user
237  
238 Type: belongs_to
239  
240 Related object: L<Interchange6::Schema::Result::User>
241  
242 =cut
243  
244 2 belongs_to
245 user => "Interchange6::Schema::Result::User",
246 "users_id",
247 {
248 is_deferrable => 1,
249 on_delete => "CASCADE",
250 on_update => "CASCADE",
251 join_type => "left"
252 };
253  
254 =head2 session
255  
256 Type: belongs_to
257  
258 Related object: L<Interchange6::Schema::Result::Session>
259  
260 =cut
261  
262 2 belongs_to
263 session => "Interchange6::Schema::Result::Session",
264 "sessions_id",
265 { join_type => 'left', on_delete => 'SET NULL' };
266  
267 2 1;
« Schema/Result/Orderline.pm ↑ Summary Schema/Result/Permission.pm »