From beefa2483943ce9dc7b5574267ff4a94dad4a4f8 Mon Sep 17 00:00:00 2001 From: SangminLee Date: Fri, 13 Aug 2021 12:31:56 -0400 Subject: [PATCH] Add getMeta(), setMeta() to Payment model --- samples/common.php | 1 + src/Models/Payment.php | 30 +++++++++++++++++++++++++++--- src/V2/TendoPayClient.php | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/samples/common.php b/samples/common.php index 151f56a..710ee49 100644 --- a/samples/common.php +++ b/samples/common.php @@ -1,4 +1,5 @@ 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'] ?? ''; @@ -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; + } } diff --git a/src/V2/TendoPayClient.php b/src/V2/TendoPayClient.php index 45e628d..9ea510e 100644 --- a/src/V2/TendoPayClient.php +++ b/src/V2/TendoPayClient.php @@ -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);