| 1 | package Nitesi::Transaction; | ||
| 2 | |||
| 3 | use Moo; | ||
| 4 | use Sub::Quote; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Nitesi::Transaction - Transaction class for Nitesi Shop Machine | ||
| 9 | |||
| 10 | =head1 ATTRIBUTES | ||
| 11 | |||
| 12 | =head2 code | ||
| 13 | |||
| 14 | Transaction code. | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | has code => ( | ||
| 19 | is => 'rw', | ||
| 20 | ); | ||
| 21 | |||
| 22 | =head2 subtotal | ||
| 23 | |||
| 24 | Transaction subtotal. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | has subtotal => ( | ||
| 29 | is => 'rw', | ||
| 30 | ); | ||
| 31 | |||
| 32 | =head2 shipping | ||
| 33 | |||
| 34 | Shipping cost. | ||
| 35 | |||
| 36 | =cut | ||
| 37 | |||
| 38 | has shipping => ( | ||
| 39 | is => 'rw', | ||
| 40 | ); | ||
| 41 | |||
| 42 | =head2 salestax | ||
| 43 | |||
| 44 | Salestax included in transaction. | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | has salestax => ( | ||
| 49 | is => 'rw', | ||
| 50 | ); | ||
| 51 | |||
| 52 | =head2 total_cost | ||
| 53 | |||
| 54 | Transaction total cost. | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | has total_cost => ( | ||
| 59 | is => 'rw', | ||
| 60 | ); | ||
| 61 | |||
| 62 | =head2 weight | ||
| 63 | |||
| 64 | Total weight of all goods in this transaction. | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | has weight => ( | ||
| 69 | is => 'rw', | ||
| 70 | ); | ||
| 71 | |||
| 72 | =head2 uid | ||
| 73 | |||
| 74 | User identifier of customer. | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | has uid => ( | ||
| 79 | is => 'rw', | ||
| 80 | ); | ||
| 81 | |||
| 82 | =head2 email | ||
| 83 | |||
| 84 | Email address of customer. | ||
| 85 | |||
| 86 | =cut | ||
| 87 | |||
| 88 | has email => ( | ||
| 89 | is => 'rw', | ||
| 90 | ); | ||
| 91 | |||
| 92 | =head2 lname | ||
| 93 | |||
| 94 | Last name of customer. | ||
| 95 | |||
| 96 | =cut | ||
| 97 | |||
| 98 | has lname => ( | ||
| 99 | is => 'rw', | ||
| 100 | ); | ||
| 101 | |||
| 102 | =head2 fname | ||
| 103 | |||
| 104 | First name of customer. | ||
| 105 | |||
| 106 | =cut | ||
| 107 | |||
| 108 | has fname => ( | ||
| 109 | is => 'rw', | ||
| 110 | ); | ||
| 111 | |||
| 112 | =head2 order_date | ||
| 113 | |||
| 114 | Date of order. | ||
| 115 | |||
| 116 | =cut | ||
| 117 | |||
| 118 | has order_date => ( | ||
| 119 | is => 'rw', | ||
| 120 | ); | ||
| 121 | |||
| 122 | =head2 update_date | ||
| 123 | |||
| 124 | Date of last update. | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | has update_date => ( | ||
| 129 | is => 'rw', | ||
| 130 | ); | ||
| 131 | |||
| 132 | =head2 status | ||
| 133 | |||
| 134 | Transaction status. | ||
| 135 | |||
| 136 | =cut | ||
| 137 | |||
| 138 | has status => ( | ||
| 139 | is => 'rw', | ||
| 140 | ); | ||
| 141 | |||
| 142 | =head2 shipping_method | ||
| 143 | |||
| 144 | Shipping method for transaction. | ||
| 145 | |||
| 146 | =cut | ||
| 147 | |||
| 148 | has shipping_method => ( | ||
| 149 | is => 'rw', | ||
| 150 | ); | ||
| 151 | |||
| 152 | =head2 shipping_description | ||
| 153 | |||
| 154 | Shipping description for transaction. | ||
| 155 | |||
| 156 | =cut | ||
| 157 | |||
| 158 | has shipping_description => ( | ||
| 159 | is => 'rw', | ||
| 160 | ); | ||
| 161 | |||
| 162 | =head2 shipping_tax_rate | ||
| 163 | |||
| 164 | Tax rate used for shipping. | ||
| 165 | |||
| 166 | =cut | ||
| 167 | |||
| 168 | has shipping_tax_rate => ( | ||
| 169 | is => 'rw', | ||
| 170 | ); | ||
| 171 | |||
| 172 | =head2 payment_method | ||
| 173 | |||
| 174 | Payment method for this transaction. | ||
| 175 | |||
| 176 | =cut | ||
| 177 | |||
| 178 | has payment_method => ( | ||
| 179 | is => 'rw', | ||
| 180 | ); | ||
| 181 | |||
| 182 | =head2 payment_id | ||
| 183 | |||
| 184 | Payment transaction id. | ||
| 185 | |||
| 186 | =cut | ||
| 187 | |||
| 188 | has payment_id => ( | ||
| 189 | is => 'rw', | ||
| 190 | ); | ||
| 191 | |||
| 192 | =head2 aid_shipping | ||
| 193 | |||
| 194 | Shipping address identifier. | ||
| 195 | |||
| 196 | =cut | ||
| 197 | |||
| 198 | has aid_shipping => ( | ||
| 199 | is => 'rw', | ||
| 200 | ); | ||
| 201 | |||
| 202 | =head2 aid_billing | ||
| 203 | |||
| 204 | Billing address identifier. | ||
| 205 | |||
| 206 | =cut | ||
| 207 | |||
| 208 | has aid_billing => ( | ||
| 209 | is => 'rw', | ||
| 210 | ); | ||
| 211 | |||
| 212 | =head1 METHODS | ||
| 213 | |||
| 214 | =head2 api_attributes | ||
| 215 | |||
| 216 | API attributes for transaction class. | ||
| 217 | |||
| 218 | =cut | ||
| 219 | |||
| 220 | has api_attributes => ( | ||
| 221 | is => 'rw', | ||
| 222 | ); | ||
| 223 | |||
| 224 | =head2 api_info | ||
| 225 | |||
| 226 | Returns API information for transaction object. | ||
| 227 | |||
| 228 | =cut | ||
| 229 | |||
| 230 | sub api_info { | ||
| 231 | my $self = shift; | ||
| 232 | |||
| 233 | return {base => '__PACKAGE__', | ||
| 234 | table => 'transactions', | ||
| 235 | key => 'code', | ||
| 236 | attributes => $self->api_attributes, | ||
| 237 | }; | ||
| 238 | }; | ||
| 239 | |||
| 240 | 1; |