@@ -21,6 +21,11 @@ class Transaction
2121 */
2222 protected $ gatewayConfigurationAlias ;
2323
24+ /**
25+ * @var string
26+ */
27+ protected $ paymentMethod ;
28+
2429 /**
2530 * @var string
2631 */
@@ -59,7 +64,12 @@ class Transaction
5964 /**
6065 * @var array
6166 */
62- protected $ metadatas ;
67+ protected $ metadata ;
68+
69+ /**
70+ * @var array
71+ */
72+ protected $ raw ;
6373
6474 /**
6575 * @var \DateTime
@@ -86,14 +96,16 @@ public function toArray(): array
8696 return [
8797 'id ' => $ this ->id ,
8898 'gateway_configuration_alias ' => $ this ->gatewayConfigurationAlias ,
99+ 'payment_method ' => $ this ->paymentMethod ,
89100 'item_id ' => $ this ->itemId ,
90101 'customer_id ' => $ this ->customerId ,
91102 'customer_email ' => $ this ->customerEmail ,
92103 'status ' => $ this ->status ,
93104 'amount ' => $ this ->amount ,
94105 'currency_code ' => $ this ->currencyCode ,
95106 'description ' => $ this ->description ,
96- 'metadatas ' => $ this ->metadatas ,
107+ 'metadata ' => $ this ->metadata ,
108+ 'raw ' => $ this ->raw ,
97109 'createdAt ' => $ this ->createdAt ,
98110 'updatedAt ' => $ this ->updatedAt ,
99111 ];
@@ -135,6 +147,18 @@ public function setGatewayConfigurationAlias(string $gatewayConfigurationAlias):
135147 return $ this ;
136148 }
137149
150+ public function getPaymentMethod (): ?string
151+ {
152+ return $ this ->paymentMethod ;
153+ }
154+
155+ public function setPaymentMethod (?string $ paymentMethod ): self
156+ {
157+ $ this ->paymentMethod = $ paymentMethod ;
158+
159+ return $ this ;
160+ }
161+
138162 public function getItemId (): ?string
139163 {
140164 return $ this ->itemId ;
@@ -221,31 +245,42 @@ public function setDescription(?string $description): self
221245
222246 public function hasMetadata (string $ key )
223247 {
224- return isset ($ this ->metadatas [$ key ]);
248+ return isset ($ this ->metadata [$ key ]);
225249 }
226250
227- public function getMetadata (string $ key )
251+ public function getMetadata (? string $ key = null )
228252 {
229- return $ this ->metadatas [$ key ];
253+ if (null === $ key ) {
254+ return $ this ->metadata ;
255+ }
256+
257+ return $ this ->hasMetadata ($ key ) ? $ this ->metadata [$ key ] : null ;
230258 }
231259
232260 public function addMetadata (string $ key , $ value )
233261 {
234- $ this ->metadatas [$ key ] = $ value ;
262+ $ this ->metadata [$ key ] = $ value ;
235263 }
236264
237- public function getMetadatas ( ): ? array
265+ public function setMetadata ( array $ metadata ): self
238266 {
239- return $ this ->metadatas ;
267+ $ this ->metadata = [];
268+
269+ foreach ($ metadata as $ key => $ value ) {
270+ $ this ->addMetadata ($ key , $ value );
271+ }
272+
273+ return $ this ;
240274 }
241275
242- public function setMetadatas ( array $ metadatas ): self
276+ public function getRaw ( ): ? array
243277 {
244- $ this ->metadatas = [];
278+ return $ this ->raw ;
279+ }
245280
246- foreach ( $ metadatas as $ key => $ value ) {
247- $ this -> addMetadata ( $ key , $ value );
248- }
281+ public function setRaw (? array $ raw = []): self
282+ {
283+ $ this -> raw = $ raw ;
249284
250285 return $ this ;
251286 }
0 commit comments