Skip to content

Commit

Permalink
Merge pull request #23 from Plasma-Platform/feature/TMONE-894/checkout1
Browse files Browse the repository at this point in the history
TMONE-894 - return invoice url for order
  • Loading branch information
dimanovoseltsev authored Feb 13, 2025
2 parents aefdede + 096ef2c commit 1ee2747
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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
- Add parameters discounts, products and cartId list in subscriptions
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down
6 changes: 3 additions & 3 deletions src/API2Client/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -240,8 +241,7 @@ public function getOrder($order_id)
}
$factory = new OrderItemFactory ();

return $factory
->create($response->getResult());
return $factory->create($response->getResult());
}

/**
Expand Down
27 changes: 23 additions & 4 deletions src/API2Client/Entities/OrderItem.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/***********************************************************************************************************************
* @author: <[email protected]>
* @author: <[email protected]>
**********************************************************************************************************************/

namespace API2Client\Entities;
Expand Down Expand Up @@ -38,7 +38,10 @@ class OrderItem
/**
* @var array
*/
protected $productInfoList = array ();
protected $productInfoList = array();

/** @var string */
protected $invoiceUrl;

/**
* @var string
Expand Down Expand Up @@ -181,8 +184,24 @@ public function setProductInfoList($productInfoList)
/**
* @param ProductInfo $productInfoList
*/
public function addProductInfo (ProductInfo $productInfoList)
public function addProductInfo(ProductInfo $productInfoList)
{
$this->productInfoList [] = $productInfoList;
}
}

/**
* @param string $invoiceUrl
*/
public function setInvoiceUrl($invoiceUrl)
{
$this->invoiceUrl = $invoiceUrl;
}

/**
* @return string
*/
public function getInvoiceUrl()
{
return $this->invoiceUrl;
}
}
23 changes: 23 additions & 0 deletions src/API2Client/Entities/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ class Subscription
*/
protected $cartId;

/** @var string */
protected $customerId;

/**
* @return string
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -694,6 +716,7 @@ public function toArray()
'affiliate_name' => $this->getAffiliateName(),
'payment_options' => $this->getPaymentOptions(),
'cartId' => $this->getCartId(),
'customer_id' => $this->getCustomerId(),
'discountInfoList' => array(),
'productInfoList' => array(),
);
Expand Down
4 changes: 2 additions & 2 deletions src/API2Client/Setters/OrderItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -47,4 +47,4 @@ public function create ($data)

return $order;
}
}
}

0 comments on commit 1ee2747

Please sign in to comment.