Skip to content

Commit

Permalink
Add getMeta(), setMeta() to Payment model
Browse files Browse the repository at this point in the history
  • Loading branch information
SangminLee committed Aug 13, 2021
1 parent c7d93e6 commit beefa24
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions samples/common.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
//phpcs:ignoreFile
spl_autoload_register(static function ($class) {
$search = [
'\\',
Expand Down
30 changes: 27 additions & 3 deletions src/Models/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace TendoPay\SDK\Models;


class Payment
{
/**
Expand Down Expand Up @@ -33,16 +32,21 @@ class Payment

/**
* Redirect Url
* @var
* @var string $redirectUrl
*/
private $redirectUrl;

/**
* Currency
* @var
* @var string $currency
*/
private $currency;

/**
* @var array $meta
*/
private $meta;

/**
* TendoPayOrder constructor.
* @param array $params
Expand All @@ -55,6 +59,7 @@ public function __construct(array $params = [])
$this->merchantOrderId = $params['tp_merchant_order_id'] ?? null;
$this->description = $params['tp_description'] ?? '';
$this->redirectUrl = $params['tp_redirect_url'] ?? '';
$this->meta = $params['tp_meta'] ?? '';
} else {
$this->merchantOrderId = $params['merchant_order_id'] ?? null;
$this->description = $params['description'] ?? '';
Expand Down Expand Up @@ -170,4 +175,23 @@ public function getRedirectUrl()
{
return $this->redirectUrl;
}

/**
* @param array $meta
*
* @return $this
*/
public function setMeta(array $meta): self
{
$this->meta = $meta;
return $this;
}

/**
* @return array
*/
public function getMeta(): ?array
{
return $this->meta;
}
}
1 change: 1 addition & 0 deletions src/V2/TendoPayClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public function getAuthorizeLink(): string
ConstantsV2::ORDER_ID_PARAM => $this->payment->getMerchantOrderId(),
ConstantsV2::DESC_PARAM => $this->payment->getDescription(),
ConstantsV2::REDIRECT_URL_PARAM => $this->payment->getRedirectUrl(),
'tp_meta' => json_encode($this->payment->getMeta()),
];

$order = $this->createPaymentOrder($params);
Expand Down

0 comments on commit beefa24

Please sign in to comment.