Skip to content

Commit 1193661

Browse files
authored
Add ability to process metadata in the requests
1 parent fc7254c commit 1193661

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/Transaction.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Transaction extends Base
2222
$amount = 0,
2323
$email = null,
2424
$reference = null,
25+
$metadata = null,
2526
$transactionResponse =
2627
[
2728
'verify' => null,
@@ -82,6 +83,12 @@ public function initialize( array $data = [], $rawResponse = false )
8283
$this->email = $data['email'];
8384
}
8485

86+
87+
// add metadata if provided
88+
if ( ! is_null( $this->metadata ) ) {
89+
$data['metadata'] = $this->metadata;
90+
}
91+
8592
$this->transactionResponse['initialize'] =
8693
$this
8794
->setAction( 'initialize' )
@@ -284,4 +291,19 @@ public function setCallbackUrl( $callbackUrl )
284291
return $this;
285292
}
286293

287-
}
294+
295+
/**
296+
* Sets the metadata
297+
*
298+
* @param array $metadata
299+
*
300+
* @return $this
301+
*/
302+
public function setMetadata( array $metadata )
303+
{
304+
$this->metadata = $metadata;
305+
306+
return $this;
307+
}
308+
309+
}

0 commit comments

Comments
 (0)