Version Notes
- Bug fixes
Download this release
Release Info
Developer | Nosto |
Extension | Nosto_Tagging |
Version | 2.6.14 |
Comparing to | |
See all releases |
Code changes from version 2.6.12 to 2.6.14
- app/code/community/Nosto/Tagging/Helper/Account.php +1 -1
- app/code/community/Nosto/Tagging/Helper/Oauth.php +1 -1
- app/code/community/Nosto/Tagging/Helper/Price.php +15 -3
- app/code/community/Nosto/Tagging/Model/Meta/Account.php +33 -0
- app/code/community/Nosto/Tagging/Model/Meta/Product.php +10 -0
- app/code/community/Nosto/Tagging/Model/Observer.php +1 -1
- app/code/community/Nosto/Tagging/bootstrap.php +39 -0
- app/code/community/Nosto/Tagging/controllers/Adminhtml/NostoController.php +1 -1
- app/code/community/Nosto/Tagging/controllers/ExportController.php +1 -1
- app/code/community/Nosto/Tagging/controllers/OauthController.php +1 -1
- app/code/community/Nosto/Tagging/etc/config.xml +1 -1
- lib/nosto/php-sdk/src/classes/NostoAccountMeta.php +317 -0
- lib/nosto/php-sdk/src/classes/NostoCurrency.php +110 -0
- lib/nosto/php-sdk/src/classes/NostoCurrencyCode.php +65 -0
- lib/nosto/php-sdk/src/classes/NostoCurrencyFormat.php +119 -0
- lib/nosto/php-sdk/src/classes/NostoCurrencyInfo.php +1173 -0
- lib/nosto/php-sdk/src/classes/NostoCurrencySymbol.php +88 -0
- lib/nosto/php-sdk/src/classes/NostoExchangeRate.php +99 -0
- lib/nosto/php-sdk/src/classes/api/NostoApiRequest.php +2 -0
- lib/nosto/php-sdk/src/classes/api/NostoApiToken.php +9 -2
- lib/nosto/php-sdk/src/classes/collection/NostoExchangeRateCollection.php +46 -0
- lib/nosto/php-sdk/src/classes/export/NostoExportProductCollection.php +4 -0
- lib/nosto/php-sdk/src/classes/http/NostoHttpRequest.php +20 -2
- lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterCurl.php +20 -0
- lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterSocket.php +20 -0
- lib/nosto/php-sdk/src/classes/operation/NostoOperationAccount.php +150 -0
- lib/nosto/php-sdk/src/classes/operation/NostoOperationExchangeRate.php +154 -0
- lib/nosto/php-sdk/src/classes/operation/NostoOperationProduct.php +3 -0
- lib/nosto/php-sdk/src/config.inc.php +11 -0
- lib/nosto/php-sdk/src/interfaces/NostoExchangeRateInterface.php +62 -0
- lib/nosto/php-sdk/src/interfaces/NostoProductInterface.php +7 -0
- lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataInterface.php +25 -1
- package.xml +36 -24
app/code/community/Nosto/Tagging/Helper/Account.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
-
require_once
|
29 |
|
30 |
/**
|
31 |
* Helper class for managing Nosto accounts.
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
+
require_once __DIR__ . '/../bootstrap.php';
|
29 |
|
30 |
/**
|
31 |
* Helper class for managing Nosto accounts.
|
app/code/community/Nosto/Tagging/Helper/Oauth.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
-
require_once
|
29 |
|
30 |
/**
|
31 |
* Helper class for OAuth2 related tasks.
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
+
require_once __DIR__ . '/../bootstrap.php';
|
29 |
|
30 |
/**
|
31 |
* Helper class for OAuth2 related tasks.
|
app/code/community/Nosto/Tagging/Helper/Price.php
CHANGED
@@ -165,10 +165,22 @@ class Nosto_Tagging_Helper_Price extends Mage_Core_Helper_Abstract
|
|
165 |
public function getItemFinalPriceInclTax(Mage_Sales_Model_Order_Item $item)
|
166 |
{
|
167 |
$quantity = (double)$item->getQtyOrdered();
|
168 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
if ($quantity > 1) {
|
170 |
-
$
|
171 |
}
|
172 |
-
|
|
|
173 |
}
|
174 |
}
|
165 |
public function getItemFinalPriceInclTax(Mage_Sales_Model_Order_Item $item)
|
166 |
{
|
167 |
$quantity = (double)$item->getQtyOrdered();
|
168 |
+
$basePrice = $item->getBaseRowTotal() + $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount() - $item->getBaseDiscountAmount();
|
169 |
+
$orderCurrencyCode = $item->getOrder()->getOrderCurrencyCode();
|
170 |
+
$baseCurrencyCode = $item->getOrder()->getBaseCurrencyCode();
|
171 |
+
if ($orderCurrencyCode != $baseCurrencyCode) {
|
172 |
+
$priceInOrderCurrency = Mage::helper('directory')->currencyConvert(
|
173 |
+
$basePrice,
|
174 |
+
$baseCurrencyCode,
|
175 |
+
$orderCurrencyCode
|
176 |
+
);
|
177 |
+
} else {
|
178 |
+
$priceInOrderCurrency = $basePrice;
|
179 |
+
}
|
180 |
if ($quantity > 1) {
|
181 |
+
$priceInOrderCurrency = round($priceInOrderCurrency/$quantity, 2);
|
182 |
}
|
183 |
+
|
184 |
+
return $priceInOrderCurrency;
|
185 |
}
|
186 |
}
|
app/code/community/Nosto/Tagging/Model/Meta/Account.php
CHANGED
@@ -244,4 +244,37 @@ class Nosto_Tagging_Model_Meta_Account extends Mage_Core_Model_Abstract implemen
|
|
244 |
// todo: implement partner code storage.
|
245 |
return null;
|
246 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
244 |
// todo: implement partner code storage.
|
245 |
return null;
|
246 |
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Returns a list of currency objects supported by the store the account is to be created for.
|
250 |
+
*
|
251 |
+
* @return NostoCurrency[] the currencies.
|
252 |
+
*/
|
253 |
+
public function getCurrencies()
|
254 |
+
{
|
255 |
+
return null;
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Returns if exchange rates should be used for handling
|
260 |
+
* multiple currencies. Please note that the method only tells if the
|
261 |
+
* setting is active. Method does not take account whether multiple
|
262 |
+
* currencies actually exist or are used.
|
263 |
+
*
|
264 |
+
* @return boolean if multi variants are used
|
265 |
+
*/
|
266 |
+
public function getUseCurrencyExchangeRates()
|
267 |
+
{
|
268 |
+
return false;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Returns the default variation id
|
273 |
+
*
|
274 |
+
* @return string
|
275 |
+
*/
|
276 |
+
public function getDefaultVariationId()
|
277 |
+
{
|
278 |
+
return null;
|
279 |
+
}
|
280 |
}
|
app/code/community/Nosto/Tagging/Model/Meta/Product.php
CHANGED
@@ -532,4 +532,14 @@ class Nosto_Tagging_Model_Meta_Product extends Nosto_Tagging_Model_Base implemen
|
|
532 |
}
|
533 |
return implode(' ', $descriptions);
|
534 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
}
|
532 |
}
|
533 |
return implode(' ', $descriptions);
|
534 |
}
|
535 |
+
|
536 |
+
/**
|
537 |
+
* Returns the product variation id.
|
538 |
+
*
|
539 |
+
* @return mixed|null
|
540 |
+
*/
|
541 |
+
public function getVariationId()
|
542 |
+
{
|
543 |
+
return null;
|
544 |
+
}
|
545 |
}
|
app/code/community/Nosto/Tagging/Model/Observer.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
-
require_once
|
29 |
|
30 |
/**
|
31 |
* Event observer model.
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
+
require_once __DIR__ . '/../bootstrap.php';
|
29 |
|
30 |
/**
|
31 |
* Event observer model.
|
app/code/community/Nosto/Tagging/bootstrap.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2015, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2015 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
require_once Mage::getBaseDir('lib') . '/nosto/php-sdk/src/config.inc.php';
|
37 |
+
|
38 |
+
$version = (string)Mage::getConfig()->getNode('modules/Nosto_Tagging/version');
|
39 |
+
NostoHttpRequest::buildUserAgent('Magento', Mage::getVersion(), $version);
|
app/code/community/Nosto/Tagging/controllers/Adminhtml/NostoController.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
-
require_once
|
29 |
|
30 |
/**
|
31 |
* Nosto admin controller.
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
+
require_once __DIR__ . '/../../bootstrap.php';
|
29 |
|
30 |
/**
|
31 |
* Nosto admin controller.
|
app/code/community/Nosto/Tagging/controllers/ExportController.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
-
require_once
|
29 |
|
30 |
/**
|
31 |
* History data export controller.
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
+
require_once __DIR__ . '/../bootstrap.php';
|
29 |
|
30 |
/**
|
31 |
* History data export controller.
|
app/code/community/Nosto/Tagging/controllers/OauthController.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
-
require_once
|
29 |
|
30 |
/**
|
31 |
* OAuth2 controller.
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
+
require_once __DIR__ . '/../bootstrap.php';
|
29 |
|
30 |
/**
|
31 |
* OAuth2 controller.
|
app/code/community/Nosto/Tagging/etc/config.xml
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
<config>
|
30 |
<modules>
|
31 |
<Nosto_Tagging>
|
32 |
-
<version>2.6.
|
33 |
</Nosto_Tagging>
|
34 |
</modules>
|
35 |
<global>
|
29 |
<config>
|
30 |
<modules>
|
31 |
<Nosto_Tagging>
|
32 |
+
<version>2.6.14</version>
|
33 |
</Nosto_Tagging>
|
34 |
</modules>
|
35 |
<global>
|
lib/nosto/php-sdk/src/classes/NostoAccountMeta.php
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 2013-2016 Nosto Solutions Ltd
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to contact@nosto.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
18 |
+
* versions in the future. If you wish to customize PrestaShop for your
|
19 |
+
* needs please refer to http://www.prestashop.com for more information.
|
20 |
+
*
|
21 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
22 |
+
* @copyright 2013-2016 Nosto Solutions Ltd
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Meta data class for account related information needed when creating new accounts.
|
28 |
+
*/
|
29 |
+
abstract class NostoAccountMeta implements NostoAccountMetaDataInterface
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* @var string the store name.
|
33 |
+
*/
|
34 |
+
protected $title;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var string the account name.
|
38 |
+
*/
|
39 |
+
protected $name;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var string the store front end url.
|
43 |
+
*/
|
44 |
+
protected $frontPageUrl;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var string the store currency ISO (ISO 4217) code.
|
48 |
+
*/
|
49 |
+
protected $currencyCode;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @var string the store language ISO (ISO 639-1) code.
|
53 |
+
*/
|
54 |
+
protected $languageCode;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @var string the owner language ISO (ISO 639-1) code.
|
58 |
+
*/
|
59 |
+
protected $ownerLanguageCode;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @var NostoTaggingMetaAccountOwner the account owner meta model.
|
63 |
+
*/
|
64 |
+
protected $owner;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @var NostoTaggingMetaAccountBilling the billing meta model.
|
68 |
+
*/
|
69 |
+
protected $billing;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @var array list of NostoCurrency objects supported by the store .
|
73 |
+
*/
|
74 |
+
protected $currencies = array();
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @var bool if the store uses exchange rates to manage multiple currencies.
|
78 |
+
*/
|
79 |
+
protected $useCurrencyExchangeRates = false;
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @var string default variation id
|
83 |
+
*/
|
84 |
+
protected $defaultVariationId = false;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Sets the store title.
|
88 |
+
*
|
89 |
+
* @param string $title the store title.
|
90 |
+
*/
|
91 |
+
public function setTitle($title)
|
92 |
+
{
|
93 |
+
$this->title = $title;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* The shops name for which the account is to be created for.
|
98 |
+
*
|
99 |
+
* @return string the name.
|
100 |
+
*/
|
101 |
+
public function getTitle()
|
102 |
+
{
|
103 |
+
return $this->title;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Sets the account name.
|
108 |
+
*
|
109 |
+
* @param string $name the account name.
|
110 |
+
*/
|
111 |
+
public function setName($name)
|
112 |
+
{
|
113 |
+
$this->name = $name;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* The name of the account to create.
|
118 |
+
* This has to follow the pattern of
|
119 |
+
* "[platform name]-[8 character lowercase alpha numeric string]".
|
120 |
+
*
|
121 |
+
* @return string the account name.
|
122 |
+
*/
|
123 |
+
public function getName()
|
124 |
+
{
|
125 |
+
return $this->name;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* The name of the platform the account is used on.
|
130 |
+
* A list of valid platform names is issued by Nosto.
|
131 |
+
*
|
132 |
+
* @return string the platform names.
|
133 |
+
*/
|
134 |
+
abstract public function getPlatform();
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Sets the store front page url.
|
138 |
+
*
|
139 |
+
* @param string $url the front page url.
|
140 |
+
*/
|
141 |
+
public function setFrontPageUrl($url)
|
142 |
+
{
|
143 |
+
$this->frontPageUrl = $url;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Absolute url to the front page of the shop for which the account is
|
148 |
+
* created for.
|
149 |
+
*
|
150 |
+
* @return string the url.
|
151 |
+
*/
|
152 |
+
public function getFrontPageUrl()
|
153 |
+
{
|
154 |
+
return $this->frontPageUrl;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Sets the store currency ISO (ISO 4217) code.
|
159 |
+
*
|
160 |
+
* @param string $code the currency ISO code.
|
161 |
+
*/
|
162 |
+
public function setCurrencyCode($code)
|
163 |
+
{
|
164 |
+
$this->currencyCode = $code;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* The 3-letter ISO code (ISO 4217) for the currency used by the shop for
|
169 |
+
* which the account is created for.
|
170 |
+
*
|
171 |
+
* @return string the currency ISO code.
|
172 |
+
*/
|
173 |
+
public function getCurrencyCode()
|
174 |
+
{
|
175 |
+
return $this->currencyCode;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Sets the store language ISO (ISO 639-1) code.
|
180 |
+
*
|
181 |
+
* @param string $languageCode the language ISO code.
|
182 |
+
*/
|
183 |
+
public function setLanguageCode($languageCode)
|
184 |
+
{
|
185 |
+
$this->languageCode = $languageCode;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* The 2-letter ISO code (ISO 639-1) for the language used by the shop for
|
190 |
+
* which the account is created for.
|
191 |
+
*
|
192 |
+
* @return string the language ISO code.
|
193 |
+
*/
|
194 |
+
public function getLanguageCode()
|
195 |
+
{
|
196 |
+
return $this->languageCode;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Sets the owner language ISO (ISO 639-1) code.
|
201 |
+
*
|
202 |
+
* @param string $language_code the language ISO code.
|
203 |
+
*/
|
204 |
+
public function setOwnerLanguageCode($language_code)
|
205 |
+
{
|
206 |
+
$this->ownerLanguageCode = $language_code;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* The 2-letter ISO code (ISO 639-1) for the language of the account owner
|
211 |
+
* who is creating the account.
|
212 |
+
*
|
213 |
+
* @return string the language ISO code.
|
214 |
+
*/
|
215 |
+
public function getOwnerLanguageCode()
|
216 |
+
{
|
217 |
+
return $this->ownerLanguageCode;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Meta data model for the account owner who is creating the account.
|
222 |
+
*
|
223 |
+
* @return NostoTaggingMetaAccountOwner the meta data model.
|
224 |
+
*/
|
225 |
+
public function getOwner()
|
226 |
+
{
|
227 |
+
return $this->owner;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Meta data model for the account billing details.
|
232 |
+
*
|
233 |
+
* @return NostoTaggingMetaAccountBilling the meta data model.
|
234 |
+
*/
|
235 |
+
public function getBillingDetails()
|
236 |
+
{
|
237 |
+
return $this->billing;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* The API token used to identify an account creation.
|
242 |
+
* This token is platform specific and issued by Nosto.
|
243 |
+
*
|
244 |
+
* @return string the API token.
|
245 |
+
*/
|
246 |
+
abstract public function getSignUpApiToken();
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Returns the partner code
|
250 |
+
*
|
251 |
+
* @return string
|
252 |
+
*/
|
253 |
+
abstract public function getPartnerCode();
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Returns an array of currencies used for this account
|
257 |
+
*
|
258 |
+
* @return array
|
259 |
+
*/
|
260 |
+
public function getCurrencies()
|
261 |
+
{
|
262 |
+
return $this->currencies;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Sets the currencies
|
267 |
+
*
|
268 |
+
* @param $currencies
|
269 |
+
*/
|
270 |
+
public function setCurrencies($currencies)
|
271 |
+
{
|
272 |
+
$this->currencies = $currencies;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Setter for useCurrencyExhangeRates
|
277 |
+
*
|
278 |
+
* @param boolean $useCurrencyExchangeRates
|
279 |
+
*/
|
280 |
+
public function setUseCurrencyExchangeRates($useCurrencyExchangeRates)
|
281 |
+
{
|
282 |
+
$this->useCurrencyExchangeRates = $useCurrencyExchangeRates;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Returns if the exchange rates are used
|
287 |
+
*
|
288 |
+
* @return boolean
|
289 |
+
*/
|
290 |
+
public function getUseCurrencyExchangeRates()
|
291 |
+
{
|
292 |
+
return $this->useCurrencyExchangeRates;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Sets the default variation id
|
297 |
+
* @param string $defaultVariationId
|
298 |
+
*/
|
299 |
+
public function setDefaultVariationId($defaultVariationId)
|
300 |
+
{
|
301 |
+
$this->defaultVariationId = $defaultVariationId;
|
302 |
+
}
|
303 |
+
|
304 |
+
|
305 |
+
/*
|
306 |
+
* Returns the default variation id
|
307 |
+
*
|
308 |
+
* @return string
|
309 |
+
*/
|
310 |
+
/**
|
311 |
+
* @return string
|
312 |
+
*/
|
313 |
+
public function getDefaultVariationId()
|
314 |
+
{
|
315 |
+
return $this->defaultVariationId;
|
316 |
+
}
|
317 |
+
}
|
lib/nosto/php-sdk/src/classes/NostoCurrency.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 2013-2016 Nosto Solutions Ltd
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to contact@nosto.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
18 |
+
* versions in the future. If you wish to customize PrestaShop for your
|
19 |
+
* needs please refer to http://www.prestashop.com for more information.
|
20 |
+
*
|
21 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
22 |
+
* @copyright 2013-2016 Nosto Solutions Ltd
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Class representing a currency with all it's formatting details Nosto needs.
|
28 |
+
*/
|
29 |
+
final class NostoCurrency
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* @var string the currency ISO 4217 code.
|
33 |
+
*/
|
34 |
+
private $code;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var NostoCurrencySymbol the currency symbol.
|
38 |
+
*/
|
39 |
+
private $symbol;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var NostoCurrencyFormat the currency format.
|
43 |
+
*/
|
44 |
+
private $format;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Constructor.
|
48 |
+
* Assigns the currency properties.
|
49 |
+
*
|
50 |
+
* @param NostoCurrencyCode $code the currency ISO 4217 code.
|
51 |
+
* @param NostoCurrencySymbol $symbol the currency symbol.
|
52 |
+
* @param NostoCurrencyFormat $format the currency formatting.
|
53 |
+
*/
|
54 |
+
public function __construct(NostoCurrencyCode $code, NostoCurrencySymbol $symbol, NostoCurrencyFormat $format)
|
55 |
+
{
|
56 |
+
$this->code = $code;
|
57 |
+
$this->symbol = $symbol;
|
58 |
+
$this->format = $format;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Getter for the currency code.
|
63 |
+
*
|
64 |
+
* @return NostoCurrencyCode the currency ISO 4217 code.
|
65 |
+
*/
|
66 |
+
public function getCode()
|
67 |
+
{
|
68 |
+
return $this->code;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Getter for the currency symbol.
|
73 |
+
*
|
74 |
+
* @return NostoCurrencySymbol the currency symbol.
|
75 |
+
*/
|
76 |
+
public function getSymbol()
|
77 |
+
{
|
78 |
+
return $this->symbol;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Getter for the currency format.
|
83 |
+
*
|
84 |
+
* @return NostoCurrencyFormat the format.
|
85 |
+
*/
|
86 |
+
public function getFormat()
|
87 |
+
{
|
88 |
+
return $this->format;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Returns the currency sub-unit.
|
93 |
+
*
|
94 |
+
* @return int the sub-unit.
|
95 |
+
*/
|
96 |
+
public function getFractionUnit()
|
97 |
+
{
|
98 |
+
return NostoCurrencyInfo::getFractionUnit($this->code);
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Returns the currency default fraction decimals.
|
103 |
+
*
|
104 |
+
* @return int the fraction digits.
|
105 |
+
*/
|
106 |
+
public function getDefaultFractionDecimals()
|
107 |
+
{
|
108 |
+
return NostoCurrencyInfo::getFractionDecimals($this->code);
|
109 |
+
}
|
110 |
+
}
|
lib/nosto/php-sdk/src/classes/NostoCurrencyCode.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Value Object representing a currency code in ISO 4217 format.
|
38 |
+
*/
|
39 |
+
final class NostoCurrencyCode
|
40 |
+
{
|
41 |
+
/**
|
42 |
+
* @var string the ISO 4217 currency code.
|
43 |
+
*/
|
44 |
+
private $code;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Constructor.
|
48 |
+
* Sets up this Value Object with the ISO 4217 currency code.
|
49 |
+
*
|
50 |
+
* @param string $code the currency code.
|
51 |
+
*
|
52 |
+
*/
|
53 |
+
public function __construct($code)
|
54 |
+
{
|
55 |
+
$this->code = (string)$code;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @return string the ISO 4217 currency code.
|
60 |
+
*/
|
61 |
+
public function getCode()
|
62 |
+
{
|
63 |
+
return $this->code;
|
64 |
+
}
|
65 |
+
}
|
lib/nosto/php-sdk/src/classes/NostoCurrencyFormat.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Value Object representing a currency formatting, e.g. "1.234,56".
|
38 |
+
*/
|
39 |
+
final class NostoCurrencyFormat
|
40 |
+
{
|
41 |
+
/**
|
42 |
+
* @var string the grouping symbol/char.
|
43 |
+
*/
|
44 |
+
private $groupSymbol;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var int the length of the group.
|
48 |
+
*/
|
49 |
+
private $groupLength;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @var string the decimal symbol/char.
|
53 |
+
*/
|
54 |
+
private $decimalSymbol;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @var int the value precision.
|
58 |
+
*/
|
59 |
+
private $precision;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Constructor.
|
63 |
+
* Sets up this Value Object with given data.
|
64 |
+
*
|
65 |
+
* @param string $groupSymbol the grouping symbol/char.
|
66 |
+
* @param int $groupLength the length of the group.
|
67 |
+
* @param string $decimalSymbol the decimal symbol/char.
|
68 |
+
* @param int $precision the value precision.
|
69 |
+
*
|
70 |
+
* @throws NostoInvalidArgumentException
|
71 |
+
*/
|
72 |
+
public function __construct($groupSymbol, $groupLength, $decimalSymbol, $precision)
|
73 |
+
{
|
74 |
+
$this->groupSymbol = (string)$groupSymbol;
|
75 |
+
$this->groupLength = (int)$groupLength;
|
76 |
+
$this->decimalSymbol = (string)$decimalSymbol;
|
77 |
+
$this->precision = (int)$precision;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Returns the decimal symbol/char.
|
82 |
+
*
|
83 |
+
* @return string the decimal symbol/char.
|
84 |
+
*/
|
85 |
+
public function getDecimalSymbol()
|
86 |
+
{
|
87 |
+
return $this->decimalSymbol;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Returns the length of the group.
|
92 |
+
*
|
93 |
+
* @return int the length of the group.
|
94 |
+
*/
|
95 |
+
public function getGroupLength()
|
96 |
+
{
|
97 |
+
return $this->groupLength;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Returns the grouping symbol/char.
|
102 |
+
*
|
103 |
+
* @return string the grouping symbol/char.
|
104 |
+
*/
|
105 |
+
public function getGroupSymbol()
|
106 |
+
{
|
107 |
+
return $this->groupSymbol;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Returns the value precision.
|
112 |
+
*
|
113 |
+
* @return int the value precision.
|
114 |
+
*/
|
115 |
+
public function getPrecision()
|
116 |
+
{
|
117 |
+
return $this->precision;
|
118 |
+
}
|
119 |
+
}
|
lib/nosto/php-sdk/src/classes/NostoCurrencyInfo.php
ADDED
@@ -0,0 +1,1173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Static data object with currency related info.
|
38 |
+
*/
|
39 |
+
final class NostoCurrencyInfo
|
40 |
+
{
|
41 |
+
/**
|
42 |
+
* Private Constructor to disallow instantiation.
|
43 |
+
*/
|
44 |
+
private function __construct()
|
45 |
+
{
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var array currency data keyed on the currencies ISO 4217 codes.
|
50 |
+
*/
|
51 |
+
private static $data = array(
|
52 |
+
'AED' => array(
|
53 |
+
'name' => 'UAE Dirham',
|
54 |
+
'numericCode' => 784,
|
55 |
+
'fractionDecimals' => 2,
|
56 |
+
'fractionUnit' => 100,
|
57 |
+
),
|
58 |
+
'AFN' => array(
|
59 |
+
'name' => 'Afghani',
|
60 |
+
'numericCode' => 971,
|
61 |
+
'fractionDecimals' => 2,
|
62 |
+
'fractionUnit' => 100,
|
63 |
+
),
|
64 |
+
'ALL' => array(
|
65 |
+
'name' => 'Lek',
|
66 |
+
'numericCode' => 8,
|
67 |
+
'fractionDecimals' => 2,
|
68 |
+
'fractionUnit' => 100,
|
69 |
+
),
|
70 |
+
'AMD' => array(
|
71 |
+
'name' => 'Armenian Dram',
|
72 |
+
'numericCode' => 51,
|
73 |
+
'fractionDecimals' => 2,
|
74 |
+
'fractionUnit' => 100,
|
75 |
+
),
|
76 |
+
'ANG' => array(
|
77 |
+
'name' => 'Netherlands Antillean Guilder',
|
78 |
+
'numericCode' => 532,
|
79 |
+
'fractionDecimals' => 2,
|
80 |
+
'fractionUnit' => 100,
|
81 |
+
),
|
82 |
+
'AOA' => array(
|
83 |
+
'name' => 'Kwanza',
|
84 |
+
'numericCode' => 973,
|
85 |
+
'fractionDecimals' => 2,
|
86 |
+
'fractionUnit' => 100,
|
87 |
+
),
|
88 |
+
'ARS' => array(
|
89 |
+
'name' => 'Argentine Peso',
|
90 |
+
'numericCode' => 32,
|
91 |
+
'fractionDecimals' => 2,
|
92 |
+
'fractionUnit' => 100,
|
93 |
+
),
|
94 |
+
'AUD' => array(
|
95 |
+
'name' => 'Australian Dollar',
|
96 |
+
'numericCode' => 36,
|
97 |
+
'fractionDecimals' => 2,
|
98 |
+
'fractionUnit' => 100,
|
99 |
+
),
|
100 |
+
'AWG' => array(
|
101 |
+
'name' => 'Aruban Florin',
|
102 |
+
'numericCode' => 533,
|
103 |
+
'fractionDecimals' => 2,
|
104 |
+
'fractionUnit' => 100,
|
105 |
+
),
|
106 |
+
'AZN' => array(
|
107 |
+
'name' => 'Azerbaijanian Manat',
|
108 |
+
'numericCode' => 944,
|
109 |
+
'fractionDecimals' => 2,
|
110 |
+
'fractionUnit' => 100,
|
111 |
+
),
|
112 |
+
'BAM' => array(
|
113 |
+
'name' => 'Convertible Mark',
|
114 |
+
'numericCode' => 977,
|
115 |
+
'fractionDecimals' => 2,
|
116 |
+
'fractionUnit' => 100,
|
117 |
+
),
|
118 |
+
'BBD' => array(
|
119 |
+
'name' => 'Barbados Dollar',
|
120 |
+
'numericCode' => 52,
|
121 |
+
'fractionDecimals' => 2,
|
122 |
+
'fractionUnit' => 100,
|
123 |
+
),
|
124 |
+
'BDT' => array(
|
125 |
+
'name' => 'Taka',
|
126 |
+
'numericCode' => 50,
|
127 |
+
'fractionDecimals' => 2,
|
128 |
+
'fractionUnit' => 100,
|
129 |
+
),
|
130 |
+
'BGN' => array(
|
131 |
+
'name' => 'Bulgarian Lev',
|
132 |
+
'numericCode' => 975,
|
133 |
+
'fractionDecimals' => 2,
|
134 |
+
'fractionUnit' => 100,
|
135 |
+
),
|
136 |
+
'BHD' => array(
|
137 |
+
'name' => 'Bahraini Dinar',
|
138 |
+
'numericCode' => 48,
|
139 |
+
'fractionDecimals' => 3,
|
140 |
+
'fractionUnit' => 1000,
|
141 |
+
),
|
142 |
+
'BIF' => array(
|
143 |
+
'name' => 'Burundi Franc',
|
144 |
+
'numericCode' => 108,
|
145 |
+
'fractionDecimals' => 0,
|
146 |
+
'fractionUnit' => 100,
|
147 |
+
),
|
148 |
+
'BMD' => array(
|
149 |
+
'name' => 'Bermudian Dollar',
|
150 |
+
'numericCode' => 60,
|
151 |
+
'fractionDecimals' => 2,
|
152 |
+
'fractionUnit' => 100,
|
153 |
+
),
|
154 |
+
'BND' => array(
|
155 |
+
'name' => 'Brunei Dollar',
|
156 |
+
'numericCode' => 96,
|
157 |
+
'fractionDecimals' => 2,
|
158 |
+
'fractionUnit' => 100,
|
159 |
+
),
|
160 |
+
'BOB' => array(
|
161 |
+
'name' => 'Boliviano',
|
162 |
+
'numericCode' => 68,
|
163 |
+
'fractionDecimals' => 2,
|
164 |
+
'fractionUnit' => 100,
|
165 |
+
),
|
166 |
+
'BOV' => array(
|
167 |
+
'name' => 'Mvdol',
|
168 |
+
'numericCode' => 984,
|
169 |
+
'fractionDecimals' => 2,
|
170 |
+
'fractionUnit' => 100,
|
171 |
+
),
|
172 |
+
'BRL' => array(
|
173 |
+
'name' => 'Brazilian Real',
|
174 |
+
'numericCode' => 986,
|
175 |
+
'fractionDecimals' => 2,
|
176 |
+
'fractionUnit' => 100,
|
177 |
+
),
|
178 |
+
'BSD' => array(
|
179 |
+
'name' => 'Bahamian Dollar',
|
180 |
+
'numericCode' => 44,
|
181 |
+
'fractionDecimals' => 2,
|
182 |
+
'fractionUnit' => 100,
|
183 |
+
),
|
184 |
+
'BTN' => array(
|
185 |
+
'name' => 'Ngultrum',
|
186 |
+
'numericCode' => 64,
|
187 |
+
'fractionDecimals' => 2,
|
188 |
+
'fractionUnit' => 100,
|
189 |
+
),
|
190 |
+
'BTC' => array(
|
191 |
+
'name' => 'Bitcoin',
|
192 |
+
'numericCode' => 00,
|
193 |
+
'fractionDecimals' => 2,
|
194 |
+
'fractionUnit' => 100,
|
195 |
+
),
|
196 |
+
'BWP' => array(
|
197 |
+
'name' => 'Pula',
|
198 |
+
'numericCode' => 72,
|
199 |
+
'fractionDecimals' => 2,
|
200 |
+
'fractionUnit' => 100,
|
201 |
+
),
|
202 |
+
'BYR' => array(
|
203 |
+
'name' => 'Belarussian Ruble',
|
204 |
+
'numericCode' => 974,
|
205 |
+
'fractionDecimals' => 0,
|
206 |
+
'fractionUnit' => 100,
|
207 |
+
),
|
208 |
+
'BZD' => array(
|
209 |
+
'name' => 'Belize Dollar',
|
210 |
+
'numericCode' => 84,
|
211 |
+
'fractionDecimals' => 2,
|
212 |
+
'fractionUnit' => 100,
|
213 |
+
),
|
214 |
+
'CAD' => array(
|
215 |
+
'name' => 'Canadian Dollar',
|
216 |
+
'numericCode' => 124,
|
217 |
+
'fractionDecimals' => 2,
|
218 |
+
'fractionUnit' => 100,
|
219 |
+
),
|
220 |
+
'CDF' => array(
|
221 |
+
'name' => 'Congolese Franc',
|
222 |
+
'numericCode' => 976,
|
223 |
+
'fractionDecimals' => 2,
|
224 |
+
'fractionUnit' => 100,
|
225 |
+
),
|
226 |
+
'CHE' => array(
|
227 |
+
'name' => 'WIR Euro',
|
228 |
+
'numericCode' => 947,
|
229 |
+
'fractionDecimals' => 2,
|
230 |
+
'fractionUnit' => 100,
|
231 |
+
),
|
232 |
+
'CHF' => array(
|
233 |
+
'name' => 'Swiss Franc',
|
234 |
+
'numericCode' => 756,
|
235 |
+
'fractionDecimals' => 2,
|
236 |
+
'fractionUnit' => 100,
|
237 |
+
),
|
238 |
+
'CHW' => array(
|
239 |
+
'name' => 'WIR Franc',
|
240 |
+
'numericCode' => 948,
|
241 |
+
'fractionDecimals' => 2,
|
242 |
+
'fractionUnit' => 100,
|
243 |
+
),
|
244 |
+
'CLF' => array(
|
245 |
+
'name' => 'Unidades de fomento',
|
246 |
+
'numericCode' => 990,
|
247 |
+
'fractionDecimals' => 0,
|
248 |
+
'fractionUnit' => 100,
|
249 |
+
),
|
250 |
+
'CLP' => array(
|
251 |
+
'name' => 'Chilean Peso',
|
252 |
+
'numericCode' => 152,
|
253 |
+
'fractionDecimals' => 0,
|
254 |
+
'fractionUnit' => 100,
|
255 |
+
),
|
256 |
+
'CNY' => array(
|
257 |
+
'name' => 'Yuan Renminbi',
|
258 |
+
'numericCode' => 156,
|
259 |
+
'fractionDecimals' => 2,
|
260 |
+
'fractionUnit' => 100,
|
261 |
+
),
|
262 |
+
'COP' => array(
|
263 |
+
'name' => 'Colombian Peso',
|
264 |
+
'numericCode' => 170,
|
265 |
+
'fractionDecimals' => 2,
|
266 |
+
'fractionUnit' => 100,
|
267 |
+
),
|
268 |
+
'COU' => array(
|
269 |
+
'name' => 'Unidad de Valor Real',
|
270 |
+
'numericCode' => 970,
|
271 |
+
'fractionDecimals' => 2,
|
272 |
+
'fractionUnit' => 100,
|
273 |
+
),
|
274 |
+
'CRC' => array(
|
275 |
+
'name' => 'Costa Rican Colon',
|
276 |
+
'numericCode' => 188,
|
277 |
+
'fractionDecimals' => 2,
|
278 |
+
'fractionUnit' => 100,
|
279 |
+
),
|
280 |
+
'CUC' => array(
|
281 |
+
'name' => 'Peso Convertible',
|
282 |
+
'numericCode' => 931,
|
283 |
+
'fractionDecimals' => 2,
|
284 |
+
'fractionUnit' => 100,
|
285 |
+
),
|
286 |
+
'CUP' => array(
|
287 |
+
'name' => 'Cuban Peso',
|
288 |
+
'numericCode' => 192,
|
289 |
+
'fractionDecimals' => 2,
|
290 |
+
'fractionUnit' => 100,
|
291 |
+
),
|
292 |
+
'CVE' => array(
|
293 |
+
'name' => 'Cape Verde Escudo',
|
294 |
+
'numericCode' => 132,
|
295 |
+
'fractionDecimals' => 2,
|
296 |
+
'fractionUnit' => 100,
|
297 |
+
),
|
298 |
+
'CZK' => array(
|
299 |
+
'name' => 'Czech Koruna',
|
300 |
+
'numericCode' => 203,
|
301 |
+
'fractionDecimals' => 2,
|
302 |
+
'fractionUnit' => 100,
|
303 |
+
),
|
304 |
+
'DJF' => array(
|
305 |
+
'name' => 'Djibouti Franc',
|
306 |
+
'numericCode' => 262,
|
307 |
+
'fractionDecimals' => 0,
|
308 |
+
'fractionUnit' => 100,
|
309 |
+
),
|
310 |
+
'DKK' => array(
|
311 |
+
'name' => 'Danish Krone',
|
312 |
+
'numericCode' => 208,
|
313 |
+
'fractionDecimals' => 2,
|
314 |
+
'fractionUnit' => 100,
|
315 |
+
),
|
316 |
+
'DOP' => array(
|
317 |
+
'name' => 'Dominican Peso',
|
318 |
+
'numericCode' => 214,
|
319 |
+
'fractionDecimals' => 2,
|
320 |
+
'fractionUnit' => 100,
|
321 |
+
),
|
322 |
+
'DZD' => array(
|
323 |
+
'name' => 'Algerian Dinar',
|
324 |
+
'numericCode' => 12,
|
325 |
+
'fractionDecimals' => 2,
|
326 |
+
'fractionUnit' => 100,
|
327 |
+
),
|
328 |
+
'EGP' => array(
|
329 |
+
'name' => 'Egyptian Pound',
|
330 |
+
'numericCode' => 818,
|
331 |
+
'fractionDecimals' => 2,
|
332 |
+
'fractionUnit' => 100,
|
333 |
+
),
|
334 |
+
'ERN' => array(
|
335 |
+
'name' => 'Nakfa',
|
336 |
+
'numericCode' => 232,
|
337 |
+
'fractionDecimals' => 2,
|
338 |
+
'fractionUnit' => 100,
|
339 |
+
),
|
340 |
+
'ETB' => array(
|
341 |
+
'name' => 'Ethiopian Birr',
|
342 |
+
'numericCode' => 230,
|
343 |
+
'fractionDecimals' => 2,
|
344 |
+
'fractionUnit' => 100,
|
345 |
+
),
|
346 |
+
'EUR' => array(
|
347 |
+
'name' => 'Euro',
|
348 |
+
'numericCode' => 978,
|
349 |
+
'fractionDecimals' => 2,
|
350 |
+
'fractionUnit' => 100,
|
351 |
+
),
|
352 |
+
'FJD' => array(
|
353 |
+
'name' => 'Fiji Dollar',
|
354 |
+
'numericCode' => 242,
|
355 |
+
'fractionDecimals' => 2,
|
356 |
+
'fractionUnit' => 100,
|
357 |
+
),
|
358 |
+
'FKP' => array(
|
359 |
+
'name' => 'Falkland Islands Pound',
|
360 |
+
'numericCode' => 238,
|
361 |
+
'fractionDecimals' => 2,
|
362 |
+
'fractionUnit' => 100,
|
363 |
+
),
|
364 |
+
'GBP' => array(
|
365 |
+
'name' => 'Pound Sterling',
|
366 |
+
'numericCode' => 826,
|
367 |
+
'fractionDecimals' => 2,
|
368 |
+
'fractionUnit' => 100,
|
369 |
+
),
|
370 |
+
'GEL' => array(
|
371 |
+
'name' => 'Lari',
|
372 |
+
'numericCode' => 981,
|
373 |
+
'fractionDecimals' => 2,
|
374 |
+
'fractionUnit' => 100,
|
375 |
+
),
|
376 |
+
'GHS' => array(
|
377 |
+
'name' => 'Ghana Cedi',
|
378 |
+
'numericCode' => 936,
|
379 |
+
'fractionDecimals' => 2,
|
380 |
+
'fractionUnit' => 100,
|
381 |
+
),
|
382 |
+
'GIP' => array(
|
383 |
+
'name' => 'Gibraltar Pound',
|
384 |
+
'numericCode' => 292,
|
385 |
+
'fractionDecimals' => 2,
|
386 |
+
'fractionUnit' => 100,
|
387 |
+
),
|
388 |
+
'GMD' => array(
|
389 |
+
'name' => 'Dalasi',
|
390 |
+
'numericCode' => 270,
|
391 |
+
'fractionDecimals' => 2,
|
392 |
+
'fractionUnit' => 100,
|
393 |
+
),
|
394 |
+
'GNF' => array(
|
395 |
+
'name' => 'Guinea Franc',
|
396 |
+
'numericCode' => 324,
|
397 |
+
'fractionDecimals' => 0,
|
398 |
+
'fractionUnit' => 100,
|
399 |
+
),
|
400 |
+
'GTQ' => array(
|
401 |
+
'name' => 'Quetzal',
|
402 |
+
'numericCode' => 320,
|
403 |
+
'fractionDecimals' => 2,
|
404 |
+
'fractionUnit' => 100,
|
405 |
+
),
|
406 |
+
'GYD' => array(
|
407 |
+
'name' => 'Guyana Dollar',
|
408 |
+
'numericCode' => 328,
|
409 |
+
'fractionDecimals' => 2,
|
410 |
+
'fractionUnit' => 100,
|
411 |
+
),
|
412 |
+
'HKD' => array(
|
413 |
+
'name' => 'Hong Kong Dollar',
|
414 |
+
'numericCode' => 344,
|
415 |
+
'fractionDecimals' => 2,
|
416 |
+
'fractionUnit' => 100,
|
417 |
+
),
|
418 |
+
'HNL' => array(
|
419 |
+
'name' => 'Lempira',
|
420 |
+
'numericCode' => 340,
|
421 |
+
'fractionDecimals' => 2,
|
422 |
+
'fractionUnit' => 100,
|
423 |
+
),
|
424 |
+
'HRK' => array(
|
425 |
+
'name' => 'Croatian Kuna',
|
426 |
+
'numericCode' => 191,
|
427 |
+
'fractionDecimals' => 2,
|
428 |
+
'fractionUnit' => 100,
|
429 |
+
),
|
430 |
+
'HTG' => array(
|
431 |
+
'name' => 'Gourde',
|
432 |
+
'numericCode' => 332,
|
433 |
+
'fractionDecimals' => 2,
|
434 |
+
'fractionUnit' => 100,
|
435 |
+
),
|
436 |
+
'HUF' => array(
|
437 |
+
'name' => 'Forint',
|
438 |
+
'numericCode' => 348,
|
439 |
+
'fractionDecimals' => 2,
|
440 |
+
'fractionUnit' => 100,
|
441 |
+
),
|
442 |
+
'IDR' => array(
|
443 |
+
'name' => 'Rupiah',
|
444 |
+
'numericCode' => 360,
|
445 |
+
'fractionDecimals' => 2,
|
446 |
+
'fractionUnit' => 100,
|
447 |
+
),
|
448 |
+
'ILS' => array(
|
449 |
+
'name' => 'New Israeli Sheqel',
|
450 |
+
'numericCode' => 376,
|
451 |
+
'fractionDecimals' => 2,
|
452 |
+
'fractionUnit' => 100,
|
453 |
+
),
|
454 |
+
'INR' => array(
|
455 |
+
'name' => 'Indian Rupee',
|
456 |
+
'numericCode' => 356,
|
457 |
+
'fractionDecimals' => 2,
|
458 |
+
'fractionUnit' => 100,
|
459 |
+
),
|
460 |
+
'IQD' => array(
|
461 |
+
'name' => 'Iraqi Dinar',
|
462 |
+
'numericCode' => 368,
|
463 |
+
'fractionDecimals' => 3,
|
464 |
+
'fractionUnit' => 1000,
|
465 |
+
),
|
466 |
+
'IRR' => array(
|
467 |
+
'name' => 'Iranian Rial',
|
468 |
+
'numericCode' => 364,
|
469 |
+
'fractionDecimals' => 2,
|
470 |
+
'fractionUnit' => 100,
|
471 |
+
),
|
472 |
+
'ISK' => array(
|
473 |
+
'name' => 'Iceland Krona',
|
474 |
+
'numericCode' => 352,
|
475 |
+
'fractionDecimals' => 0,
|
476 |
+
'fractionUnit' => 100,
|
477 |
+
),
|
478 |
+
'JMD' => array(
|
479 |
+
'name' => 'Jamaican Dollar',
|
480 |
+
'numericCode' => 388,
|
481 |
+
'fractionDecimals' => 2,
|
482 |
+
'fractionUnit' => 100,
|
483 |
+
),
|
484 |
+
'JOD' => array(
|
485 |
+
'name' => 'Jordanian Dinar',
|
486 |
+
'numericCode' => 400,
|
487 |
+
'fractionDecimals' => 3,
|
488 |
+
'fractionUnit' => 100,
|
489 |
+
),
|
490 |
+
'JPY' => array(
|
491 |
+
'name' => 'Yen',
|
492 |
+
'numericCode' => 392,
|
493 |
+
'fractionDecimals' => 0,
|
494 |
+
'fractionUnit' => 1,
|
495 |
+
),
|
496 |
+
'KES' => array(
|
497 |
+
'name' => 'Kenyan Shilling',
|
498 |
+
'numericCode' => 404,
|
499 |
+
'fractionDecimals' => 2,
|
500 |
+
'fractionUnit' => 100,
|
501 |
+
),
|
502 |
+
'KGS' => array(
|
503 |
+
'name' => 'Som',
|
504 |
+
'numericCode' => 417,
|
505 |
+
'fractionDecimals' => 2,
|
506 |
+
'fractionUnit' => 100,
|
507 |
+
),
|
508 |
+
'KHR' => array(
|
509 |
+
'name' => 'Riel',
|
510 |
+
'numericCode' => 116,
|
511 |
+
'fractionDecimals' => 2,
|
512 |
+
'fractionUnit' => 100,
|
513 |
+
),
|
514 |
+
'KMF' => array(
|
515 |
+
'name' => 'Comoro Franc',
|
516 |
+
'numericCode' => 174,
|
517 |
+
'fractionDecimals' => 0,
|
518 |
+
'fractionUnit' => 100,
|
519 |
+
),
|
520 |
+
'KPW' => array(
|
521 |
+
'name' => 'North Korean Won',
|
522 |
+
'numericCode' => 408,
|
523 |
+
'fractionDecimals' => 2,
|
524 |
+
'fractionUnit' => 100,
|
525 |
+
),
|
526 |
+
'KRW' => array(
|
527 |
+
'name' => 'Won',
|
528 |
+
'numericCode' => 410,
|
529 |
+
'fractionDecimals' => 0,
|
530 |
+
'fractionUnit' => 100,
|
531 |
+
),
|
532 |
+
'KWD' => array(
|
533 |
+
'name' => 'Kuwaiti Dinar',
|
534 |
+
'numericCode' => 414,
|
535 |
+
'fractionDecimals' => 3,
|
536 |
+
'fractionUnit' => 1000,
|
537 |
+
),
|
538 |
+
'KYD' => array(
|
539 |
+
'name' => 'Cayman Islands Dollar',
|
540 |
+
'numericCode' => 136,
|
541 |
+
'fractionDecimals' => 2,
|
542 |
+
'fractionUnit' => 100,
|
543 |
+
),
|
544 |
+
'KZT' => array(
|
545 |
+
'name' => 'Tenge',
|
546 |
+
'numericCode' => 398,
|
547 |
+
'fractionDecimals' => 2,
|
548 |
+
'fractionUnit' => 100,
|
549 |
+
),
|
550 |
+
'LAK' => array(
|
551 |
+
'name' => 'Kip',
|
552 |
+
'numericCode' => 418,
|
553 |
+
'fractionDecimals' => 2,
|
554 |
+
'fractionUnit' => 100,
|
555 |
+
),
|
556 |
+
'LBP' => array(
|
557 |
+
'name' => 'Lebanese Pound',
|
558 |
+
'numericCode' => 422,
|
559 |
+
'fractionDecimals' => 2,
|
560 |
+
'fractionUnit' => 100,
|
561 |
+
),
|
562 |
+
'LKR' => array(
|
563 |
+
'name' => 'Sri Lanka Rupee',
|
564 |
+
'numericCode' => 144,
|
565 |
+
'fractionDecimals' => 2,
|
566 |
+
'fractionUnit' => 100,
|
567 |
+
),
|
568 |
+
'LRD' => array(
|
569 |
+
'name' => 'Liberian Dollar',
|
570 |
+
'numericCode' => 430,
|
571 |
+
'fractionDecimals' => 2,
|
572 |
+
'fractionUnit' => 100,
|
573 |
+
),
|
574 |
+
'LSL' => array(
|
575 |
+
'name' => 'Loti',
|
576 |
+
'numericCode' => 426,
|
577 |
+
'fractionDecimals' => 2,
|
578 |
+
'fractionUnit' => 100,
|
579 |
+
),
|
580 |
+
'LYD' => array(
|
581 |
+
'name' => 'Libyan Dinar',
|
582 |
+
'numericCode' => 434,
|
583 |
+
'fractionDecimals' => 3,
|
584 |
+
'fractionUnit' => 1000,
|
585 |
+
),
|
586 |
+
'MAD' => array(
|
587 |
+
'name' => 'Moroccan Dirham',
|
588 |
+
'numericCode' => 504,
|
589 |
+
'fractionDecimals' => 2,
|
590 |
+
'fractionUnit' => 100,
|
591 |
+
),
|
592 |
+
'MDL' => array(
|
593 |
+
'name' => 'Moldovan Leu',
|
594 |
+
'numericCode' => 498,
|
595 |
+
'fractionDecimals' => 2,
|
596 |
+
'fractionUnit' => 100,
|
597 |
+
),
|
598 |
+
'MGA' => array(
|
599 |
+
'name' => 'Malagasy Ariary',
|
600 |
+
'numericCode' => 969,
|
601 |
+
'fractionDecimals' => 2,
|
602 |
+
'fractionUnit' => 5,
|
603 |
+
),
|
604 |
+
'MKD' => array(
|
605 |
+
'name' => 'Denar',
|
606 |
+
'numericCode' => 807,
|
607 |
+
'fractionDecimals' => 2,
|
608 |
+
'fractionUnit' => 100,
|
609 |
+
),
|
610 |
+
'MMK' => array(
|
611 |
+
'name' => 'Kyat',
|
612 |
+
'numericCode' => 104,
|
613 |
+
'fractionDecimals' => 2,
|
614 |
+
'fractionUnit' => 100,
|
615 |
+
),
|
616 |
+
'MNT' => array(
|
617 |
+
'name' => 'Tugrik',
|
618 |
+
'numericCode' => 496,
|
619 |
+
'fractionDecimals' => 2,
|
620 |
+
'fractionUnit' => 100,
|
621 |
+
),
|
622 |
+
'MOP' => array(
|
623 |
+
'name' => 'Pataca',
|
624 |
+
'numericCode' => 446,
|
625 |
+
'fractionDecimals' => 2,
|
626 |
+
'fractionUnit' => 100,
|
627 |
+
),
|
628 |
+
'MRO' => array(
|
629 |
+
'name' => 'Ouguiya',
|
630 |
+
'numericCode' => 478,
|
631 |
+
'fractionDecimals' => 2,
|
632 |
+
'fractionUnit' => 5,
|
633 |
+
),
|
634 |
+
'MUR' => array(
|
635 |
+
'name' => 'Mauritius Rupee',
|
636 |
+
'numericCode' => 480,
|
637 |
+
'fractionDecimals' => 2,
|
638 |
+
'fractionUnit' => 100,
|
639 |
+
),
|
640 |
+
'MVR' => array(
|
641 |
+
'name' => 'Rufiyaa',
|
642 |
+
'numericCode' => 462,
|
643 |
+
'fractionDecimals' => 2,
|
644 |
+
'fractionUnit' => 100,
|
645 |
+
),
|
646 |
+
'MWK' => array(
|
647 |
+
'name' => 'Kwacha',
|
648 |
+
'numericCode' => 454,
|
649 |
+
'fractionDecimals' => 2,
|
650 |
+
'fractionUnit' => 100,
|
651 |
+
),
|
652 |
+
'MXN' => array(
|
653 |
+
'name' => 'Mexican Peso',
|
654 |
+
'numericCode' => 484,
|
655 |
+
'fractionDecimals' => 2,
|
656 |
+
'fractionUnit' => 100,
|
657 |
+
),
|
658 |
+
'MXV' => array(
|
659 |
+
'name' => 'Mexican Unidad de Inversion (UDI)',
|
660 |
+
'numericCode' => 979,
|
661 |
+
'fractionDecimals' => 2,
|
662 |
+
'fractionUnit' => 100,
|
663 |
+
),
|
664 |
+
'MYR' => array(
|
665 |
+
'name' => 'Malaysian Ringgit',
|
666 |
+
'numericCode' => 458,
|
667 |
+
'fractionDecimals' => 2,
|
668 |
+
'fractionUnit' => 100,
|
669 |
+
),
|
670 |
+
'MZN' => array(
|
671 |
+
'name' => 'Mozambique Metical',
|
672 |
+
'numericCode' => 943,
|
673 |
+
'fractionDecimals' => 2,
|
674 |
+
'fractionUnit' => 100,
|
675 |
+
),
|
676 |
+
'NAD' => array(
|
677 |
+
'name' => 'Namibia Dollar',
|
678 |
+
'numericCode' => 516,
|
679 |
+
'fractionDecimals' => 2,
|
680 |
+
'fractionUnit' => 100,
|
681 |
+
),
|
682 |
+
'NGN' => array(
|
683 |
+
'name' => 'Naira',
|
684 |
+
'numericCode' => 566,
|
685 |
+
'fractionDecimals' => 2,
|
686 |
+
'fractionUnit' => 100,
|
687 |
+
),
|
688 |
+
'NIO' => array(
|
689 |
+
'name' => 'Cordoba Oro',
|
690 |
+
'numericCode' => 558,
|
691 |
+
'fractionDecimals' => 2,
|
692 |
+
'fractionUnit' => 100,
|
693 |
+
),
|
694 |
+
'NOK' => array(
|
695 |
+
'name' => 'Norwegian Krone',
|
696 |
+
'numericCode' => 578,
|
697 |
+
'fractionDecimals' => 2,
|
698 |
+
'fractionUnit' => 100,
|
699 |
+
),
|
700 |
+
'NPR' => array(
|
701 |
+
'name' => 'Nepalese Rupee',
|
702 |
+
'numericCode' => 524,
|
703 |
+
'fractionDecimals' => 2,
|
704 |
+
'fractionUnit' => 100,
|
705 |
+
),
|
706 |
+
'NZD' => array(
|
707 |
+
'name' => 'New Zealand Dollar',
|
708 |
+
'numericCode' => 554,
|
709 |
+
'fractionDecimals' => 2,
|
710 |
+
'fractionUnit' => 100,
|
711 |
+
),
|
712 |
+
'OMR' => array(
|
713 |
+
'name' => 'Rial Omani',
|
714 |
+
'numericCode' => 512,
|
715 |
+
'fractionDecimals' => 3,
|
716 |
+
'fractionUnit' => 1000,
|
717 |
+
),
|
718 |
+
'PAB' => array(
|
719 |
+
'name' => 'Balboa',
|
720 |
+
'numericCode' => 590,
|
721 |
+
'fractionDecimals' => 2,
|
722 |
+
'fractionUnit' => 100,
|
723 |
+
),
|
724 |
+
'PEN' => array(
|
725 |
+
'name' => 'Nuevo Sol',
|
726 |
+
'numericCode' => 604,
|
727 |
+
'fractionDecimals' => 2,
|
728 |
+
'fractionUnit' => 100,
|
729 |
+
),
|
730 |
+
'PGK' => array(
|
731 |
+
'name' => 'Kina',
|
732 |
+
'numericCode' => 598,
|
733 |
+
'fractionDecimals' => 2,
|
734 |
+
'fractionUnit' => 100,
|
735 |
+
),
|
736 |
+
'PHP' => array(
|
737 |
+
'name' => 'Philippine Peso',
|
738 |
+
'numericCode' => 608,
|
739 |
+
'fractionDecimals' => 2,
|
740 |
+
'fractionUnit' => 100,
|
741 |
+
),
|
742 |
+
'PKR' => array(
|
743 |
+
'name' => 'Pakistan Rupee',
|
744 |
+
'numericCode' => 586,
|
745 |
+
'fractionDecimals' => 2,
|
746 |
+
'fractionUnit' => 100,
|
747 |
+
),
|
748 |
+
'PLN' => array(
|
749 |
+
'name' => 'Zloty',
|
750 |
+
'numericCode' => 985,
|
751 |
+
'fractionDecimals' => 2,
|
752 |
+
'fractionUnit' => 100,
|
753 |
+
),
|
754 |
+
'PYG' => array(
|
755 |
+
'name' => 'Guarani',
|
756 |
+
'numericCode' => 600,
|
757 |
+
'fractionDecimals' => 0,
|
758 |
+
'fractionUnit' => 100,
|
759 |
+
),
|
760 |
+
'QAR' => array(
|
761 |
+
'name' => 'Qatari Rial',
|
762 |
+
'numericCode' => 634,
|
763 |
+
'fractionDecimals' => 2,
|
764 |
+
'fractionUnit' => 100,
|
765 |
+
),
|
766 |
+
'RON' => array(
|
767 |
+
'name' => 'New Romanian Leu',
|
768 |
+
'numericCode' => 946,
|
769 |
+
'fractionDecimals' => 2,
|
770 |
+
'fractionUnit' => 100,
|
771 |
+
),
|
772 |
+
'RSD' => array(
|
773 |
+
'name' => 'Serbian Dinar',
|
774 |
+
'numericCode' => 941,
|
775 |
+
'fractionDecimals' => 2,
|
776 |
+
'fractionUnit' => 100,
|
777 |
+
),
|
778 |
+
'RUB' => array(
|
779 |
+
'name' => 'Russian Ruble',
|
780 |
+
'numericCode' => 643,
|
781 |
+
'fractionDecimals' => 2,
|
782 |
+
'fractionUnit' => 100,
|
783 |
+
),
|
784 |
+
'RWF' => array(
|
785 |
+
'name' => 'Rwanda Franc',
|
786 |
+
'numericCode' => 646,
|
787 |
+
'fractionDecimals' => 0,
|
788 |
+
'fractionUnit' => 100,
|
789 |
+
),
|
790 |
+
'SAR' => array(
|
791 |
+
'name' => 'Saudi Riyal',
|
792 |
+
'numericCode' => 682,
|
793 |
+
'fractionDecimals' => 2,
|
794 |
+
'fractionUnit' => 100,
|
795 |
+
),
|
796 |
+
'SBD' => array(
|
797 |
+
'name' => 'Solomon Islands Dollar',
|
798 |
+
'numericCode' => 90,
|
799 |
+
'fractionDecimals' => 2,
|
800 |
+
'fractionUnit' => 100,
|
801 |
+
),
|
802 |
+
'SCR' => array(
|
803 |
+
'name' => 'Seychelles Rupee',
|
804 |
+
'numericCode' => 690,
|
805 |
+
'fractionDecimals' => 2,
|
806 |
+
'fractionUnit' => 100,
|
807 |
+
),
|
808 |
+
'SDG' => array(
|
809 |
+
'name' => 'Sudanese Pound',
|
810 |
+
'numericCode' => 938,
|
811 |
+
'fractionDecimals' => 2,
|
812 |
+
'fractionUnit' => 100,
|
813 |
+
),
|
814 |
+
'SEK' => array(
|
815 |
+
'name' => 'Swedish Krona',
|
816 |
+
'numericCode' => 752,
|
817 |
+
'fractionDecimals' => 2,
|
818 |
+
'fractionUnit' => 100,
|
819 |
+
),
|
820 |
+
'SGD' => array(
|
821 |
+
'name' => 'Singapore Dollar',
|
822 |
+
'numericCode' => 702,
|
823 |
+
'fractionDecimals' => 2,
|
824 |
+
'fractionUnit' => 100,
|
825 |
+
),
|
826 |
+
'SHP' => array(
|
827 |
+
'name' => 'Saint Helena Pound',
|
828 |
+
'numericCode' => 654,
|
829 |
+
'fractionDecimals' => 2,
|
830 |
+
'fractionUnit' => 100,
|
831 |
+
),
|
832 |
+
'SLL' => array(
|
833 |
+
'name' => 'Leone',
|
834 |
+
'numericCode' => 694,
|
835 |
+
'fractionDecimals' => 2,
|
836 |
+
'fractionUnit' => 100,
|
837 |
+
),
|
838 |
+
'SOS' => array(
|
839 |
+
'name' => 'Somali Shilling',
|
840 |
+
'numericCode' => 706,
|
841 |
+
'fractionDecimals' => 2,
|
842 |
+
'fractionUnit' => 100,
|
843 |
+
),
|
844 |
+
'SRD' => array(
|
845 |
+
'name' => 'Surinam Dollar',
|
846 |
+
'numericCode' => 968,
|
847 |
+
'fractionDecimals' => 2,
|
848 |
+
'fractionUnit' => 100,
|
849 |
+
),
|
850 |
+
'SSP' => array(
|
851 |
+
'name' => 'South Sudanese Pound',
|
852 |
+
'numericCode' => 728,
|
853 |
+
'fractionDecimals' => 2,
|
854 |
+
'fractionUnit' => 100,
|
855 |
+
),
|
856 |
+
'STD' => array(
|
857 |
+
'name' => 'Dobra',
|
858 |
+
'numericCode' => 678,
|
859 |
+
'fractionDecimals' => 2,
|
860 |
+
'fractionUnit' => 100,
|
861 |
+
),
|
862 |
+
'SYP' => array(
|
863 |
+
'name' => 'Syrian Pound',
|
864 |
+
'numericCode' => 760,
|
865 |
+
'fractionDecimals' => 2,
|
866 |
+
'fractionUnit' => 100,
|
867 |
+
),
|
868 |
+
'SZL' => array(
|
869 |
+
'name' => 'Lilangeni',
|
870 |
+
'numericCode' => 748,
|
871 |
+
'fractionDecimals' => 2,
|
872 |
+
'fractionUnit' => 100,
|
873 |
+
),
|
874 |
+
'THB' => array(
|
875 |
+
'name' => 'Baht',
|
876 |
+
'numericCode' => 764,
|
877 |
+
'fractionDecimals' => 2,
|
878 |
+
'fractionUnit' => 100,
|
879 |
+
),
|
880 |
+
'TJS' => array(
|
881 |
+
'name' => 'Somoni',
|
882 |
+
'numericCode' => 972,
|
883 |
+
'fractionDecimals' => 2,
|
884 |
+
'fractionUnit' => 100,
|
885 |
+
),
|
886 |
+
'TMT' => array(
|
887 |
+
'name' => 'Turkmenistan New Manat',
|
888 |
+
'numericCode' => 934,
|
889 |
+
'fractionDecimals' => 2,
|
890 |
+
'fractionUnit' => 100,
|
891 |
+
),
|
892 |
+
'TND' => array(
|
893 |
+
'name' => 'Tunisian Dinar',
|
894 |
+
'numericCode' => 788,
|
895 |
+
'fractionDecimals' => 3,
|
896 |
+
'fractionUnit' => 1000,
|
897 |
+
),
|
898 |
+
'TOP' => array(
|
899 |
+
'name' => 'Pa’anga',
|
900 |
+
'numericCode' => 776,
|
901 |
+
'fractionDecimals' => 2,
|
902 |
+
'fractionUnit' => 100,
|
903 |
+
),
|
904 |
+
'TRY' => array(
|
905 |
+
'name' => 'Turkish Lira',
|
906 |
+
'numericCode' => 949,
|
907 |
+
'fractionDecimals' => 2,
|
908 |
+
'fractionUnit' => 100,
|
909 |
+
),
|
910 |
+
'TTD' => array(
|
911 |
+
'name' => 'Trinidad and Tobago Dollar',
|
912 |
+
'numericCode' => 780,
|
913 |
+
'fractionDecimals' => 2,
|
914 |
+
'fractionUnit' => 100,
|
915 |
+
),
|
916 |
+
'TWD' => array(
|
917 |
+
'name' => 'New Taiwan Dollar',
|
918 |
+
'numericCode' => 901,
|
919 |
+
'fractionDecimals' => 2,
|
920 |
+
'fractionUnit' => 100,
|
921 |
+
),
|
922 |
+
'TZS' => array(
|
923 |
+
'name' => 'Tanzanian Shilling',
|
924 |
+
'numericCode' => 834,
|
925 |
+
'fractionDecimals' => 2,
|
926 |
+
'fractionUnit' => 100,
|
927 |
+
),
|
928 |
+
'UAH' => array(
|
929 |
+
'name' => 'Hryvnia',
|
930 |
+
'numericCode' => 980,
|
931 |
+
'fractionDecimals' => 2,
|
932 |
+
'fractionUnit' => 100,
|
933 |
+
),
|
934 |
+
'UGX' => array(
|
935 |
+
'name' => 'Uganda Shilling',
|
936 |
+
'numericCode' => 800,
|
937 |
+
'fractionDecimals' => 0,
|
938 |
+
'fractionUnit' => 100,
|
939 |
+
),
|
940 |
+
'USD' => array(
|
941 |
+
'name' => 'US Dollar',
|
942 |
+
'numericCode' => 840,
|
943 |
+
'fractionDecimals' => 2,
|
944 |
+
'fractionUnit' => 100,
|
945 |
+
),
|
946 |
+
'USN' => array(
|
947 |
+
'name' => 'US Dollar (Next day)',
|
948 |
+
'numericCode' => 997,
|
949 |
+
'fractionDecimals' => 2,
|
950 |
+
'fractionUnit' => 100,
|
951 |
+
),
|
952 |
+
'USS' => array(
|
953 |
+
'name' => 'US Dollar (Same day)',
|
954 |
+
'numericCode' => 998,
|
955 |
+
'fractionDecimals' => 2,
|
956 |
+
'fractionUnit' => 100,
|
957 |
+
),
|
958 |
+
'UYI' => array(
|
959 |
+
'name' => 'Uruguay Peso en Unidades Indexadas (URUIURUI)',
|
960 |
+
'numericCode' => 940,
|
961 |
+
'fractionDecimals' => 0,
|
962 |
+
'fractionUnit' => 100,
|
963 |
+
),
|
964 |
+
'UYU' => array(
|
965 |
+
'name' => 'Peso Uruguayo',
|
966 |
+
'numericCode' => 858,
|
967 |
+
'fractionDecimals' => 2,
|
968 |
+
'fractionUnit' => 100,
|
969 |
+
),
|
970 |
+
'UZS' => array(
|
971 |
+
'name' => 'Uzbekistan Sum',
|
972 |
+
'numericCode' => 860,
|
973 |
+
'fractionDecimals' => 2,
|
974 |
+
'fractionUnit' => 100,
|
975 |
+
),
|
976 |
+
'VEF' => array(
|
977 |
+
'name' => 'Bolivar',
|
978 |
+
'numericCode' => 937,
|
979 |
+
'fractionDecimals' => 2,
|
980 |
+
'fractionUnit' => 100,
|
981 |
+
),
|
982 |
+
'VND' => array(
|
983 |
+
'name' => 'Dong',
|
984 |
+
'numericCode' => 704,
|
985 |
+
'fractionDecimals' => 0,
|
986 |
+
'fractionUnit' => 10,
|
987 |
+
),
|
988 |
+
'VUV' => array(
|
989 |
+
'name' => 'Vatu',
|
990 |
+
'numericCode' => 548,
|
991 |
+
'fractionDecimals' => 0,
|
992 |
+
'fractionUnit' => 1,
|
993 |
+
),
|
994 |
+
'WST' => array(
|
995 |
+
'name' => 'Tala',
|
996 |
+
'numericCode' => 882,
|
997 |
+
'fractionDecimals' => 2,
|
998 |
+
'fractionUnit' => 100,
|
999 |
+
),
|
1000 |
+
'XAF' => array(
|
1001 |
+
'name' => 'CFA Franc BEAC',
|
1002 |
+
'numericCode' => 950,
|
1003 |
+
'fractionDecimals' => 0,
|
1004 |
+
'fractionUnit' => 100,
|
1005 |
+
),
|
1006 |
+
'XAG' => array(
|
1007 |
+
'name' => 'Silver',
|
1008 |
+
'numericCode' => 961,
|
1009 |
+
'fractionDecimals' => 0,
|
1010 |
+
'fractionUnit' => 100,
|
1011 |
+
),
|
1012 |
+
'XAU' => array(
|
1013 |
+
'name' => 'Gold',
|
1014 |
+
'numericCode' => 959,
|
1015 |
+
'fractionDecimals' => 0,
|
1016 |
+
'fractionUnit' => 100,
|
1017 |
+
),
|
1018 |
+
'XBA' => array(
|
1019 |
+
'name' => 'Bond Markets Unit European Composite Unit (EURCO)',
|
1020 |
+
'numericCode' => 955,
|
1021 |
+
'fractionDecimals' => 0,
|
1022 |
+
'fractionUnit' => 100,
|
1023 |
+
),
|
1024 |
+
'XBB' => array(
|
1025 |
+
'name' => 'Bond Markets Unit European Monetary Unit (E.M.U.-6)',
|
1026 |
+
'numericCode' => 956,
|
1027 |
+
'fractionDecimals' => 0,
|
1028 |
+
'fractionUnit' => 100,
|
1029 |
+
),
|
1030 |
+
'XBC' => array(
|
1031 |
+
'name' => 'Bond Markets Unit European Unit of Account 9 (E.U.A.-9)',
|
1032 |
+
'numericCode' => 957,
|
1033 |
+
'fractionDecimals' => 0,
|
1034 |
+
'fractionUnit' => 100,
|
1035 |
+
),
|
1036 |
+
'XBD' => array(
|
1037 |
+
'name' => 'Bond Markets Unit European Unit of Account 17 (E.U.A.-17)',
|
1038 |
+
'numericCode' => 958,
|
1039 |
+
'fractionDecimals' => 0,
|
1040 |
+
'fractionUnit' => 100,
|
1041 |
+
),
|
1042 |
+
'XCD' => array(
|
1043 |
+
'name' => 'East Caribbean Dollar',
|
1044 |
+
'numericCode' => 951,
|
1045 |
+
'fractionDecimals' => 2,
|
1046 |
+
'fractionUnit' => 100,
|
1047 |
+
),
|
1048 |
+
'XDR' => array(
|
1049 |
+
'name' => 'SDR (Special Drawing Right)',
|
1050 |
+
'numericCode' => 960,
|
1051 |
+
'fractionDecimals' => 0,
|
1052 |
+
'fractionUnit' => 100,
|
1053 |
+
),
|
1054 |
+
'XFU' => array(
|
1055 |
+
'name' => 'UIC-Franc',
|
1056 |
+
'numericCode' => 958,
|
1057 |
+
'fractionDecimals' => 0,
|
1058 |
+
'fractionUnit' => 100,
|
1059 |
+
),
|
1060 |
+
'XOF' => array(
|
1061 |
+
'name' => 'CFA Franc BCEAO',
|
1062 |
+
'numericCode' => 952,
|
1063 |
+
'fractionDecimals' => 0,
|
1064 |
+
'fractionUnit' => 100,
|
1065 |
+
),
|
1066 |
+
'XPD' => array(
|
1067 |
+
'name' => 'Palladium',
|
1068 |
+
'numericCode' => 964,
|
1069 |
+
'fractionDecimals' => 0,
|
1070 |
+
'fractionUnit' => 100,
|
1071 |
+
),
|
1072 |
+
'XPF' => array(
|
1073 |
+
'name' => 'CFP Franc',
|
1074 |
+
'numericCode' => 953,
|
1075 |
+
'fractionDecimals' => 0,
|
1076 |
+
'fractionUnit' => 100,
|
1077 |
+
),
|
1078 |
+
'XPT' => array(
|
1079 |
+
'name' => 'Platinum',
|
1080 |
+
'numericCode' => 962,
|
1081 |
+
'fractionDecimals' => 0,
|
1082 |
+
'fractionUnit' => 100,
|
1083 |
+
),
|
1084 |
+
'XSU' => array(
|
1085 |
+
'name' => 'Sucre',
|
1086 |
+
'numericCode' => 994,
|
1087 |
+
'fractionDecimals' => 0,
|
1088 |
+
'fractionUnit' => 100,
|
1089 |
+
),
|
1090 |
+
'XTS' => array(
|
1091 |
+
'name' => 'Codes specifically reserved for testing purposes',
|
1092 |
+
'numericCode' => 963,
|
1093 |
+
'fractionDecimals' => 0,
|
1094 |
+
'fractionUnit' => 100,
|
1095 |
+
),
|
1096 |
+
'XUA' => array(
|
1097 |
+
'name' => 'ADB Unit of Account',
|
1098 |
+
'numericCode' => 965,
|
1099 |
+
'fractionDecimals' => 0,
|
1100 |
+
'fractionUnit' => 100,
|
1101 |
+
),
|
1102 |
+
'XXX' => array(
|
1103 |
+
'name' => 'The codes assigned for transactions where no currency is involved',
|
1104 |
+
'numericCode' => 999,
|
1105 |
+
'fractionDecimals' => 0,
|
1106 |
+
'fractionUnit' => 100,
|
1107 |
+
),
|
1108 |
+
'YER' => array(
|
1109 |
+
'name' => 'Yemeni Rial',
|
1110 |
+
'numericCode' => 886,
|
1111 |
+
'fractionDecimals' => 2,
|
1112 |
+
'fractionUnit' => 100,
|
1113 |
+
),
|
1114 |
+
'ZAR' => array(
|
1115 |
+
'name' => 'Rand',
|
1116 |
+
'numericCode' => 710,
|
1117 |
+
'fractionDecimals' => 2,
|
1118 |
+
'fractionUnit' => 100,
|
1119 |
+
),
|
1120 |
+
'ZMW' => array(
|
1121 |
+
'name' => 'Zambian Kwacha',
|
1122 |
+
'numericCode' => 967,
|
1123 |
+
'fractionDecimals' => 2,
|
1124 |
+
'fractionUnit' => 100,
|
1125 |
+
)
|
1126 |
+
);
|
1127 |
+
|
1128 |
+
/**
|
1129 |
+
* Returns the currency fraction unit.
|
1130 |
+
*
|
1131 |
+
* @param NostoCurrencyCode $code the currency code.
|
1132 |
+
* @return int the currency fraction unit.
|
1133 |
+
*
|
1134 |
+
* @throws NostoException
|
1135 |
+
*/
|
1136 |
+
public static function getFractionUnit(NostoCurrencyCode $code)
|
1137 |
+
{
|
1138 |
+
self::assertCurrency($code);
|
1139 |
+
return self::$data[$code->getCode()]['fractionUnit'];
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
/**
|
1143 |
+
* Returns the currency default fraction digit.
|
1144 |
+
*
|
1145 |
+
* @param NostoCurrencyCode $code the currency code.
|
1146 |
+
* @return int the currency fraction digit.
|
1147 |
+
*
|
1148 |
+
* @throws NostoException
|
1149 |
+
*/
|
1150 |
+
public static function getFractionDecimals(NostoCurrencyCode $code)
|
1151 |
+
{
|
1152 |
+
self::assertCurrency($code);
|
1153 |
+
return self::$data[$code->getCode()]['fractionDecimals'];
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
/**
|
1157 |
+
* Asserts that the currency code is supported.
|
1158 |
+
*
|
1159 |
+
* @param NostoCurrencyCode $code the currency code to test.
|
1160 |
+
*
|
1161 |
+
* @throws NostoException
|
1162 |
+
*/
|
1163 |
+
private static function assertCurrency(NostoCurrencyCode $code)
|
1164 |
+
{
|
1165 |
+
if (!isset(self::$data[$code->getCode()])) {
|
1166 |
+
throw new NostoException(sprintf(
|
1167 |
+
'Currency (%s) must be one of the following ISO 4217 codes: "%s".',
|
1168 |
+
$code->getCode(),
|
1169 |
+
implode('", "', array_keys(self::$data))
|
1170 |
+
));
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
}
|
lib/nosto/php-sdk/src/classes/NostoCurrencySymbol.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Value Object representing a currency symbol and it's position.
|
38 |
+
*/
|
39 |
+
final class NostoCurrencySymbol
|
40 |
+
{
|
41 |
+
const SYMBOL_POS_LEFT = 'left';
|
42 |
+
const SYMBOL_POS_RIGHT = 'right';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @var string the currency symbol, e.g. "$".
|
46 |
+
*/
|
47 |
+
private $symbol;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @var string the position of the symbol when displaying the currency.
|
51 |
+
*/
|
52 |
+
private $position;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Constructor.
|
56 |
+
* Sets up this Value Object with given data.
|
57 |
+
*
|
58 |
+
* @param string $symbol the currency symbol.
|
59 |
+
* @param string $position the position of the symbol when displaying the currency.
|
60 |
+
*
|
61 |
+
* @throws NostoInvalidArgumentException
|
62 |
+
*/
|
63 |
+
public function __construct($symbol, $position)
|
64 |
+
{
|
65 |
+
$this->symbol = (string)$symbol;
|
66 |
+
$this->position = (string)$position;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Returns the position of the symbol when displaying the currency.
|
71 |
+
*
|
72 |
+
* @return string the position of the symbol when displaying the currency.
|
73 |
+
*/
|
74 |
+
public function getPosition()
|
75 |
+
{
|
76 |
+
return $this->position;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Returns the currency symbol.
|
81 |
+
*
|
82 |
+
* @return string the currency symbol.
|
83 |
+
*/
|
84 |
+
public function getSymbol()
|
85 |
+
{
|
86 |
+
return $this->symbol;
|
87 |
+
}
|
88 |
+
}
|
lib/nosto/php-sdk/src/classes/NostoExchangeRate.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Class representing a currency exchange rate.
|
38 |
+
*/
|
39 |
+
class NostoExchangeRate implements NostoExchangeRateInterface
|
40 |
+
{
|
41 |
+
/**
|
42 |
+
* @var string the name for the exchange rate (can be different than the ISO 4217).
|
43 |
+
*/
|
44 |
+
private $name;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var string the currencyCode code for the exchange rate (ISO 4217).
|
48 |
+
*/
|
49 |
+
private $currencyCode;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @var string the exchange rate value.
|
53 |
+
*/
|
54 |
+
private $exchangeRate;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Constructor.
|
58 |
+
* Assigns exchange rate properties and validates them.
|
59 |
+
*
|
60 |
+
* @param string $name the name of the exchange rate
|
61 |
+
* @param string $currencyCode the currencyCode code for the exchange rate.
|
62 |
+
* @param string $exchangeRate the exchange rate value.
|
63 |
+
*
|
64 |
+
*/
|
65 |
+
public function __construct($name, $currencyCode, $exchangeRate)
|
66 |
+
{
|
67 |
+
$this->name = (string)$name;
|
68 |
+
$this->currencyCode = $currencyCode;
|
69 |
+
$this->exchangeRate = (string)$exchangeRate;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Getter for the exchange rates currencyCode code.
|
74 |
+
*
|
75 |
+
* @return string the currencyCode code.
|
76 |
+
*/
|
77 |
+
public function getCurrencyCode()
|
78 |
+
{
|
79 |
+
return $this->currencyCode;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Getter for the exchange rate value.
|
84 |
+
*
|
85 |
+
* @return string the exchange rate.
|
86 |
+
*/
|
87 |
+
public function getExchangeRate()
|
88 |
+
{
|
89 |
+
return $this->exchangeRate;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @inheritdoc
|
94 |
+
*/
|
95 |
+
public function getName()
|
96 |
+
{
|
97 |
+
return $this->name;
|
98 |
+
}
|
99 |
+
}
|
lib/nosto/php-sdk/src/classes/api/NostoApiRequest.php
CHANGED
@@ -46,6 +46,8 @@ class NostoApiRequest extends NostoHttpRequest
|
|
46 |
const PATH_PRODUCTS_UPDATE = '/v1/products/update';
|
47 |
const PATH_PRODUCTS_UPSERT = '/v1/products/upsert';
|
48 |
const PATH_PRODUCTS_DISCONTINUE = '/v1/products/discontinue';
|
|
|
|
|
49 |
|
50 |
/**
|
51 |
* @var string base url for the nosto api.
|
46 |
const PATH_PRODUCTS_UPDATE = '/v1/products/update';
|
47 |
const PATH_PRODUCTS_UPSERT = '/v1/products/upsert';
|
48 |
const PATH_PRODUCTS_DISCONTINUE = '/v1/products/discontinue';
|
49 |
+
const PATH_CURRENCY_EXCHANGE_RATE = '/exchangerates';
|
50 |
+
const PATH_SETTINGS = '/settings';
|
51 |
|
52 |
/**
|
53 |
* @var string base url for the nosto api.
|
lib/nosto/php-sdk/src/classes/api/NostoApiToken.php
CHANGED
@@ -38,6 +38,11 @@
|
|
38 |
*/
|
39 |
class NostoApiToken extends NostoObject implements NostoValidatableInterface
|
40 |
{
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* @var string the token name, must be one of the defined tokens from self::$tokenNames.
|
43 |
*/
|
@@ -52,8 +57,10 @@ class NostoApiToken extends NostoObject implements NostoValidatableInterface
|
|
52 |
* @var array list of valid api tokens to request from Nosto.
|
53 |
*/
|
54 |
public static $tokenNames = array(
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
);
|
58 |
|
59 |
/**
|
38 |
*/
|
39 |
class NostoApiToken extends NostoObject implements NostoValidatableInterface
|
40 |
{
|
41 |
+
const API_SSO = 'sso';
|
42 |
+
const API_PRODUCTS = 'products';
|
43 |
+
const API_EXCHANGE_RATES = 'rates';
|
44 |
+
const API_SETTINGS = 'settings';
|
45 |
+
|
46 |
/**
|
47 |
* @var string the token name, must be one of the defined tokens from self::$tokenNames.
|
48 |
*/
|
57 |
* @var array list of valid api tokens to request from Nosto.
|
58 |
*/
|
59 |
public static $tokenNames = array(
|
60 |
+
self::API_SSO,
|
61 |
+
self::API_PRODUCTS,
|
62 |
+
self::API_EXCHANGE_RATES,
|
63 |
+
self::API_SETTINGS
|
64 |
);
|
65 |
|
66 |
/**
|
lib/nosto/php-sdk/src/classes/collection/NostoExchangeRateCollection.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2015, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2015 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Product object collection.
|
38 |
+
* Supports only items implementing "NostoExhangeRateInterface".
|
39 |
+
*/
|
40 |
+
class NostoExchangeRateCollection extends NostoCollection
|
41 |
+
{
|
42 |
+
/**
|
43 |
+
* @inheritdoc
|
44 |
+
*/
|
45 |
+
protected $validItemType = 'NostoExchangeRateInterface';
|
46 |
+
}
|
lib/nosto/php-sdk/src/classes/export/NostoExportProductCollection.php
CHANGED
@@ -78,6 +78,10 @@ class NostoExportProductCollection extends NostoProductCollection implements Nos
|
|
78 |
$data['date_published'] = Nosto::helper('date')->format($item->getDatePublished());
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
81 |
$array[] = $data;
|
82 |
}
|
83 |
return json_encode($array);
|
78 |
$data['date_published'] = Nosto::helper('date')->format($item->getDatePublished());
|
79 |
}
|
80 |
|
81 |
+
if ($item->getVariationId()) {
|
82 |
+
$data['variation_id'] = $item->getVariationId();
|
83 |
+
}
|
84 |
+
|
85 |
$array[] = $data;
|
86 |
}
|
87 |
return json_encode($array);
|
lib/nosto/php-sdk/src/classes/http/NostoHttpRequest.php
CHANGED
@@ -49,6 +49,11 @@ class NostoHttpRequest
|
|
49 |
*/
|
50 |
public static $baseUrl = 'https://my.nosto.com';
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
/**
|
53 |
* @var string the request url.
|
54 |
*/
|
@@ -92,9 +97,9 @@ class NostoHttpRequest
|
|
92 |
if ($adapter !== null) {
|
93 |
$this->adapter = $adapter;
|
94 |
} elseif (function_exists('curl_exec')) {
|
95 |
-
$this->adapter = new NostoHttpRequestAdapterCurl();
|
96 |
} else {
|
97 |
-
$this->adapter = new NostoHttpRequestAdapterSocket();
|
98 |
}
|
99 |
}
|
100 |
|
@@ -414,6 +419,19 @@ class NostoHttpRequest
|
|
414 |
);
|
415 |
}
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
/**
|
418 |
* Converts the request to a string and returns it.
|
419 |
* Used when logging http request errors.
|
49 |
*/
|
50 |
public static $baseUrl = 'https://my.nosto.com';
|
51 |
|
52 |
+
/**
|
53 |
+
* @var string user-agent to use for all requests
|
54 |
+
*/
|
55 |
+
public static $userAgent = '';
|
56 |
+
|
57 |
/**
|
58 |
* @var string the request url.
|
59 |
*/
|
97 |
if ($adapter !== null) {
|
98 |
$this->adapter = $adapter;
|
99 |
} elseif (function_exists('curl_exec')) {
|
100 |
+
$this->adapter = new NostoHttpRequestAdapterCurl(self::$userAgent);
|
101 |
} else {
|
102 |
+
$this->adapter = new NostoHttpRequestAdapterSocket(self::$userAgent);
|
103 |
}
|
104 |
}
|
105 |
|
419 |
);
|
420 |
}
|
421 |
|
422 |
+
/**
|
423 |
+
* Builds the custom-user agent by using the platform's name and version with the
|
424 |
+
* plugin version
|
425 |
+
*
|
426 |
+
* @param string $platformName the name of the platform using the SDK
|
427 |
+
* @param array $platformVersion the version of the platform using the SDK
|
428 |
+
* @param array $pluginVersion the version of the plugin using the SDK
|
429 |
+
*/
|
430 |
+
public static function buildUserAgent($platformName, $platformVersion, $pluginVersion)
|
431 |
+
{
|
432 |
+
self::$userAgent = sprintf('Nosto %s / %s %s', $pluginVersion, $platformName, $platformVersion);
|
433 |
+
}
|
434 |
+
|
435 |
/**
|
436 |
* Converts the request to a string and returns it.
|
437 |
* Used when logging http request errors.
|
lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterCurl.php
CHANGED
@@ -39,6 +39,23 @@
|
|
39 |
*/
|
40 |
class NostoHttpRequestAdapterCurl extends NostoHttpRequestAdapter
|
41 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* @inheritdoc
|
44 |
*/
|
@@ -127,6 +144,9 @@ class NostoHttpRequestAdapterCurl extends NostoHttpRequestAdapter
|
|
127 |
if (!empty($this->headers)) {
|
128 |
$curlOptions[CURLOPT_HTTPHEADER] = $this->headers;
|
129 |
}
|
|
|
|
|
|
|
130 |
$ch = curl_init();
|
131 |
curl_setopt_array($ch, $curlOptions);
|
132 |
$result = curl_exec($ch);
|
39 |
*/
|
40 |
class NostoHttpRequestAdapterCurl extends NostoHttpRequestAdapter
|
41 |
{
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var string the user-agent to use if specified
|
45 |
+
*/
|
46 |
+
private $userAgent = false;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Constructor.
|
50 |
+
* Creates the http request adapter with the specified user-agent
|
51 |
+
*
|
52 |
+
* @param $userAgent string the user-agent header for all requests
|
53 |
+
*/
|
54 |
+
public function __construct($userAgent)
|
55 |
+
{
|
56 |
+
$this->userAgent = $userAgent;
|
57 |
+
}
|
58 |
+
|
59 |
/**
|
60 |
* @inheritdoc
|
61 |
*/
|
144 |
if (!empty($this->headers)) {
|
145 |
$curlOptions[CURLOPT_HTTPHEADER] = $this->headers;
|
146 |
}
|
147 |
+
if (!in_array(CURLOPT_USERAGENT, $curlOptions) && $this->userAgent) {
|
148 |
+
$curlOptions[CURLOPT_USERAGENT] = $this->userAgent;
|
149 |
+
}
|
150 |
$ch = curl_init();
|
151 |
curl_setopt_array($ch, $curlOptions);
|
152 |
$result = curl_exec($ch);
|
lib/nosto/php-sdk/src/classes/http/NostoHttpRequestAdapterSocket.php
CHANGED
@@ -42,6 +42,23 @@
|
|
42 |
*/
|
43 |
class NostoHttpRequestAdapterSocket extends NostoHttpRequestAdapter
|
44 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* @inheritdoc
|
47 |
*/
|
@@ -129,6 +146,9 @@ class NostoHttpRequestAdapterSocket extends NostoHttpRequestAdapter
|
|
129 |
*/
|
130 |
protected function send($url, array $streamOptions)
|
131 |
{
|
|
|
|
|
|
|
132 |
$context = stream_context_create($streamOptions);
|
133 |
// We use file_get_contents() directly here as we need the http response headers which are automatically
|
134 |
// populated into $headers, which is only available in the local scope where file_get_contents()
|
42 |
*/
|
43 |
class NostoHttpRequestAdapterSocket extends NostoHttpRequestAdapter
|
44 |
{
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var string the user-agent to use if specified
|
48 |
+
*/
|
49 |
+
private $userAgent = false;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Constructor.
|
53 |
+
* Creates the http request adapter with the specified user-agent
|
54 |
+
*
|
55 |
+
* @param $userAgent string the user-agent header for all requests
|
56 |
+
*/
|
57 |
+
public function __construct($userAgent)
|
58 |
+
{
|
59 |
+
$this->userAgent = $userAgent;
|
60 |
+
}
|
61 |
+
|
62 |
/**
|
63 |
* @inheritdoc
|
64 |
*/
|
146 |
*/
|
147 |
protected function send($url, array $streamOptions)
|
148 |
{
|
149 |
+
if (!array_key_exists('user_agent', $streamOptions['http']) && $this->userAgent) {
|
150 |
+
$streamOptions['http']['user_agent'] = $this->userAgent;
|
151 |
+
}
|
152 |
$context = stream_context_create($streamOptions);
|
153 |
// We use file_get_contents() directly here as we need the http response headers which are automatically
|
154 |
// populated into $headers, which is only available in the local scope where file_get_contents()
|
lib/nosto/php-sdk/src/classes/operation/NostoOperationAccount.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Handles sending currencyCode exchange rates through the Nosto API.
|
38 |
+
*/
|
39 |
+
class NostoOperationAccount
|
40 |
+
{
|
41 |
+
/**
|
42 |
+
* @var NostoAccountInterface the Nosto account to update the rates for.
|
43 |
+
*/
|
44 |
+
protected $account;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var NostoAccountMetaDataInterface Nosto account meta
|
48 |
+
*/
|
49 |
+
protected $accountMeta;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Constructor.
|
53 |
+
*
|
54 |
+
* Accepts the Nosto account for which the service is to operate on.
|
55 |
+
*
|
56 |
+
* @param NostoAccountInterface $account the Nosto account object.
|
57 |
+
* @param NostoAccountMetaDataInterface $accountMeta the Nosto account object.
|
58 |
+
*/
|
59 |
+
public function __construct(
|
60 |
+
NostoAccountInterface $account,
|
61 |
+
NostoAccountMetaDataInterface $accountMeta
|
62 |
+
) {
|
63 |
+
$this->account = $account;
|
64 |
+
$this->accountMeta = $accountMeta;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Updates account settings to Nosto
|
69 |
+
* @return bool
|
70 |
+
* @throws NostoException
|
71 |
+
*/
|
72 |
+
public function update()
|
73 |
+
{
|
74 |
+
$request = $this->initApiRequest();
|
75 |
+
$response = $request->put($this->getSettingsJson());
|
76 |
+
if ($response->getCode() !== 200) {
|
77 |
+
throw new NostoException(
|
78 |
+
sprintf(
|
79 |
+
'Update error for account %s: %s',
|
80 |
+
$this->account->getName(),
|
81 |
+
$response->getMessage()
|
82 |
+
)
|
83 |
+
);
|
84 |
+
}
|
85 |
+
return true;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Builds the API request and returns it.
|
90 |
+
*
|
91 |
+
* @return NostoApiRequest the request object.
|
92 |
+
* @throws NostoException if the request object cannot be built.
|
93 |
+
*/
|
94 |
+
protected function initApiRequest()
|
95 |
+
{
|
96 |
+
$token = $this->account->getApiToken(NostoApiToken::API_SETTINGS);
|
97 |
+
if (is_null($token)) {
|
98 |
+
throw new NostoException(
|
99 |
+
sprintf(
|
100 |
+
'No `%s` API token found for account "%s".',
|
101 |
+
NostoApiToken::API_SETTINGS,
|
102 |
+
$this->account->getName()
|
103 |
+
)
|
104 |
+
);
|
105 |
+
}
|
106 |
+
$request = new NostoApiRequest();
|
107 |
+
$request->setContentType('application/json');
|
108 |
+
$request->setAuthBasic('', $token->getValue());
|
109 |
+
$request->setPath(NostoApiRequest::PATH_SETTINGS);
|
110 |
+
return $request;
|
111 |
+
}
|
112 |
+
/**
|
113 |
+
* Returns the settings in JSON format
|
114 |
+
*
|
115 |
+
* @return string the JSON structure.
|
116 |
+
*/
|
117 |
+
protected function getSettingsJson()
|
118 |
+
{
|
119 |
+
$data = array(
|
120 |
+
'title' => $this->accountMeta->getTitle(),
|
121 |
+
'front_page_url' => $this->accountMeta->getFrontPageUrl(),
|
122 |
+
'currency_code' => $this->accountMeta->getCurrencyCode(),
|
123 |
+
);
|
124 |
+
|
125 |
+
// Currencies and currency options
|
126 |
+
$currencyCount = count($this->accountMeta->getCurrencies());
|
127 |
+
if ($currencyCount > 0) {
|
128 |
+
$data['currencies'] = array();
|
129 |
+
foreach ($this->accountMeta->getCurrencies() as $currency) {
|
130 |
+
$data['currencies'][$currency->getCode()->getCode()] = array(
|
131 |
+
'currency_before_amount' => (
|
132 |
+
$currency->getSymbol()->getPosition() === NostoCurrencySymbol::SYMBOL_POS_LEFT
|
133 |
+
),
|
134 |
+
'currency_token' => $currency->getSymbol()->getSymbol(),
|
135 |
+
'decimal_character' => $currency->getFormat()->getDecimalSymbol(),
|
136 |
+
'grouping_separator' => $currency->getFormat()->getGroupSymbol(),
|
137 |
+
'decimal_places' => $currency->getFormat()->getPrecision(),
|
138 |
+
);
|
139 |
+
}
|
140 |
+
}
|
141 |
+
$data['use_exchange_rates'] = $this->accountMeta->getUseCurrencyExchangeRates();
|
142 |
+
if ($this->accountMeta->getDefaultVariationId()) {
|
143 |
+
$data['default_variant_id'] = $this->accountMeta->getDefaultVariationId();
|
144 |
+
} else {
|
145 |
+
$data['default_variant_id'] = '';
|
146 |
+
}
|
147 |
+
|
148 |
+
return json_encode($data);
|
149 |
+
}
|
150 |
+
}
|
lib/nosto/php-sdk/src/classes/operation/NostoOperationExchangeRate.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2016 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Handles sending currencyCode exchange rates through the Nosto API.
|
38 |
+
*/
|
39 |
+
class NostoOperationExchangeRate
|
40 |
+
{
|
41 |
+
/**
|
42 |
+
* @var NostoAccountInterface the Nosto account to update the rates for.
|
43 |
+
*/
|
44 |
+
protected $account;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var NostoExchangeRateCollection collection of exchange rates to be updated
|
48 |
+
*/
|
49 |
+
protected $collection;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Constructor.
|
53 |
+
*
|
54 |
+
* Accepts the Nosto account for which the service is to operate on.
|
55 |
+
*
|
56 |
+
* @param NostoAccountInterface $account the Nosto account object.
|
57 |
+
* @param NostoExchangeRateCollection $collection the Nosto account object.
|
58 |
+
*/
|
59 |
+
public function __construct(
|
60 |
+
NostoAccountInterface $account,
|
61 |
+
NostoExchangeRateCollection $collection
|
62 |
+
) {
|
63 |
+
$this->account = $account;
|
64 |
+
$this->collection = $collection;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Updates exchange rates to Nosto
|
69 |
+
* @return bool
|
70 |
+
* @throws NostoException
|
71 |
+
*/
|
72 |
+
public function update()
|
73 |
+
{
|
74 |
+
$request = $this->initApiRequest();
|
75 |
+
$response = $request->post($this->getCollectionAsJson());
|
76 |
+
if ($response->getCode() !== 200) {
|
77 |
+
throw new NostoException(
|
78 |
+
sprintf(
|
79 |
+
'Failed to update currencyCode exchange rates for account %s.',
|
80 |
+
$this->account->getName()
|
81 |
+
)
|
82 |
+
);
|
83 |
+
}
|
84 |
+
return true;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Builds the API request and returns it.
|
89 |
+
*
|
90 |
+
* @return NostoApiRequest the request object.
|
91 |
+
* @throws NostoException if the request object cannot be built.
|
92 |
+
*/
|
93 |
+
protected function initApiRequest()
|
94 |
+
{
|
95 |
+
$token = $this->account->getApiToken(NostoApiToken::API_EXCHANGE_RATES);
|
96 |
+
if (is_null($token)) {
|
97 |
+
throw new NostoException(
|
98 |
+
sprintf(
|
99 |
+
'No `%s` API token found for account "%s".',
|
100 |
+
NostoApiToken::API_EXCHANGE_RATES,
|
101 |
+
$this->account->getName()
|
102 |
+
)
|
103 |
+
);
|
104 |
+
}
|
105 |
+
$request = new NostoApiRequest();
|
106 |
+
$request->setContentType('application/json');
|
107 |
+
$request->setAuthBasic('', $token->getValue());
|
108 |
+
$request->setPath(NostoApiRequest::PATH_CURRENCY_EXCHANGE_RATE);
|
109 |
+
return $request;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Turn the currencyCode exchange rate collection into a JSON structure.
|
114 |
+
*
|
115 |
+
* Format:
|
116 |
+
*
|
117 |
+
* {
|
118 |
+
* "rates": {
|
119 |
+
* "EUR": {
|
120 |
+
* "rate": "0.706700000000",
|
121 |
+
* "price_currency_code": "EUR"
|
122 |
+
* }
|
123 |
+
* },
|
124 |
+
* "valid_until": "2015-02-27T12:00:00Z"
|
125 |
+
* }
|
126 |
+
*
|
127 |
+
* @return string the JSON structure.
|
128 |
+
* @throws NostoException of the rate collection is empty.
|
129 |
+
*/
|
130 |
+
protected function getCollectionAsJson()
|
131 |
+
{
|
132 |
+
$data = array(
|
133 |
+
'rates' => array(),
|
134 |
+
'valid_until' => null,
|
135 |
+
);
|
136 |
+
|
137 |
+
/** @var NostoExchangeRate $item */
|
138 |
+
foreach ($this->collection as $item) {
|
139 |
+
$data['rates'][$item->getName()] = array(
|
140 |
+
'rate' => $item->getExchangeRate(),
|
141 |
+
'price_currency_code' => $item->getCurrencyCode(),
|
142 |
+
);
|
143 |
+
}
|
144 |
+
if (empty($data['rates'])) {
|
145 |
+
throw new NostoException(
|
146 |
+
sprintf(
|
147 |
+
'Failed to update currencyCode exchange rates for account %s. No rates found in collection.',
|
148 |
+
$this->account->getName()
|
149 |
+
)
|
150 |
+
);
|
151 |
+
}
|
152 |
+
return json_encode($data);
|
153 |
+
}
|
154 |
+
}
|
lib/nosto/php-sdk/src/classes/operation/NostoOperationProduct.php
CHANGED
@@ -218,6 +218,9 @@ class NostoOperationProduct
|
|
218 |
if ($product->getDatePublished()) {
|
219 |
$data['date_published'] = Nosto::helper('date')->format($product->getDatePublished());
|
220 |
}
|
|
|
|
|
|
|
221 |
|
222 |
return $data;
|
223 |
}
|
218 |
if ($product->getDatePublished()) {
|
219 |
$data['date_published'] = Nosto::helper('date')->format($product->getDatePublished());
|
220 |
}
|
221 |
+
if ($product->getVariationId()) {
|
222 |
+
$data['variation_id'] = $product->getVariationId();
|
223 |
+
}
|
224 |
|
225 |
return $data;
|
226 |
}
|
lib/nosto/php-sdk/src/config.inc.php
CHANGED
@@ -49,6 +49,7 @@ require_once(dirname(__FILE__).'/interfaces/NostoOAuthClientMetaDataInterface.ph
|
|
49 |
require_once(dirname(__FILE__).'/interfaces/NostoProductInterface.php');
|
50 |
require_once(dirname(__FILE__).'/interfaces/NostoExportCollectionInterface.php');
|
51 |
require_once(dirname(__FILE__).'/interfaces/NostoValidatableInterface.php');
|
|
|
52 |
|
53 |
// Classes
|
54 |
require_once(dirname(__FILE__).'/classes/http/NostoHttpRequest.php'); // Must be loaded before `NostoApiRequest`
|
@@ -60,6 +61,7 @@ require_once(dirname(__FILE__).'/classes/api/NostoApiToken.php');
|
|
60 |
require_once(dirname(__FILE__).'/classes/collection/NostoCollection.php');
|
61 |
require_once(dirname(__FILE__).'/classes/collection/NostoProductCollection.php');
|
62 |
require_once(dirname(__FILE__).'/classes/collection/NostoOrderCollection.php');
|
|
|
63 |
|
64 |
require_once(dirname(__FILE__).'/classes/exception/NostoException.php');
|
65 |
require_once(dirname(__FILE__).'/classes/exception/NostoHttpException.php');
|
@@ -82,15 +84,24 @@ require_once(dirname(__FILE__).'/classes/oauth/NostoOAuthClient.php');
|
|
82 |
require_once(dirname(__FILE__).'/classes/oauth/NostoOAuthToken.php');
|
83 |
|
84 |
require_once(dirname(__FILE__).'/classes/operation/NostoOperationProduct.php');
|
|
|
|
|
85 |
|
86 |
require_once(dirname(__FILE__).'/classes/Nosto.php');
|
87 |
require_once(dirname(__FILE__).'/classes/NostoAccount.php');
|
|
|
88 |
require_once(dirname(__FILE__).'/classes/NostoCipher.php');
|
89 |
require_once(dirname(__FILE__).'/classes/NostoDotEnv.php');
|
90 |
require_once(dirname(__FILE__).'/classes/NostoMessage.php');
|
91 |
require_once(dirname(__FILE__).'/classes/NostoOrderConfirmation.php');
|
92 |
require_once(dirname(__FILE__).'/classes/NostoProductReCrawl.php');
|
93 |
require_once(dirname(__FILE__).'/classes/NostoValidator.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
// Libs
|
96 |
require_once(dirname(__FILE__).'/libs/phpseclib/crypt/NostoCryptBase.php');
|
49 |
require_once(dirname(__FILE__).'/interfaces/NostoProductInterface.php');
|
50 |
require_once(dirname(__FILE__).'/interfaces/NostoExportCollectionInterface.php');
|
51 |
require_once(dirname(__FILE__).'/interfaces/NostoValidatableInterface.php');
|
52 |
+
require_once(dirname(__FILE__).'/interfaces/NostoExchangeRateInterface.php');
|
53 |
|
54 |
// Classes
|
55 |
require_once(dirname(__FILE__).'/classes/http/NostoHttpRequest.php'); // Must be loaded before `NostoApiRequest`
|
61 |
require_once(dirname(__FILE__).'/classes/collection/NostoCollection.php');
|
62 |
require_once(dirname(__FILE__).'/classes/collection/NostoProductCollection.php');
|
63 |
require_once(dirname(__FILE__).'/classes/collection/NostoOrderCollection.php');
|
64 |
+
require_once(dirname(__FILE__).'/classes/collection/NostoExchangeRateCollection.php');
|
65 |
|
66 |
require_once(dirname(__FILE__).'/classes/exception/NostoException.php');
|
67 |
require_once(dirname(__FILE__).'/classes/exception/NostoHttpException.php');
|
84 |
require_once(dirname(__FILE__).'/classes/oauth/NostoOAuthToken.php');
|
85 |
|
86 |
require_once(dirname(__FILE__).'/classes/operation/NostoOperationProduct.php');
|
87 |
+
require_once(dirname(__FILE__).'/classes/operation/NostoOperationExchangeRate.php');
|
88 |
+
require_once(dirname(__FILE__).'/classes/operation/NostoOperationAccount.php');
|
89 |
|
90 |
require_once(dirname(__FILE__).'/classes/Nosto.php');
|
91 |
require_once(dirname(__FILE__).'/classes/NostoAccount.php');
|
92 |
+
require_once(dirname(__FILE__).'/classes/NostoAccountMeta.php');
|
93 |
require_once(dirname(__FILE__).'/classes/NostoCipher.php');
|
94 |
require_once(dirname(__FILE__).'/classes/NostoDotEnv.php');
|
95 |
require_once(dirname(__FILE__).'/classes/NostoMessage.php');
|
96 |
require_once(dirname(__FILE__).'/classes/NostoOrderConfirmation.php');
|
97 |
require_once(dirname(__FILE__).'/classes/NostoProductReCrawl.php');
|
98 |
require_once(dirname(__FILE__).'/classes/NostoValidator.php');
|
99 |
+
require_once(dirname(__FILE__).'/classes/NostoExchangeRate.php');
|
100 |
+
require_once(dirname(__FILE__).'/classes/NostoCurrency.php');
|
101 |
+
require_once(dirname(__FILE__).'/classes/NostoCurrencyCode.php');
|
102 |
+
require_once(dirname(__FILE__).'/classes/NostoCurrencySymbol.php');
|
103 |
+
require_once(dirname(__FILE__).'/classes/NostoCurrencyFormat.php');
|
104 |
+
require_once(dirname(__FILE__).'/classes/NostoCurrencyInfo.php');
|
105 |
|
106 |
// Libs
|
107 |
require_once(dirname(__FILE__).'/libs/phpseclib/crypt/NostoCryptBase.php');
|
lib/nosto/php-sdk/src/interfaces/NostoExchangeRateInterface.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2015, Nosto Solutions Ltd
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
7 |
+
* are permitted provided that the following conditions are met:
|
8 |
+
*
|
9 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
10 |
+
* this list of conditions and the following disclaimer.
|
11 |
+
*
|
12 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
* this list of conditions and the following disclaimer in the documentation
|
14 |
+
* and/or other materials provided with the distribution.
|
15 |
+
*
|
16 |
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
17 |
+
* may be used to endorse or promote products derived from this software without
|
18 |
+
* specific prior written permission.
|
19 |
+
*
|
20 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21 |
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22 |
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
24 |
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25 |
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26 |
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
27 |
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28 |
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29 |
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
+
*
|
31 |
+
* @author Nosto Solutions Ltd <contact@nosto.com>
|
32 |
+
* @copyright 2015 Nosto Solutions Ltd
|
33 |
+
* @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause
|
34 |
+
*/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Interface for the meta data of a exchange rate.
|
38 |
+
* This is used when making product API requests for updating the exchange rate.
|
39 |
+
*/
|
40 |
+
interface NostoExchangeRateInterface
|
41 |
+
{
|
42 |
+
/**
|
43 |
+
* Getter for the name of the exchange rate.
|
44 |
+
*
|
45 |
+
* @return string the name (can be different than ISO 4217).
|
46 |
+
*/
|
47 |
+
public function getName();
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Getter for the exchange rates currencyCode code.
|
51 |
+
*
|
52 |
+
* @return string the currencyCode code in ISO 4217 format.
|
53 |
+
*/
|
54 |
+
public function getCurrencyCode();
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Getter for the exchange rate value.
|
58 |
+
*
|
59 |
+
* @return string the exchange rate.
|
60 |
+
*/
|
61 |
+
public function getExchangeRate();
|
62 |
+
}
|
lib/nosto/php-sdk/src/interfaces/NostoProductInterface.php
CHANGED
@@ -144,4 +144,11 @@ interface NostoProductInterface
|
|
144 |
* @return string the date in format "Y-m-d".
|
145 |
*/
|
146 |
public function getDatePublished();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
144 |
* @return string the date in format "Y-m-d".
|
145 |
*/
|
146 |
public function getDatePublished();
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Returns the product variation id.
|
150 |
+
*
|
151 |
+
* @return mixed|null
|
152 |
+
*/
|
153 |
+
public function getVariationId();
|
154 |
}
|
lib/nosto/php-sdk/src/interfaces/account/NostoAccountMetaDataInterface.php
CHANGED
@@ -46,7 +46,7 @@ interface NostoAccountMetaDataInterface
|
|
46 |
public function getTitle();
|
47 |
|
48 |
/**
|
49 |
-
* The name of the account
|
50 |
* This has to follow the pattern of "[platform name]-[8 character lowercase alpha numeric string]".
|
51 |
*
|
52 |
* @return string the account name.
|
@@ -118,4 +118,28 @@ interface NostoAccountMetaDataInterface
|
|
118 |
* @return string|null the partner code or null if none exist.
|
119 |
*/
|
120 |
public function getPartnerCode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
46 |
public function getTitle();
|
47 |
|
48 |
/**
|
49 |
+
* The name of the Nosto account.
|
50 |
* This has to follow the pattern of "[platform name]-[8 character lowercase alpha numeric string]".
|
51 |
*
|
52 |
* @return string the account name.
|
118 |
* @return string|null the partner code or null if none exist.
|
119 |
*/
|
120 |
public function getPartnerCode();
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Returns a list of currency objects supported by the store the account is to be created for.
|
124 |
+
*
|
125 |
+
* @return NostoCurrency[] the currencies.
|
126 |
+
*/
|
127 |
+
public function getCurrencies();
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Returns if exchange rates should be used for handling
|
131 |
+
* multiple currencies. Please note that the method only tells if the
|
132 |
+
* setting is active. Method does not take account whether multiple
|
133 |
+
* currencies actually exist or are used.
|
134 |
+
*
|
135 |
+
* @return boolean if multi variants are used
|
136 |
+
*/
|
137 |
+
public function getUseCurrencyExchangeRates();
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Returns the default variation id
|
141 |
+
*
|
142 |
+
* @return string
|
143 |
+
*/
|
144 |
+
public function getDefaultVariationId();
|
145 |
}
|
package.xml
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Nosto_Tagging</name>
|
4 |
-
<version>2.6.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Personalization for Magento</summary>
|
10 |
<description>Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.</description>
|
11 |
-
<notes>-
|
12 |
<authors>
|
13 |
<author>
|
14 |
<name>Nosto</name>
|
@@ -16,8 +16,8 @@
|
|
16 |
<email>magento@nosto.com</email>
|
17 |
</author>
|
18 |
</authors>
|
19 |
-
<date>2016-
|
20 |
-
<time>
|
21 |
<contents>
|
22 |
<target name="magecommunity">
|
23 |
<dir name="Nosto">
|
@@ -39,12 +39,12 @@
|
|
39 |
<file name="Searchterm.php" hash="884cbca118486d922e73821242d8fc83"/>
|
40 |
</dir>
|
41 |
<dir name="Helper">
|
42 |
-
<file name="Account.php" hash="
|
43 |
<file name="Customer.php" hash="8faa27321f26ece8ff5ebf12058f546f"/>
|
44 |
<file name="Data.php" hash="11b848036443a431eafbbd155b72e40d"/>
|
45 |
<file name="Date.php" hash="1a108a4ec8169b73411b6c11b86a1d80"/>
|
46 |
-
<file name="Oauth.php" hash="
|
47 |
-
<file name="Price.php" hash="
|
48 |
<file name="Url.php" hash="289294904d246c56e4de96798927a7f6"/>
|
49 |
</dir>
|
50 |
<dir name="Model">
|
@@ -65,7 +65,7 @@
|
|
65 |
<file name="Iframe.php" hash="731e2bf424e1b9d4e00d403f55a87b54"/>
|
66 |
<file name="Owner.php" hash="6fd3228a2758d06f78729c0250f7fd30"/>
|
67 |
</dir>
|
68 |
-
<file name="Account.php" hash="
|
69 |
<file name="Oauth.php" hash="0863271d8a3db0de93525f0e64308f1c"/>
|
70 |
<dir name="Order">
|
71 |
<file name="Buyer.php" hash="45ee761ba052ef3372846c22e28921d8"/>
|
@@ -73,9 +73,9 @@
|
|
73 |
<file name="Status.php" hash="795b2e53be043aeb0b27bbd500e2c412"/>
|
74 |
</dir>
|
75 |
<file name="Order.php" hash="1a5d115199f87ead195e0b3510ab1439"/>
|
76 |
-
<file name="Product.php" hash="
|
77 |
</dir>
|
78 |
-
<file name="Observer.php" hash="
|
79 |
<file name="Product.php" hash="3630a2a688f013b296d1865e6f32e1d2"/>
|
80 |
<dir name="Resource">
|
81 |
<dir name="Customer">
|
@@ -98,17 +98,18 @@
|
|
98 |
</dir>
|
99 |
</dir>
|
100 |
</dir>
|
|
|
101 |
<dir name="controllers">
|
102 |
<dir name="Adminhtml">
|
103 |
-
<file name="NostoController.php" hash="
|
104 |
</dir>
|
105 |
-
<file name="ExportController.php" hash="
|
106 |
-
<file name="OauthController.php" hash="
|
107 |
</dir>
|
108 |
<dir name="etc">
|
109 |
<file name="adminhtml.xml" hash="7ea210738a77630f299a14b442f3b8d0"/>
|
110 |
<file name="cache.xml" hash="e874fbbf2eb89b325deb1a62afbcfb4d"/>
|
111 |
-
<file name="config.xml" hash="
|
112 |
<file name="system.xml" hash="7deba6544a09d7af8c07e6b5edc0975a"/>
|
113 |
</dir>
|
114 |
<dir name="sql">
|
@@ -175,19 +176,27 @@
|
|
175 |
<dir name="classes">
|
176 |
<file name="Nosto.php" hash="c595c5f646f6e513b6604848f8d10118"/>
|
177 |
<file name="NostoAccount.php" hash="c422a7f104c5ebc6eac9d83986280579"/>
|
|
|
178 |
<file name="NostoCipher.php" hash="a3d7d148311aa0319387c0918e5e26dc"/>
|
|
|
|
|
|
|
|
|
|
|
179 |
<file name="NostoDotEnv.php" hash="90b23c1b02095c9368372f1d5346c3f9"/>
|
|
|
180 |
<file name="NostoMessage.php" hash="5933eadd2ad08427010b0bf16657266b"/>
|
181 |
<file name="NostoObject.php" hash="187808f0c55d02294d41e9395f4c5d58"/>
|
182 |
<file name="NostoOrderConfirmation.php" hash="2a3fd5efb196bc0dcb7ad57fb61a81d0"/>
|
183 |
<file name="NostoProductReCrawl.php" hash="f370c539409dd74fc98b7aa1ea0f6387"/>
|
184 |
<file name="NostoValidator.php" hash="2096ddc9979ec77f8f0b1ec58b459329"/>
|
185 |
<dir name="api">
|
186 |
-
<file name="NostoApiRequest.php" hash="
|
187 |
-
<file name="NostoApiToken.php" hash="
|
188 |
</dir>
|
189 |
<dir name="collection">
|
190 |
<file name="NostoCollection.php" hash="35cea0282628354413f629062b58663a"/>
|
|
|
191 |
<file name="NostoOrderCollection.php" hash="db6f517948c1258e1521ceb1ce49d477"/>
|
192 |
<file name="NostoProductCollection.php" hash="3ae29dbbcb7effa234fa83461d3e6901"/>
|
193 |
</dir>
|
@@ -197,7 +206,7 @@
|
|
197 |
</dir>
|
198 |
<dir name="export">
|
199 |
<file name="NostoExportOrderCollection.php" hash="91bdd99a2be75be062fe5c7cde1803e4"/>
|
200 |
-
<file name="NostoExportProductCollection.php" hash="
|
201 |
<file name="NostoExporter.php" hash="72ad0af4bce8e57ada5a29e3634df94f"/>
|
202 |
</dir>
|
203 |
<dir name="helper">
|
@@ -207,10 +216,10 @@
|
|
207 |
<file name="NostoHelperPrice.php" hash="ee9f217dc1b8e0fc679fb56ca3fd3ca1"/>
|
208 |
</dir>
|
209 |
<dir name="http">
|
210 |
-
<file name="NostoHttpRequest.php" hash="
|
211 |
<file name="NostoHttpRequestAdapter.php" hash="d8bf8e5db44ad982b655372529f4d88c"/>
|
212 |
-
<file name="NostoHttpRequestAdapterCurl.php" hash="
|
213 |
-
<file name="NostoHttpRequestAdapterSocket.php" hash="
|
214 |
<file name="NostoHttpResponse.php" hash="9982d3ed15bfcc8f0147b2b4cc400223"/>
|
215 |
</dir>
|
216 |
<dir name="oauth">
|
@@ -218,20 +227,23 @@
|
|
218 |
<file name="NostoOAuthToken.php" hash="f81c1c1e5c4fc2010162d8f69de2cb33"/>
|
219 |
</dir>
|
220 |
<dir name="operation">
|
221 |
-
<file name="
|
|
|
|
|
222 |
</dir>
|
223 |
</dir>
|
224 |
-
<file name="config.inc.php" hash="
|
225 |
<dir name="interfaces">
|
|
|
226 |
<file name="NostoExportCollectionInterface.php" hash="63c833c17fe43ce48b45e0f552313a8b"/>
|
227 |
<file name="NostoOAuthClientMetaDataInterface.php" hash="75a82417bfc27cd82e41ea9810d31428"/>
|
228 |
-
<file name="NostoProductInterface.php" hash="
|
229 |
<file name="NostoValidatableInterface.php" hash="57ad8b28225344127843b97049f5868d"/>
|
230 |
<dir name="account">
|
231 |
<file name="NostoAccountInterface.php" hash="063da0d25a5420f4e727938467c078f3"/>
|
232 |
<file name="NostoAccountMetaDataBillingDetailsInterface.php" hash="ef31f0c3b41591fd76f85a25021f0fe4"/>
|
233 |
<file name="NostoAccountMetaDataIframeInterface.php" hash="c739e6a3ef39a308df6852361f2fd1d7"/>
|
234 |
-
<file name="NostoAccountMetaDataInterface.php" hash="
|
235 |
<file name="NostoAccountMetaDataOwnerInterface.php" hash="4c037b8cb1b529c16c91f25cce2b0ed7"/>
|
236 |
</dir>
|
237 |
<dir name="order">
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Nosto_Tagging</name>
|
4 |
+
<version>2.6.14</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Personalization for Magento</summary>
|
10 |
<description>Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.</description>
|
11 |
+
<notes>- Bug fixes</notes>
|
12 |
<authors>
|
13 |
<author>
|
14 |
<name>Nosto</name>
|
16 |
<email>magento@nosto.com</email>
|
17 |
</author>
|
18 |
</authors>
|
19 |
+
<date>2016-05-13</date>
|
20 |
+
<time>14:15:56</time>
|
21 |
<contents>
|
22 |
<target name="magecommunity">
|
23 |
<dir name="Nosto">
|
39 |
<file name="Searchterm.php" hash="884cbca118486d922e73821242d8fc83"/>
|
40 |
</dir>
|
41 |
<dir name="Helper">
|
42 |
+
<file name="Account.php" hash="30f3d55fb86876108a0440ffc3153610"/>
|
43 |
<file name="Customer.php" hash="8faa27321f26ece8ff5ebf12058f546f"/>
|
44 |
<file name="Data.php" hash="11b848036443a431eafbbd155b72e40d"/>
|
45 |
<file name="Date.php" hash="1a108a4ec8169b73411b6c11b86a1d80"/>
|
46 |
+
<file name="Oauth.php" hash="d8932bd97b03116774e7aaac62a25103"/>
|
47 |
+
<file name="Price.php" hash="364bb50e9ee5453a4d61bf3e484cd894"/>
|
48 |
<file name="Url.php" hash="289294904d246c56e4de96798927a7f6"/>
|
49 |
</dir>
|
50 |
<dir name="Model">
|
65 |
<file name="Iframe.php" hash="731e2bf424e1b9d4e00d403f55a87b54"/>
|
66 |
<file name="Owner.php" hash="6fd3228a2758d06f78729c0250f7fd30"/>
|
67 |
</dir>
|
68 |
+
<file name="Account.php" hash="8bfa659be33a3dd3eeabe4846bdb14c4"/>
|
69 |
<file name="Oauth.php" hash="0863271d8a3db0de93525f0e64308f1c"/>
|
70 |
<dir name="Order">
|
71 |
<file name="Buyer.php" hash="45ee761ba052ef3372846c22e28921d8"/>
|
73 |
<file name="Status.php" hash="795b2e53be043aeb0b27bbd500e2c412"/>
|
74 |
</dir>
|
75 |
<file name="Order.php" hash="1a5d115199f87ead195e0b3510ab1439"/>
|
76 |
+
<file name="Product.php" hash="0c06e4a7dfd59522f267c825fa37c357"/>
|
77 |
</dir>
|
78 |
+
<file name="Observer.php" hash="dc91cb5a878ca1fb85b402883a68382f"/>
|
79 |
<file name="Product.php" hash="3630a2a688f013b296d1865e6f32e1d2"/>
|
80 |
<dir name="Resource">
|
81 |
<dir name="Customer">
|
98 |
</dir>
|
99 |
</dir>
|
100 |
</dir>
|
101 |
+
<file name="bootstrap.php" hash="366135b22b216e1167118021dbf2aacf"/>
|
102 |
<dir name="controllers">
|
103 |
<dir name="Adminhtml">
|
104 |
+
<file name="NostoController.php" hash="fc79c34f2c363911d47e49207716d6b0"/>
|
105 |
</dir>
|
106 |
+
<file name="ExportController.php" hash="0e0c8972da54575e8b73c9adb9830c81"/>
|
107 |
+
<file name="OauthController.php" hash="78a92e0e413bb6d7f2e8eaf594a40f1d"/>
|
108 |
</dir>
|
109 |
<dir name="etc">
|
110 |
<file name="adminhtml.xml" hash="7ea210738a77630f299a14b442f3b8d0"/>
|
111 |
<file name="cache.xml" hash="e874fbbf2eb89b325deb1a62afbcfb4d"/>
|
112 |
+
<file name="config.xml" hash="caa04383a2d6c212878c966b403e8cb9"/>
|
113 |
<file name="system.xml" hash="7deba6544a09d7af8c07e6b5edc0975a"/>
|
114 |
</dir>
|
115 |
<dir name="sql">
|
176 |
<dir name="classes">
|
177 |
<file name="Nosto.php" hash="c595c5f646f6e513b6604848f8d10118"/>
|
178 |
<file name="NostoAccount.php" hash="c422a7f104c5ebc6eac9d83986280579"/>
|
179 |
+
<file name="NostoAccountMeta.php" hash="8a30b97aaf66823ff554ba4ea6956cad"/>
|
180 |
<file name="NostoCipher.php" hash="a3d7d148311aa0319387c0918e5e26dc"/>
|
181 |
+
<file name="NostoCurrency.php" hash="e1b92eb7f46c51c83abb2afe34a30c3b"/>
|
182 |
+
<file name="NostoCurrencyCode.php" hash="70849a5592e559ae88c5648930055905"/>
|
183 |
+
<file name="NostoCurrencyFormat.php" hash="dc1f0bc1dff3d855ff3fcea970ea16ab"/>
|
184 |
+
<file name="NostoCurrencyInfo.php" hash="4706d8e1de526d2a5fe2755028ff887b"/>
|
185 |
+
<file name="NostoCurrencySymbol.php" hash="9b84b959987edb5b8c8fbf49e3d2df2e"/>
|
186 |
<file name="NostoDotEnv.php" hash="90b23c1b02095c9368372f1d5346c3f9"/>
|
187 |
+
<file name="NostoExchangeRate.php" hash="f23f06c5bc1bcda5e4164edd8a0b6ca7"/>
|
188 |
<file name="NostoMessage.php" hash="5933eadd2ad08427010b0bf16657266b"/>
|
189 |
<file name="NostoObject.php" hash="187808f0c55d02294d41e9395f4c5d58"/>
|
190 |
<file name="NostoOrderConfirmation.php" hash="2a3fd5efb196bc0dcb7ad57fb61a81d0"/>
|
191 |
<file name="NostoProductReCrawl.php" hash="f370c539409dd74fc98b7aa1ea0f6387"/>
|
192 |
<file name="NostoValidator.php" hash="2096ddc9979ec77f8f0b1ec58b459329"/>
|
193 |
<dir name="api">
|
194 |
+
<file name="NostoApiRequest.php" hash="fd6d7d1b33137a7b7eaef5edbd50e2ec"/>
|
195 |
+
<file name="NostoApiToken.php" hash="72f179170de6c469b8d8e97d40d0aec4"/>
|
196 |
</dir>
|
197 |
<dir name="collection">
|
198 |
<file name="NostoCollection.php" hash="35cea0282628354413f629062b58663a"/>
|
199 |
+
<file name="NostoExchangeRateCollection.php" hash="28bd7b287b825a780300b2b3790c8209"/>
|
200 |
<file name="NostoOrderCollection.php" hash="db6f517948c1258e1521ceb1ce49d477"/>
|
201 |
<file name="NostoProductCollection.php" hash="3ae29dbbcb7effa234fa83461d3e6901"/>
|
202 |
</dir>
|
206 |
</dir>
|
207 |
<dir name="export">
|
208 |
<file name="NostoExportOrderCollection.php" hash="91bdd99a2be75be062fe5c7cde1803e4"/>
|
209 |
+
<file name="NostoExportProductCollection.php" hash="3be4f5974cf15adc1f79136566efaf48"/>
|
210 |
<file name="NostoExporter.php" hash="72ad0af4bce8e57ada5a29e3634df94f"/>
|
211 |
</dir>
|
212 |
<dir name="helper">
|
216 |
<file name="NostoHelperPrice.php" hash="ee9f217dc1b8e0fc679fb56ca3fd3ca1"/>
|
217 |
</dir>
|
218 |
<dir name="http">
|
219 |
+
<file name="NostoHttpRequest.php" hash="46cc219301911bd29383d7efd559a4cf"/>
|
220 |
<file name="NostoHttpRequestAdapter.php" hash="d8bf8e5db44ad982b655372529f4d88c"/>
|
221 |
+
<file name="NostoHttpRequestAdapterCurl.php" hash="0af177b860f6aef58b69154ec2f7c988"/>
|
222 |
+
<file name="NostoHttpRequestAdapterSocket.php" hash="40f5ca4bbbd0dcc46e8cd3af981b40e0"/>
|
223 |
<file name="NostoHttpResponse.php" hash="9982d3ed15bfcc8f0147b2b4cc400223"/>
|
224 |
</dir>
|
225 |
<dir name="oauth">
|
227 |
<file name="NostoOAuthToken.php" hash="f81c1c1e5c4fc2010162d8f69de2cb33"/>
|
228 |
</dir>
|
229 |
<dir name="operation">
|
230 |
+
<file name="NostoOperationAccount.php" hash="3d41614e4e81b1b625dc688faf984f64"/>
|
231 |
+
<file name="NostoOperationExchangeRate.php" hash="c46784f0b73fb6343a46627dc1391bdd"/>
|
232 |
+
<file name="NostoOperationProduct.php" hash="eccdbd3d54af0ad3779e9edfcd760161"/>
|
233 |
</dir>
|
234 |
</dir>
|
235 |
+
<file name="config.inc.php" hash="61c514981d155acdd4f60e3cc0b47139"/>
|
236 |
<dir name="interfaces">
|
237 |
+
<file name="NostoExchangeRateInterface.php" hash="217538d3c06e0eb2e5349b4dfd1cb1a6"/>
|
238 |
<file name="NostoExportCollectionInterface.php" hash="63c833c17fe43ce48b45e0f552313a8b"/>
|
239 |
<file name="NostoOAuthClientMetaDataInterface.php" hash="75a82417bfc27cd82e41ea9810d31428"/>
|
240 |
+
<file name="NostoProductInterface.php" hash="687c6f112f76c2cfed28b067ef96b855"/>
|
241 |
<file name="NostoValidatableInterface.php" hash="57ad8b28225344127843b97049f5868d"/>
|
242 |
<dir name="account">
|
243 |
<file name="NostoAccountInterface.php" hash="063da0d25a5420f4e727938467c078f3"/>
|
244 |
<file name="NostoAccountMetaDataBillingDetailsInterface.php" hash="ef31f0c3b41591fd76f85a25021f0fe4"/>
|
245 |
<file name="NostoAccountMetaDataIframeInterface.php" hash="c739e6a3ef39a308df6852361f2fd1d7"/>
|
246 |
+
<file name="NostoAccountMetaDataInterface.php" hash="f31c8943b0de8b3c6bf8dd5cd3ce0be9"/>
|
247 |
<file name="NostoAccountMetaDataOwnerInterface.php" hash="4c037b8cb1b529c16c91f25cce2b0ed7"/>
|
248 |
</dir>
|
249 |
<dir name="order">
|