Skip to content

Commit 1ee2747

Browse files
Merge pull request #23 from Plasma-Platform/feature/TMONE-894/checkout1
TMONE-894 - return invoice url for order
2 parents aefdede + 096ef2c commit 1ee2747

File tree

8 files changed

+58
-11
lines changed

8 files changed

+58
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.1.1] - 2025-02-11
6+
### Added
7+
- return invoice url for order
8+
- add customer_id for subscription
9+
510
## [1.1.0] - 2025-02-07
611
### Added
712
- Add parameters discounts, products and cartId list in subscriptions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,5 +272,5 @@ catch (\API2Client\Client\APIException $e)
272272

273273
[CHANGELOG]: ./CHANGELOG.md
274274

275-
[version-badge]: https://img.shields.io/badge/version-1.1.0-green.svg
275+
[version-badge]: https://img.shields.io/badge/version-1.1.1-green.svg
276276
[php-version]:https://img.shields.io/static/v1?label=php&message=>=5.3&color=green

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "templatemonster/api2-client",
33
"description": "TemplateMonster API client",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"license": "Apache License, Version 2.0",
66
"authors": [
77
{

src/API2Client/Api.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use API2Client\Entities\Order\Links;
1515
use API2Client\Entities\Order\Status;
1616
use API2Client\Entities\OrderCreated;
17+
use API2Client\Entities\OrderItem;
1718
use API2Client\Entities\Subscription;
1819
use API2Client\Setters\BillingPortalFactory;
1920
use API2Client\Setters\CustomerPortalFactory;
@@ -226,7 +227,7 @@ public function getOrderLinks($order_id, $template_id)
226227
/**
227228
* Get all Statuses
228229
*
229-
* @return array [\API2Client\Entities\Order\Status]
230+
* @return OrderItem
230231
* @throws ApiException
231232
*/
232233
public function getOrder($order_id)
@@ -240,8 +241,7 @@ public function getOrder($order_id)
240241
}
241242
$factory = new OrderItemFactory ();
242243

243-
return $factory
244-
->create($response->getResult());
244+
return $factory->create($response->getResult());
245245
}
246246

247247
/**

src/API2Client/Entities/OrderItem.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/***********************************************************************************************************************
3-
* @author: <[email protected]>
3+
* @author: <[email protected]>
44
**********************************************************************************************************************/
55

66
namespace API2Client\Entities;
@@ -38,7 +38,10 @@ class OrderItem
3838
/**
3939
* @var array
4040
*/
41-
protected $productInfoList = array ();
41+
protected $productInfoList = array();
42+
43+
/** @var string */
44+
protected $invoiceUrl;
4245

4346
/**
4447
* @var string
@@ -181,8 +184,24 @@ public function setProductInfoList($productInfoList)
181184
/**
182185
* @param ProductInfo $productInfoList
183186
*/
184-
public function addProductInfo (ProductInfo $productInfoList)
187+
public function addProductInfo(ProductInfo $productInfoList)
185188
{
186189
$this->productInfoList [] = $productInfoList;
187190
}
188-
}
191+
192+
/**
193+
* @param string $invoiceUrl
194+
*/
195+
public function setInvoiceUrl($invoiceUrl)
196+
{
197+
$this->invoiceUrl = $invoiceUrl;
198+
}
199+
200+
/**
201+
* @return string
202+
*/
203+
public function getInvoiceUrl()
204+
{
205+
return $this->invoiceUrl;
206+
}
207+
}

src/API2Client/Entities/Subscription.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ class Subscription
155155
*/
156156
protected $cartId;
157157

158+
/** @var string */
159+
protected $customerId;
160+
158161
/**
159162
* @return string
160163
*/
@@ -664,6 +667,25 @@ public function getCartId()
664667
return $this->cartId;
665668
}
666669

670+
/**
671+
* @return string
672+
*/
673+
public function getCustomerId()
674+
{
675+
return $this->customerId;
676+
}
677+
678+
/**
679+
* @param $customerId
680+
* @return $this
681+
*/
682+
public function setCustomerId($customerId)
683+
{
684+
$this->customerId = $customerId;
685+
return $this;
686+
}
687+
688+
667689
/**
668690
* @return array
669691
*/
@@ -694,6 +716,7 @@ public function toArray()
694716
'affiliate_name' => $this->getAffiliateName(),
695717
'payment_options' => $this->getPaymentOptions(),
696718
'cartId' => $this->getCartId(),
719+
'customer_id' => $this->getCustomerId(),
697720
'discountInfoList' => array(),
698721
'productInfoList' => array(),
699722
);

src/API2Client/Setters/OrderItemFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function create ($data)
3131
$order->setEmail($this->getValue ('email', $data, 0));
3232
$order->setMerchantMethodId($this->getValue ('merchant_method_id', $data, 0));
3333
$order->setMerchantTransactionId($this->getValue ('merchant_transaction_id', $data, ''));
34-
34+
$order->setInvoiceUrl($this->getValue ('invoiceUrl', $data, ''));
3535

3636
foreach ($this->getValue ('productInfoList', $data, array ()) as $product)
3737
{
@@ -47,4 +47,4 @@ public function create ($data)
4747

4848
return $order;
4949
}
50-
}
50+
}

0 commit comments

Comments
 (0)