From 556ee3a19a8ea03aa600ebfd61bb819516129052 Mon Sep 17 00:00:00 2001 From: novoseltsev Date: Tue, 11 Feb 2025 17:51:47 +0200 Subject: [PATCH 1/4] TMONE-894 - return invoice url for order --- CHANGELOG.md | 4 +++ README.md | 2 +- composer.json | 2 +- src/API2Client/Api.php | 6 ++--- src/API2Client/Entities/OrderItem.php | 27 ++++++++++++++++++--- src/API2Client/Setters/OrderItemFactory.php | 4 +-- 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eeb2b3..47652a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## [1.1.1] - 2025-02-11 +### Added +- return invoice url for order + ## [1.1.0] - 2025-02-07 ### Added - Add parameters discounts, products and cartId list in subscriptions diff --git a/README.md b/README.md index 8abc2fa..012188a 100644 --- a/README.md +++ b/README.md @@ -272,5 +272,5 @@ catch (\API2Client\Client\APIException $e) [CHANGELOG]: ./CHANGELOG.md -[version-badge]: https://img.shields.io/badge/version-1.1.0-green.svg +[version-badge]: https://img.shields.io/badge/version-1.1.1-green.svg [php-version]:https://img.shields.io/static/v1?label=php&message=>=5.3&color=green diff --git a/composer.json b/composer.json index b6d5214..b231de5 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "templatemonster/api2-client", "description": "TemplateMonster API client", - "version": "1.1.0", + "version": "1.1.1", "license": "Apache License, Version 2.0", "authors": [ { diff --git a/src/API2Client/Api.php b/src/API2Client/Api.php index cd4d6b4..7698b72 100644 --- a/src/API2Client/Api.php +++ b/src/API2Client/Api.php @@ -14,6 +14,7 @@ use API2Client\Entities\Order\Links; use API2Client\Entities\Order\Status; use API2Client\Entities\OrderCreated; +use API2Client\Entities\OrderItem; use API2Client\Entities\Subscription; use API2Client\Setters\BillingPortalFactory; use API2Client\Setters\CustomerPortalFactory; @@ -226,7 +227,7 @@ public function getOrderLinks($order_id, $template_id) /** * Get all Statuses * - * @return array [\API2Client\Entities\Order\Status] + * @return OrderItem * @throws ApiException */ public function getOrder($order_id) @@ -240,8 +241,7 @@ public function getOrder($order_id) } $factory = new OrderItemFactory (); - return $factory - ->create($response->getResult()); + return $factory->create($response->getResult()); } /** diff --git a/src/API2Client/Entities/OrderItem.php b/src/API2Client/Entities/OrderItem.php index 87cf561..a5a8cba 100644 --- a/src/API2Client/Entities/OrderItem.php +++ b/src/API2Client/Entities/OrderItem.php @@ -1,6 +1,6 @@ + * @author: **********************************************************************************************************************/ namespace API2Client\Entities; @@ -38,7 +38,10 @@ class OrderItem /** * @var array */ - protected $productInfoList = array (); + protected $productInfoList = array(); + + /** @var string */ + protected $invoiceUrl; /** * @var string @@ -181,8 +184,24 @@ public function setProductInfoList($productInfoList) /** * @param ProductInfo $productInfoList */ - public function addProductInfo (ProductInfo $productInfoList) + public function addProductInfo(ProductInfo $productInfoList) { $this->productInfoList [] = $productInfoList; } -} \ No newline at end of file + + /** + * @param string $invoiceUrl + */ + public function setInvoiceUrl($invoiceUrl) + { + $this->invoiceUrl = $invoiceUrl; + } + + /** + * @return string + */ + public function getInvoiceUrl() + { + return $this->invoiceUrl; + } +} diff --git a/src/API2Client/Setters/OrderItemFactory.php b/src/API2Client/Setters/OrderItemFactory.php index 7e33a86..43fe694 100644 --- a/src/API2Client/Setters/OrderItemFactory.php +++ b/src/API2Client/Setters/OrderItemFactory.php @@ -31,7 +31,7 @@ public function create ($data) $order->setEmail($this->getValue ('email', $data, 0)); $order->setMerchantMethodId($this->getValue ('merchant_method_id', $data, 0)); $order->setMerchantTransactionId($this->getValue ('merchant_transaction_id', $data, '')); - + $order->setInvoiceUrl($this->getValue ('invoiceUrl', $data, '')); foreach ($this->getValue ('productInfoList', $data, array ()) as $product) { @@ -47,4 +47,4 @@ public function create ($data) return $order; } -} \ No newline at end of file +} From b7c4c48fe2ef207300ff65fafa36fa4b96c88052 Mon Sep 17 00:00:00 2001 From: novoseltsev Date: Tue, 11 Feb 2025 17:53:23 +0200 Subject: [PATCH 2/4] TMONE-894 - return invoice url for order --- .../{SubscriptionResult.php => SubscriptionResultFactory.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/API2Client/Setters/{SubscriptionResult.php => SubscriptionResultFactory.php} (100%) diff --git a/src/API2Client/Setters/SubscriptionResult.php b/src/API2Client/Setters/SubscriptionResultFactory.php similarity index 100% rename from src/API2Client/Setters/SubscriptionResult.php rename to src/API2Client/Setters/SubscriptionResultFactory.php From b7007b48a919a415828a86790ac79b6353f75d77 Mon Sep 17 00:00:00 2001 From: novoseltsev Date: Wed, 12 Feb 2025 14:25:25 +0200 Subject: [PATCH 3/4] TMONE-894 - return invoice url for order --- CHANGELOG.md | 1 + src/API2Client/Entities/Subscription.php | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47652a4..72ba04d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ## [1.1.1] - 2025-02-11 ### Added - return invoice url for order +- add customer_id for subscription ## [1.1.0] - 2025-02-07 ### Added diff --git a/src/API2Client/Entities/Subscription.php b/src/API2Client/Entities/Subscription.php index a8d4bee..8142ada 100644 --- a/src/API2Client/Entities/Subscription.php +++ b/src/API2Client/Entities/Subscription.php @@ -155,6 +155,9 @@ class Subscription */ protected $cartId; + /** @var string */ + protected $customerId; + /** * @return string */ @@ -664,6 +667,25 @@ public function getCartId() return $this->cartId; } + /** + * @return string + */ + public function getCustomerId() + { + return $this->customerId; + } + + /** + * @param $customerId + * @return $this + */ + public function setCustomerId($customerId) + { + $this->customerId = $customerId; + return $this; + } + + /** * @return array */ @@ -694,6 +716,7 @@ public function toArray() 'affiliate_name' => $this->getAffiliateName(), 'payment_options' => $this->getPaymentOptions(), 'cartId' => $this->getCartId(), + 'customerId' => $this->getCustomerId(), 'discountInfoList' => array(), 'productInfoList' => array(), ); From 096ef2c0ce02bce894806e331ba412f106726c15 Mon Sep 17 00:00:00 2001 From: novoseltsev Date: Wed, 12 Feb 2025 14:37:10 +0200 Subject: [PATCH 4/4] TMONE-894 - return invoice url for order --- src/API2Client/Entities/Subscription.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/API2Client/Entities/Subscription.php b/src/API2Client/Entities/Subscription.php index 8142ada..7f23b31 100644 --- a/src/API2Client/Entities/Subscription.php +++ b/src/API2Client/Entities/Subscription.php @@ -716,7 +716,7 @@ public function toArray() 'affiliate_name' => $this->getAffiliateName(), 'payment_options' => $this->getPaymentOptions(), 'cartId' => $this->getCartId(), - 'customerId' => $this->getCustomerId(), + 'customer_id' => $this->getCustomerId(), 'discountInfoList' => array(), 'productInfoList' => array(), );