PluginProbe
Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe / trunk
Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe vtrunk
4.17.3 trunk 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 4.10.0 4.11.1 4.12.2 4.14.1 4.14.2 4.14.3 4.15.0 4.16.0 All 59 releases
stripe / src / Transaction / Transaction.php

Transaction.php in Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe trunk, at src/Transaction/Transaction.php

252 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Transactions: Transaction
4 *
5 * @package SimplePay
6 * @subpackage Core
7 * @copyright Copyright (c) 2022, Sandhills Development, LLC
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 4.4.6
10 */
11
12 namespace SimplePay\Core\Transaction;
13
14 use SimplePay\Core\Model\AbstractModel;
15
16 /**
17 * Transaction class.
18 *
19 * @since 4.4.6
20 */
21 class Transaction extends AbstractModel {
22
23 /**
24 * Notification ID.
25 *
26 * @since 4.4.6
27 * @var int
28 */
29 public $id;
30
31 /**
32 * Payment Form ID.
33 *
34 * @since 4.4.6
35 * @var int
36 */
37 public $form_id;
38
39 /**
40 * Object type.
41 *
42 * @since 4.4.6
43 * @var string
44 */
45 public $object;
46
47 /**
48 * Object ID.
49 *
50 * @since 4.4.6
51 * @var string
52 */
53 public $object_id;
54
55 /**
56 * Livemode.
57 *
58 * @since 4.4.6
59 * @var null|bool
60 */
61 public $livemode;
62
63 /**
64 * Transaction amount total.
65 *
66 * @since 4.4.6
67 * @var int
68 */
69 public $amount_total;
70
71 /**
72 * Transaction amount subtotal.
73 *
74 * @since 4.4.6
75 * @var int
76 */
77 public $amount_subtotal;
78
79 /**
80 * Transaction amount shipping.
81 *
82 * @since 4.4.6
83 * @var int
84 */
85 public $amount_shipping;
86
87 /**
88 * Transaction amount discount.
89 *
90 * @since 4.4.6
91 * @var int
92 */
93 public $amount_discount;
94
95 /**
96 * Transaction amount tax.
97 *
98 * @since 4.4.6
99 * @var int
100 */
101 public $amount_tax;
102
103 /**
104 * Transaction currency.
105 *
106 * @since 4.4.6
107 * @var string
108 */
109 public $currency;
110
111 /**
112 * Transaction email address.
113 *
114 * @since 4.4.6
115 * @var string
116 */
117 public $email;
118
119 /**
120 * Transaction Customer ID.
121 *
122 * @since 4.4.6
123 * @var int
124 */
125 public $customer_id;
126
127 /**
128 * Transaction Subscription ID.
129 *
130 * @since 4.4.6
131 * @var int|null
132 */
133 public $subscription_id;
134
135 /**
136 * Transaction status.
137 *
138 * @since 4.4.6
139 * @var string
140 */
141 public $status;
142
143 /**
144 * Transaction application_fee.
145 *
146 * @since 4.4.6
147 * @var null|bool
148 */
149 public $application_fee;
150
151 /**
152 * Transaction IP address.
153 *
154 * @since 4.4.6
155 * @var int
156 */
157 public $ip_address;
158
159 /**
160 * Transaction creation date timestamp.
161 *
162 * @since 4.4.6
163 * @var int
164 */
165 public $date_created;
166
167 /**
168 * Transaction modification date timestamp.
169 *
170 * @since 4.4.6
171 * @var int
172 */
173 public $date_modified;
174
175 /**
176 * Transaction UUID.
177 *
178 * @since 4.4.6
179 * @var string
180 */
181 public $uuid;
182
183 /**
184 * Transaction.
185 *
186 * @since 4.4.6
187 *
188 * @param array<mixed> $data Data to create an model from.
189 */
190 public function __construct( $data ) {
191 parent::__construct( $data );
192
193 // Cast values.
194
195 if ( ! empty( $this->id ) ) {
196 $this->id = (int) $this->id;
197 }
198
199 if ( ! empty( $this->form_id ) ) {
200 $this->form_id = (int) $this->form_id;
201 }
202
203 if ( ! empty( $this->_object_id ) ) {
204 $this->object_id = $this->_object_id;
205 unset( $this->_object_id );
206 }
207
208 if ( isset( $this->livemode ) ) {
209 $this->livemode = (bool) $this->livemode;
210 }
211
212 if ( ! empty( $this->amount_total ) ) {
213 $this->amount_total = (int) $this->amount_total;
214 }
215
216 if ( ! empty( $this->amount_subtotal ) ) {
217 $this->amount_subtotal = (int) $this->amount_subtotal;
218 }
219
220 if ( ! empty( $this->amount_shipping ) ) {
221 $this->amount_shipping = (int) $this->amount_shipping;
222 }
223
224 if ( ! empty( $this->amount_discount ) ) {
225 $this->amount_discount = (int) $this->amount_discount;
226 }
227
228 if ( ! empty( $this->amount_tax ) ) {
229 $this->amount_tax = (int) $this->amount_tax;
230 }
231
232 if ( isset( $this->application_fee ) ) {
233 $this->application_fee = (bool) $this->application_fee;
234 }
235
236 /** @var string $date_created */
237 $date_created = $this->date_created;
238
239 if ( ! empty( $date_created ) && false !== strtotime( $date_created ) ) {
240 $this->date_created = strtotime( $date_created );
241 }
242
243 /** @var string $date_modified */
244 $date_modified = $this->date_modified;
245
246 if ( ! empty( $date_modified ) && false !== strtotime( $date_modified ) ) {
247 $this->date_modified = strtotime( $date_modified );
248 }
249 }
250
251 }
252