Version Notes
1.) Added Support for GenesisLib v1.4 - Additional Transaction Types are now available using the eMerchantPay Checkout Method
2.) A possibility has been added to use an external GenesisGateway Library (installed by composer) instead of the integrated in Module
2.) A few minor issues were resolved regarding Capture / Refund Transactions
Download this release
Release Info
Developer | eMerchantPay Ltd. |
Extension | EMerchantPay_Genesis_Client |
Version | 1.2.5 |
Comparing to | |
See all releases |
Version 1.2.5
- app/code/community/EMerchantPay/Genesis/Block/Form/Checkout.php +35 -0
- app/code/community/EMerchantPay/Genesis/Block/Form/Direct.php +130 -0
- app/code/community/EMerchantPay/Genesis/Block/Info/Checkout.php +37 -0
- app/code/community/EMerchantPay/Genesis/Block/Info/Direct.php +37 -0
- app/code/community/EMerchantPay/Genesis/Block/Redirect/Checkout.php +101 -0
- app/code/community/EMerchantPay/Genesis/Block/Redirect/Direct.php +101 -0
- app/code/community/EMerchantPay/Genesis/Helper/Data.php +442 -0
- app/code/community/EMerchantPay/Genesis/Model/Admin/Checkout/Options/Transaction/Type.php +109 -0
- app/code/community/EMerchantPay/Genesis/Model/Admin/Direct/Options/Transaction/Type.php +77 -0
- app/code/community/EMerchantPay/Genesis/Model/Admin/Environment.php +58 -0
- app/code/community/EMerchantPay/Genesis/Model/Checkout.php +664 -0
- app/code/community/EMerchantPay/Genesis/Model/Direct.php +982 -0
- app/code/community/EMerchantPay/Genesis/Observer/GenesisAutoLoader.php +74 -0
- app/code/community/EMerchantPay/Genesis/controllers/CheckoutController.php +153 -0
- app/code/community/EMerchantPay/Genesis/controllers/DirectController.php +133 -0
- app/code/community/EMerchantPay/Genesis/etc/config.xml +119 -0
- app/code/community/EMerchantPay/Genesis/etc/system.xml +284 -0
- app/design/adminhtml/default/default/template/emerchantpay/info/checkout.phtml +23 -0
- app/design/adminhtml/default/default/template/emerchantpay/info/direct.phtml +23 -0
- app/design/frontend/base/default/template/emerchantpay/form/checkout.phtml +28 -0
- app/design/frontend/base/default/template/emerchantpay/form/direct.phtml +86 -0
- app/design/frontend/base/default/template/emerchantpay/info/checkout.phtml +24 -0
- app/design/frontend/base/default/template/emerchantpay/info/direct.phtml +24 -0
- app/design/frontend/base/default/template/emerchantpay/redirect/checkout.phtml +64 -0
- app/design/frontend/base/default/template/emerchantpay/redirect/direct.phtml +64 -0
- app/etc/modules/EMerchantPay_Genesis.xml +11 -0
- app/locale/en_GB/EMerchantPay_Genesis.csv +36 -0
- app/locale/en_US/EMerchantPay_Genesis.csv +36 -0
- lib/Genesis/src/Genesis/API/Constants/Banks.php +153 -0
- lib/Genesis/src/Genesis/API/Constants/Endpoints.php +47 -0
- lib/Genesis/src/Genesis/API/Constants/Environments.php +45 -0
- lib/Genesis/src/Genesis/API/Constants/Errors.php +618 -0
- lib/Genesis/src/Genesis/API/Constants/Payment/Methods.php +89 -0
- lib/Genesis/src/Genesis/API/Constants/Transaction/States.php +219 -0
- lib/Genesis/src/Genesis/API/Constants/Transaction/Types.php +158 -0
- lib/Genesis/src/Genesis/API/Constants/i18n.php +130 -0
- lib/Genesis/src/Genesis/API/Notification.php +242 -0
- lib/Genesis/src/Genesis/API/Request.php +444 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/ABNiDEAL.php +399 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/CashU.php +387 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/POLi.php +385 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/PPRO.php +457 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Paysafecard.php +387 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Sofort.php +403 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Capture.php +138 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Authorize.php +450 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Authorize3D.php +514 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Credit.php +138 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Payout.php +328 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/InitRecurringSale.php +448 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/InitRecurringSale3D.php +514 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/RecurringSale.php +138 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Sale.php +448 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Cards/Sale3D.php +514 -0
- lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/Sale.php +429 -0
- lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/oBeP.php +211 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Refund.php +138 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Void.php +114 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Wallets/Neteller.php +403 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Wallets/WebMoney.php +393 -0
- lib/Genesis/src/Genesis/API/Request/Financial/Wallets/eZeeWallet.php +190 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/AVS.php +399 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/AccountVerification.php +399 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Blacklist.php +96 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Chargeback/DateRange.php +113 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Chargeback/Transaction.php +97 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Reports/DateRange.php +114 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Reports/Transaction.php +97 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Retrieval/DateRange.php +114 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Retrieval/Transaction.php +97 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Reconcile/DateRange.php +106 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Reconcile/Transaction.php +104 -0
- lib/Genesis/src/Genesis/API/Request/NonFinancial/Retrieve/AbniDealBanks.php +52 -0
- lib/Genesis/src/Genesis/API/Request/WPF/Create.php +470 -0
- lib/Genesis/src/Genesis/API/Request/WPF/Reconcile.php +88 -0
- lib/Genesis/src/Genesis/API/Response.php +317 -0
- lib/Genesis/src/Genesis/Builder.php +80 -0
- lib/Genesis/src/Genesis/Builders/JSON.php +68 -0
- lib/Genesis/src/Genesis/Builders/XML.php +205 -0
- lib/Genesis/src/Genesis/Certificates/ca-bundle.pem +128 -0
- lib/Genesis/src/Genesis/Config.php +341 -0
- lib/Genesis/src/Genesis/Exceptions/EnvironmentNotSet.php +47 -0
- lib/Genesis/src/Genesis/Exceptions/ErrorAPI.php +53 -0
- lib/Genesis/src/Genesis/Exceptions/ErrorNetwork.php +51 -0
- lib/Genesis/src/Genesis/Exceptions/ErrorParameter.php +48 -0
- lib/Genesis/src/Genesis/Exceptions/InvalidArgument.php +47 -0
- lib/Genesis/src/Genesis/Exceptions/InvalidMethod.php +49 -0
- lib/Genesis/src/Genesis/Exceptions/InvalidResponse.php +50 -0
- lib/Genesis/src/Genesis/Genesis.php +130 -0
- lib/Genesis/src/Genesis/Interfaces/Builder.php +48 -0
- lib/Genesis/src/Genesis/Interfaces/Network.php +76 -0
- lib/Genesis/src/Genesis/Interfaces/Parser.php +56 -0
- lib/Genesis/src/Genesis/Network.php +119 -0
- lib/Genesis/src/Genesis/Network/Stream.php +240 -0
- lib/Genesis/src/Genesis/Network/cURL.php +186 -0
- lib/Genesis/src/Genesis/Parser.php +90 -0
- lib/Genesis/src/Genesis/Parsers/XML.php +185 -0
- lib/Genesis/src/Genesis/Utils/Common.php +253 -0
- lib/Genesis/src/Genesis/Utils/Country.php +314 -0
- lib/Genesis/src/Genesis/Utils/Currency.php +1156 -0
- lib/Genesis/src/Genesis/Utils/Requirements.php +152 -0
- lib/Genesis/vendor/autoload.php +28 -0
- lib/Genesis/vendor/composer/ClassLoader.php +383 -0
- lib/Genesis/vendor/composer/LICENSE +19 -0
- lib/Genesis/vendor/composer/autoload_classmap.php +9 -0
- lib/Genesis/vendor/composer/autoload_namespaces.php +29 -0
- lib/Genesis/vendor/composer/autoload_psr4.php +9 -0
- lib/Genesis/vendor/composer/autoload_real.php +61 -0
- lib/Genesis/vendor/composer/installed.json +545 -0
- package.xml +24 -0
app/code/community/EMerchantPay/Genesis/Block/Form/Checkout.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Block_Form_Checkout
|
22 |
+
*
|
23 |
+
* Form Block for Checkout method
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Block_Form_Checkout extends Mage_Payment_Block_Form
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Setup
|
29 |
+
*/
|
30 |
+
protected function _construct()
|
31 |
+
{
|
32 |
+
parent::_construct();
|
33 |
+
$this->setTemplate('emerchantpay/form/checkout.phtml');
|
34 |
+
}
|
35 |
+
}
|
app/code/community/EMerchantPay/Genesis/Block/Form/Direct.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Block_Form_Direct
|
22 |
+
*
|
23 |
+
* Form Block for Direct method
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Block_Form_Direct extends Mage_Payment_Block_Form
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Setup
|
29 |
+
*/
|
30 |
+
protected function _construct()
|
31 |
+
{
|
32 |
+
parent::_construct();
|
33 |
+
$this->setTemplate('emerchantpay/form/direct.phtml');
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Retrieve payment configuration object
|
38 |
+
*
|
39 |
+
* @return Mage_Payment_Model_Config
|
40 |
+
*/
|
41 |
+
protected function _getConfig()
|
42 |
+
{
|
43 |
+
return Mage::getSingleton('payment/config');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Retrieve availables credit card types
|
48 |
+
*
|
49 |
+
* @return array
|
50 |
+
*/
|
51 |
+
public function getCcAvailableTypes()
|
52 |
+
{
|
53 |
+
$types = $this->_getConfig()->getCcTypes();
|
54 |
+
if ($method = $this->getMethod()) {
|
55 |
+
$availableTypes = $method->getConfigData('cctypes');
|
56 |
+
if ($availableTypes) {
|
57 |
+
$availableTypes = explode(',', $availableTypes);
|
58 |
+
foreach ($types as $code=>$name) {
|
59 |
+
if (!in_array($code, $availableTypes)) {
|
60 |
+
unset($types[$code]);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
return $types;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Retrieve credit card expire months
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
public function getCcMonths()
|
74 |
+
{
|
75 |
+
$months = $this->getData('cc_months');
|
76 |
+
if (is_null($months)) {
|
77 |
+
$months[0] = $this->__('Month');
|
78 |
+
$months = array_merge($months, $this->_getConfig()->getMonths());
|
79 |
+
$this->setData('cc_months', $months);
|
80 |
+
}
|
81 |
+
return $months;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Retrieve credit card expire years
|
86 |
+
*
|
87 |
+
* @return array
|
88 |
+
*/
|
89 |
+
public function getCcYears()
|
90 |
+
{
|
91 |
+
$years = $this->getData('cc_years');
|
92 |
+
if (is_null($years)) {
|
93 |
+
$years = $this->_getConfig()->getYears();
|
94 |
+
$years = array(0=>$this->__('Year'))+$years;
|
95 |
+
$this->setData('cc_years', $years);
|
96 |
+
}
|
97 |
+
return $years;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Retrieve has verification configuration
|
102 |
+
*
|
103 |
+
* @return boolean
|
104 |
+
*/
|
105 |
+
public function hasVerification()
|
106 |
+
{
|
107 |
+
if ($this->getMethod()) {
|
108 |
+
$configData = $this->getMethod()->getConfigData('useccv');
|
109 |
+
if(is_null($configData)){
|
110 |
+
return true;
|
111 |
+
}
|
112 |
+
return (bool) $configData;
|
113 |
+
}
|
114 |
+
return true;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Render block HTML
|
119 |
+
*
|
120 |
+
* @return string
|
121 |
+
*/
|
122 |
+
protected function _toHtml()
|
123 |
+
{
|
124 |
+
Mage::dispatchEvent('payment_form_block_to_html_before', array(
|
125 |
+
'block' => $this
|
126 |
+
));
|
127 |
+
|
128 |
+
return parent::_toHtml();
|
129 |
+
}
|
130 |
+
}
|
app/code/community/EMerchantPay/Genesis/Block/Info/Checkout.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Block_Info_Checkout
|
22 |
+
*
|
23 |
+
* Info Block for Checkout method
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Block_Info_Checkout extends Mage_Payment_Block_Info
|
26 |
+
{
|
27 |
+
protected function _construct()
|
28 |
+
{
|
29 |
+
parent::_construct();
|
30 |
+
$this->setTemplate('emerchantpay/info/checkout.phtml');
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getMethodCode()
|
34 |
+
{
|
35 |
+
return $this->getInfo()->getMethodInstance()->getCode();
|
36 |
+
}
|
37 |
+
}
|
app/code/community/EMerchantPay/Genesis/Block/Info/Direct.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Block_Info_Direct
|
22 |
+
*
|
23 |
+
* Info block for Direct method
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Block_Info_Direct extends Mage_Payment_Block_Info
|
26 |
+
{
|
27 |
+
protected function _construct()
|
28 |
+
{
|
29 |
+
parent::_construct();
|
30 |
+
$this->setTemplate('emerchantpay/info/direct.phtml');
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getMethodCode()
|
34 |
+
{
|
35 |
+
return $this->getInfo()->getMethodInstance()->getCode();
|
36 |
+
}
|
37 |
+
}
|
app/code/community/EMerchantPay/Genesis/Block/Redirect/Checkout.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Block_Redirect_Checkout
|
22 |
+
*
|
23 |
+
* Redirect Block for Checkout method
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Block_Redirect_Checkout extends Mage_Core_Block_Template
|
26 |
+
{
|
27 |
+
/** @var String */
|
28 |
+
private $unique_id;
|
29 |
+
/** @var EMerchantPay_Genesis_Helper_Data $helper */
|
30 |
+
private $helper;
|
31 |
+
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
|
36 |
+
$this->setHelper();
|
37 |
+
|
38 |
+
$this->setUniqueId();
|
39 |
+
|
40 |
+
$this->setTemplate('emerchantpay/redirect/checkout.phtml');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Generate HTML form
|
45 |
+
*
|
46 |
+
* @return string
|
47 |
+
*/
|
48 |
+
public function generateForm()
|
49 |
+
{
|
50 |
+
$form = new Varien_Data_Form();
|
51 |
+
|
52 |
+
$form
|
53 |
+
->setAction(
|
54 |
+
$this->helper->getCheckoutSession()->getEmerchantPayCheckoutRedirectUrl()
|
55 |
+
)
|
56 |
+
->setId('emerchantpay_redirect_notification')
|
57 |
+
->setName('emerchantpay_redirect_notification')
|
58 |
+
->setMethod('GET')
|
59 |
+
->setUseContainer(true);
|
60 |
+
|
61 |
+
$submitButton = new Varien_Data_Form_Element_Submit(
|
62 |
+
array(
|
63 |
+
'value' => $this->__('Click here, if you are not redirected within 10 seconds...'),
|
64 |
+
)
|
65 |
+
);
|
66 |
+
|
67 |
+
$submitButton->setId(
|
68 |
+
$this->getButtonId()
|
69 |
+
);
|
70 |
+
|
71 |
+
$form->addElement($submitButton);
|
72 |
+
|
73 |
+
return $form->toHtml();
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Get the button id
|
78 |
+
*
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
public function getButtonId()
|
82 |
+
{
|
83 |
+
return sprintf('redirect_to_dest_%s', $this->unique_id);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Set Helper
|
88 |
+
*/
|
89 |
+
private function setHelper()
|
90 |
+
{
|
91 |
+
$this->helper = Mage::helper('emerchantpay');
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Set Unique Id
|
96 |
+
*/
|
97 |
+
private function setUniqueId()
|
98 |
+
{
|
99 |
+
$this->unique_id = Mage::helper('core')->uniqHash();
|
100 |
+
}
|
101 |
+
}
|
app/code/community/EMerchantPay/Genesis/Block/Redirect/Direct.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Block_Redirect_Direct
|
22 |
+
*
|
23 |
+
* Redirect Block for Direct method
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Block_Redirect_Direct extends Mage_Core_Block_Template
|
26 |
+
{
|
27 |
+
/** @var String */
|
28 |
+
private $unique_id;
|
29 |
+
/** @var EMerchantPay_Genesis_Helper_Data $helper */
|
30 |
+
private $helper;
|
31 |
+
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
|
36 |
+
$this->setHelper();
|
37 |
+
|
38 |
+
$this->setUniqueId();
|
39 |
+
|
40 |
+
$this->setTemplate('emerchantpay/redirect/direct.phtml');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Get the button id
|
45 |
+
*
|
46 |
+
* @return string
|
47 |
+
*/
|
48 |
+
public function getButtonId()
|
49 |
+
{
|
50 |
+
return sprintf('redirect_to_dest_%s', $this->unique_id);
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Generate HTML form
|
55 |
+
*
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
+
public function generateForm()
|
59 |
+
{
|
60 |
+
$form = new Varien_Data_Form();
|
61 |
+
|
62 |
+
$form
|
63 |
+
->setAction(
|
64 |
+
$this->helper->getCheckoutSession()->getEmerchantPayDirectRedirectUrl()
|
65 |
+
)
|
66 |
+
->setId('emerchantpay_redirect_notification')
|
67 |
+
->setName('emerchantpay_redirect_notification')
|
68 |
+
->setMethod('GET')
|
69 |
+
->setUseContainer(true);
|
70 |
+
|
71 |
+
$submitButton = new Varien_Data_Form_Element_Submit(
|
72 |
+
array(
|
73 |
+
'value' => $this->__('Click here, if you are not redirected within 10 seconds...'),
|
74 |
+
)
|
75 |
+
);
|
76 |
+
|
77 |
+
$submitButton->setId(
|
78 |
+
$this->getButtonId()
|
79 |
+
);
|
80 |
+
|
81 |
+
$form->addElement($submitButton);
|
82 |
+
|
83 |
+
return $form->toHtml();
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Set Helper
|
88 |
+
*/
|
89 |
+
private function setHelper()
|
90 |
+
{
|
91 |
+
$this->helper = Mage::helper('emerchantpay');
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Set Unique Id
|
96 |
+
*/
|
97 |
+
private function setUniqueId()
|
98 |
+
{
|
99 |
+
$this->unique_id = Mage::helper('core')->uniqHash();
|
100 |
+
}
|
101 |
+
}
|
app/code/community/EMerchantPay/Genesis/Helper/Data.php
ADDED
@@ -0,0 +1,442 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Helper_Data
|
22 |
+
*
|
23 |
+
* Helper functions for eMerchantPay Direct / Checkout
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Include Genesis library
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
+
public function initLibrary()
|
33 |
+
{
|
34 |
+
// Mitigate PHP Bug #52339, as Magento already registers their AutoLoader
|
35 |
+
if (!class_exists('\Genesis\Genesis', false)) {
|
36 |
+
$genesisAutoLoadParams = array(
|
37 |
+
'magento_root' => MAGENTO_ROOT,
|
38 |
+
'integrated_genesis_lib_auto_loader' => Mage::getBaseDir('lib') . DS . 'Genesis' . DS . 'vendor' . DS . 'autoload.php',
|
39 |
+
'genesis_composer_dir' => 'genesisgateway',
|
40 |
+
'check_genesis_lib_version' => '1',
|
41 |
+
'required_genesis_lib_version' => ">= 1.4"
|
42 |
+
);
|
43 |
+
|
44 |
+
$genesisAutoLoadVarienObj = new Varien_Object($genesisAutoLoadParams);
|
45 |
+
|
46 |
+
/* This Event will be handled from Observer EMerchantPay_Genesis_Observer_GenesisAutoLoader (defined in etc/config.xml) */
|
47 |
+
Mage::dispatchEvent('emerchantpay_genesis_init_library', array('genesis_auto_load_params' => $genesisAutoLoadVarienObj));
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Check whether Genesis is initialized and init if not
|
53 |
+
*
|
54 |
+
* @param string $model Name of the model, for which we query settings
|
55 |
+
*
|
56 |
+
* @return void
|
57 |
+
*/
|
58 |
+
public function initClient($model)
|
59 |
+
{
|
60 |
+
$this->initLibrary();
|
61 |
+
|
62 |
+
\Genesis\Config::setEndpoint('emerchantpay');
|
63 |
+
|
64 |
+
\Genesis\Config::setUsername($this->getConfigData($model, 'genesis_username'));
|
65 |
+
\Genesis\Config::setPassword($this->getConfigData($model, 'genesis_password'));
|
66 |
+
|
67 |
+
\Genesis\Config::setEnvironment($this->getConfigData($model, 'genesis_environment'));
|
68 |
+
|
69 |
+
\Genesis\Config::setToken(
|
70 |
+
$this->getConfigData($model, 'genesis_token') ? $this->getConfigData($model, 'genesis_token') : ''
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get Module Configuration Key
|
76 |
+
*
|
77 |
+
* @param string $model Name of the Model
|
78 |
+
* @param string $key Configuration Key
|
79 |
+
*
|
80 |
+
* @return mixed The content of the requested key
|
81 |
+
*/
|
82 |
+
public function getConfigData($model, $key)
|
83 |
+
{
|
84 |
+
return Mage::getStoreConfig(
|
85 |
+
sprintf('payment/%s/%s', $model, $key)
|
86 |
+
);
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get A Success URL
|
91 |
+
*
|
92 |
+
* @see Genesis API Documentation
|
93 |
+
*
|
94 |
+
* @param string $model Name of the Model (Checkout/Direct)
|
95 |
+
*
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
public function getSuccessURL($model)
|
99 |
+
{
|
100 |
+
return Mage::getUrl(sprintf('emerchantpay/%s/success', $model), array('_secure' => true));
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Get A Failure URL
|
105 |
+
*
|
106 |
+
* @see Genesis API Documentation
|
107 |
+
*
|
108 |
+
* @param string $model Name of the Model (Checkout/Direct)
|
109 |
+
*
|
110 |
+
* @return string
|
111 |
+
*/
|
112 |
+
public function getFailureURL($model)
|
113 |
+
{
|
114 |
+
return Mage::getUrl(sprintf('emerchantpay/%s/failure', $model), array('_secure' => true));
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Get A Cancel URL
|
119 |
+
*
|
120 |
+
* @see Genesis API Documentation
|
121 |
+
*
|
122 |
+
* @param string $model Name of the Model (Checkout/Direct)
|
123 |
+
*
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
public function getCancelURL($model)
|
127 |
+
{
|
128 |
+
return Mage::getUrl(sprintf('emerchantpay/%s/cancel', $model), array('_secure' => true));
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Get A Notification URL
|
133 |
+
*
|
134 |
+
* @see Genesis API Documentation
|
135 |
+
*
|
136 |
+
* @param string $model Name of the Model (Checkout/Direct)
|
137 |
+
*
|
138 |
+
* @return string
|
139 |
+
*/
|
140 |
+
public function getNotifyURL($model)
|
141 |
+
{
|
142 |
+
return Mage::getUrl(sprintf('emerchantpay/%s/notify', $model), array('_secure' => true));
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Get a Redirect URL for the module
|
147 |
+
*
|
148 |
+
* @param string $model Name of the Model (Checkout/Direct)
|
149 |
+
*
|
150 |
+
* @return string
|
151 |
+
*/
|
152 |
+
public function getRedirectUrl($model)
|
153 |
+
{
|
154 |
+
return Mage::getUrl(sprintf('emerchantpay/%s/redirect', $model), array('_secure' => true));
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Generate Transaction Id based on the order id
|
159 |
+
* and salted to avoid duplication
|
160 |
+
*
|
161 |
+
* @param string $prefix Prefix of the orderId
|
162 |
+
*
|
163 |
+
* @return string
|
164 |
+
*/
|
165 |
+
public function genTransactionId($prefix = '')
|
166 |
+
{
|
167 |
+
$hash = Mage::helper('core')->uniqHash();
|
168 |
+
|
169 |
+
return (string)$prefix . substr($hash, -(strlen($hash) - strlen($prefix)));
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Get the current locale in 2-digit i18n format
|
174 |
+
*
|
175 |
+
* @return string
|
176 |
+
*/
|
177 |
+
public function getLocale()
|
178 |
+
{
|
179 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
180 |
+
|
181 |
+
return substr($locale, 0, 2);
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Return checkout session instance
|
186 |
+
*
|
187 |
+
* @return Mage_Checkout_Model_Session
|
188 |
+
*/
|
189 |
+
public function getCheckoutSession()
|
190 |
+
{
|
191 |
+
return Mage::getSingleton('checkout/session');
|
192 |
+
}
|
193 |
+
|
194 |
+
public function getCustomerSession()
|
195 |
+
{
|
196 |
+
return Mage::getSingleton('customer/session');
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Return sales quote instance for specified ID
|
201 |
+
*
|
202 |
+
* @param int $quoteId Quote identifier
|
203 |
+
* @return Mage_Sales_Model_Quote
|
204 |
+
*/
|
205 |
+
public function getQuote($quoteId)
|
206 |
+
{
|
207 |
+
return Mage::getModel('sales/quote')->load(
|
208 |
+
abs(intval($quoteId))
|
209 |
+
);
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Get an array of (k=>v) from stdClass Genesis response
|
214 |
+
*
|
215 |
+
* @param $response
|
216 |
+
* @return array
|
217 |
+
*/
|
218 |
+
public function getArrayFromGatewayResponse($response)
|
219 |
+
{
|
220 |
+
$transaction_details = array();
|
221 |
+
|
222 |
+
foreach ($response as $key => $value) {
|
223 |
+
if (is_string($value)) {
|
224 |
+
$transaction_details[$key] = $value;
|
225 |
+
}
|
226 |
+
|
227 |
+
if ($value instanceof DateTime) {
|
228 |
+
$transaction_details[$key] = $value->format('c');
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
return $transaction_details;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Get DESC list of specific transactions from payment object
|
237 |
+
*
|
238 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
239 |
+
* @param array|string $type_filter
|
240 |
+
* @return array
|
241 |
+
*/
|
242 |
+
public function getTransactionFromPaymentObject($payment, $type_filter)
|
243 |
+
{
|
244 |
+
$transactions = array();
|
245 |
+
|
246 |
+
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
247 |
+
->setOrderFilter($payment->getOrder())
|
248 |
+
->addPaymentIdFilter($payment->getId())
|
249 |
+
->addTxnTypeFilter($type_filter)
|
250 |
+
->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC);
|
251 |
+
|
252 |
+
/** @var Mage_Sales_Model_Order_Payment_Transaction $txn */
|
253 |
+
foreach ($collection as $txn) {
|
254 |
+
$transactions[] = $txn->setOrderPaymentObject($payment);
|
255 |
+
}
|
256 |
+
|
257 |
+
return $transactions;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Get list of items in the order
|
262 |
+
*
|
263 |
+
* @see API parameter "Usage" or "Description"
|
264 |
+
*
|
265 |
+
* @param Mage_Sales_Model_Order_Payment $order
|
266 |
+
*
|
267 |
+
* @return string Formatted List of Items
|
268 |
+
*/
|
269 |
+
public function getItemList($order)
|
270 |
+
{
|
271 |
+
$productResult = array();
|
272 |
+
|
273 |
+
foreach ($order->getAllItems() as $item) {
|
274 |
+
/** @var $item Mage_Sales_Model_Quote_Item */
|
275 |
+
$product = $item->getProduct();
|
276 |
+
|
277 |
+
$productResult[$product->getSku()] = array(
|
278 |
+
'sku' => $product->getSku(),
|
279 |
+
'name' => $product->getName(),
|
280 |
+
'qty' => isset($productResult[$product->getSku()]['qty']) ? $productResult[$product->getSku()]['qty'] : 1,
|
281 |
+
);
|
282 |
+
}
|
283 |
+
|
284 |
+
$description = '';
|
285 |
+
|
286 |
+
foreach ($productResult as $product) {
|
287 |
+
$description .= sprintf("%s (%s) x %d\r\n", $product['name'], $product['sku'], $product['qty']);
|
288 |
+
}
|
289 |
+
|
290 |
+
return $description;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Restore customer Quote
|
295 |
+
*
|
296 |
+
* @param $shouldCancel
|
297 |
+
* @return bool
|
298 |
+
*/
|
299 |
+
public function restoreQuote($shouldCancel = false)
|
300 |
+
{
|
301 |
+
$order = $this->getCheckoutSession()->getLastRealOrder();
|
302 |
+
|
303 |
+
if ($order->getId()) {
|
304 |
+
$quote = $this->getQuote($order->getQuoteId());
|
305 |
+
|
306 |
+
if ($shouldCancel && $order->canCancel()) {
|
307 |
+
$order->cancel()->save();
|
308 |
+
}
|
309 |
+
|
310 |
+
if ($quote->getId()) {
|
311 |
+
$quote->setIsActive(1)
|
312 |
+
->setReservedOrderId(null)
|
313 |
+
->save();
|
314 |
+
$this->getCheckoutSession()
|
315 |
+
->replaceQuote($quote)
|
316 |
+
->unsLastRealOrderId();
|
317 |
+
|
318 |
+
return true;
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
return false;
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Set an order status based on transaction status
|
327 |
+
*
|
328 |
+
* @param Mage_Sales_Model_Order $order
|
329 |
+
* @param string $status
|
330 |
+
* @param string $message
|
331 |
+
*/
|
332 |
+
public function setOrderState($order, $status, $message = '')
|
333 |
+
{
|
334 |
+
$this->initLibrary();
|
335 |
+
|
336 |
+
switch ($status) {
|
337 |
+
case \Genesis\API\Constants\Transaction\States::APPROVED:
|
338 |
+
$order
|
339 |
+
->setState(
|
340 |
+
Mage_Sales_Model_Order::STATE_PROCESSING,
|
341 |
+
Mage_Sales_Model_Order::STATE_PROCESSING,
|
342 |
+
$message,
|
343 |
+
false
|
344 |
+
)
|
345 |
+
->save();
|
346 |
+
break;
|
347 |
+
case \Genesis\API\Constants\Transaction\States::PENDING:
|
348 |
+
case \Genesis\API\Constants\Transaction\States::PENDING_ASYNC:
|
349 |
+
$order
|
350 |
+
->setState(
|
351 |
+
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
352 |
+
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
353 |
+
$message,
|
354 |
+
false
|
355 |
+
)
|
356 |
+
->save();
|
357 |
+
break;
|
358 |
+
case \Genesis\API\Constants\Transaction\States::ERROR:
|
359 |
+
case \Genesis\API\Constants\Transaction\States::DECLINED:
|
360 |
+
|
361 |
+
/** @var Mage_Sales_Model_Order_Invoice $invoice */
|
362 |
+
foreach ($order->getInvoiceCollection() as $invoice) {
|
363 |
+
$invoice->cancel();
|
364 |
+
}
|
365 |
+
|
366 |
+
$order
|
367 |
+
->registerCancellation($message)
|
368 |
+
->setCustomerNoteNotify(true)
|
369 |
+
->save();
|
370 |
+
|
371 |
+
break;
|
372 |
+
default:
|
373 |
+
$order->save();
|
374 |
+
break;
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* During "Checkout" we don't know have a Token,
|
380 |
+
* however its required at a latter stage, which
|
381 |
+
* means we have to extract it from the payment
|
382 |
+
* data. We save the token when we receive a
|
383 |
+
* notification from Genesis, then we only have
|
384 |
+
* to find the earliest payment_transaction
|
385 |
+
*
|
386 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
387 |
+
*
|
388 |
+
* @return void
|
389 |
+
*/
|
390 |
+
public function setTokenByPaymentTransaction($payment)
|
391 |
+
{
|
392 |
+
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
393 |
+
->setOrderFilter($payment->getOrder())
|
394 |
+
->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_ASC);
|
395 |
+
|
396 |
+
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
|
397 |
+
foreach ($collection as $transaction) {
|
398 |
+
$information = $transaction->getAdditionalInformation(
|
399 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
|
400 |
+
);
|
401 |
+
|
402 |
+
foreach ($information as $field => $value) {
|
403 |
+
if ($field == 'terminal_token') {
|
404 |
+
\Genesis\Config::setToken($value);
|
405 |
+
}
|
406 |
+
}
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Redirect the visitor to the login page if
|
412 |
+
* they are not logged in
|
413 |
+
*
|
414 |
+
* @param string $target Alternative target, if you don't want to redirect to login
|
415 |
+
*
|
416 |
+
* @return void
|
417 |
+
*/
|
418 |
+
public function redirectIfNotLoggedIn($target = null)
|
419 |
+
{
|
420 |
+
/** @var Mage_Customer_Helper_Data $customer */
|
421 |
+
$customer = Mage::helper('customer');
|
422 |
+
|
423 |
+
/** @var Mage_Core_Helper_Url $url */
|
424 |
+
$url = Mage::helper('core/url');
|
425 |
+
|
426 |
+
if (!$customer->isLoggedIn()) {
|
427 |
+
$target = $target ? $target : Mage::getUrl('customer/account/login', array('_secure' => true));
|
428 |
+
|
429 |
+
$this->getCustomerSession()->setBeforeAuthUrl(
|
430 |
+
$url->getCurrentUrl()
|
431 |
+
);
|
432 |
+
|
433 |
+
Mage::app()
|
434 |
+
->getFrontController()
|
435 |
+
->getResponse()
|
436 |
+
->setRedirect($target)
|
437 |
+
->sendHeaders();
|
438 |
+
|
439 |
+
exit(0);
|
440 |
+
}
|
441 |
+
}
|
442 |
+
}
|
app/code/community/EMerchantPay/Genesis/Model/Admin/Checkout/Options/Transaction/Type.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Model_Admin_Transaction_Type
|
22 |
+
*
|
23 |
+
* Admin options Drop-down for Genesis Transaction Types
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Model_Admin_Checkout_Options_Transaction_Type
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Pre-load the required files
|
29 |
+
*/
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
/** @var EMerchantPay_Genesis_Helper_Data $helper */
|
33 |
+
$helper = Mage::helper('emerchantpay');
|
34 |
+
|
35 |
+
$helper->initLibrary();
|
36 |
+
}
|
37 |
+
/**
|
38 |
+
* Return the transaction types for an Options field
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function toOptionArray()
|
43 |
+
{
|
44 |
+
$options = array();
|
45 |
+
|
46 |
+
foreach (static::getTransactionTypes() as $code => $name) {
|
47 |
+
$options[] = array(
|
48 |
+
'value' => $code,
|
49 |
+
'label' => $name
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
return $options;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get the transaction types as:
|
58 |
+
*
|
59 |
+
* key = Code Name
|
60 |
+
* value = Localized Name
|
61 |
+
*
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
static function getTransactionTypes()
|
65 |
+
{
|
66 |
+
return array(
|
67 |
+
\Genesis\API\Constants\Transaction\Types::ABNIDEAL =>
|
68 |
+
Mage::helper('emerchantpay')->__('ABN iDEAL'),
|
69 |
+
\Genesis\API\Constants\Transaction\Types::AUTHORIZE =>
|
70 |
+
Mage::helper('emerchantpay')->__('Authorize'),
|
71 |
+
\Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D =>
|
72 |
+
Mage::helper('emerchantpay')->__('Authorize (3D-Secure)'),
|
73 |
+
\Genesis\API\Constants\Transaction\Types::CASHU =>
|
74 |
+
Mage::helper('emerchantpay')->__('CashU'),
|
75 |
+
\Genesis\API\Constants\Payment\Methods::EPS =>
|
76 |
+
Mage::helper('emerchantpay')->__('eps'),
|
77 |
+
\Genesis\API\Constants\Payment\Methods::GIRO_PAY =>
|
78 |
+
Mage::helper('emerchantpay')->__('GiroPay'),
|
79 |
+
\Genesis\API\Constants\Transaction\Types::NETELLER =>
|
80 |
+
Mage::helper('emerchantpay')->__('Neteller'),
|
81 |
+
\Genesis\API\Constants\Payment\Methods::QIWI =>
|
82 |
+
Mage::helper('emerchantpay')->__('Qiwi'),
|
83 |
+
\Genesis\API\Constants\Transaction\Types::PAYSAFECARD =>
|
84 |
+
Mage::helper('emerchantpay')->__('PaySafeCard'),
|
85 |
+
\Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE =>
|
86 |
+
Mage::helper('emerchantpay')->__('PayByVoucher (Sale)'),
|
87 |
+
\Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY =>
|
88 |
+
Mage::helper('emerchantpay')->__('PayByVoucher (oBeP)'),
|
89 |
+
\Genesis\API\Constants\Payment\Methods::PRZELEWY24 =>
|
90 |
+
Mage::helper('emerchantpay')->__('Przelewy24'),
|
91 |
+
\Genesis\API\Constants\Transaction\Types::POLI =>
|
92 |
+
Mage::helper('emerchantpay')->__('POLi'),
|
93 |
+
\Genesis\API\Constants\Payment\Methods::SAFETY_PAY =>
|
94 |
+
Mage::helper('emerchantpay')->__('SafetyPay'),
|
95 |
+
\Genesis\API\Constants\Transaction\Types::SALE =>
|
96 |
+
Mage::helper('emerchantpay')->__('Sale'),
|
97 |
+
\Genesis\API\Constants\Transaction\Types::SALE_3D =>
|
98 |
+
Mage::helper('emerchantpay')->__('Sale (3D-Secure)'),
|
99 |
+
\Genesis\API\Constants\Transaction\Types::SOFORT =>
|
100 |
+
Mage::helper('emerchantpay')->__('SOFORT'),
|
101 |
+
\Genesis\API\Constants\Payment\Methods::TELEINGRESO =>
|
102 |
+
Mage::helper('emerchantpay')->__('TeleIngreso'),
|
103 |
+
\Genesis\API\Constants\Payment\Methods::TRUST_PAY =>
|
104 |
+
Mage::helper('emerchantpay')->__('TrustPay'),
|
105 |
+
\Genesis\API\Constants\Transaction\Types::WEBMONEY =>
|
106 |
+
Mage::helper('emerchantpay')->__('WebMoney'),
|
107 |
+
);
|
108 |
+
}
|
109 |
+
}
|
app/code/community/EMerchantPay/Genesis/Model/Admin/Direct/Options/Transaction/Type.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Model_Admin_Direct_Options_Transaction_Type
|
22 |
+
*
|
23 |
+
* Admin options Drop-down for Genesis Transaction Types
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Model_Admin_Direct_Options_Transaction_Type
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Pre-load the required files
|
29 |
+
*/
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
/** @var EMerchantPay_Genesis_Helper_Data $helper */
|
33 |
+
$helper = Mage::helper('emerchantpay');
|
34 |
+
|
35 |
+
$helper->initLibrary();
|
36 |
+
}
|
37 |
+
/**
|
38 |
+
* Return the transaction types for an Options field
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*/
|
42 |
+
public function toOptionArray()
|
43 |
+
{
|
44 |
+
$options = array();
|
45 |
+
|
46 |
+
foreach (static::getTransactionTypes() as $code => $name) {
|
47 |
+
$options[] = array(
|
48 |
+
'value' => $code,
|
49 |
+
'label' => $name
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
return $options;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get the transaction types as:
|
58 |
+
*
|
59 |
+
* key = Code Name
|
60 |
+
* value = Localized Name
|
61 |
+
*
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
static function getTransactionTypes()
|
65 |
+
{
|
66 |
+
return array(
|
67 |
+
\Genesis\API\Constants\Transaction\Types::AUTHORIZE =>
|
68 |
+
Mage::helper('emerchantpay')->__('Authorize'),
|
69 |
+
\Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D =>
|
70 |
+
Mage::helper('emerchantpay')->__('Authorize (3D-Secure)'),
|
71 |
+
\Genesis\API\Constants\Transaction\Types::SALE =>
|
72 |
+
Mage::helper('emerchantpay')->__('Sale'),
|
73 |
+
\Genesis\API\Constants\Transaction\Types::SALE_3D =>
|
74 |
+
Mage::helper('emerchantpay')->__('Sale (3D-Secure)'),
|
75 |
+
);
|
76 |
+
}
|
77 |
+
}
|
app/code/community/EMerchantPay/Genesis/Model/Admin/Environment.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Model_Admin_Environment
|
22 |
+
*
|
23 |
+
* Admin options Drop-down for Gateway environment
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Model_Admin_Environment
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Return the environment types for an Options field
|
29 |
+
*
|
30 |
+
* @return array
|
31 |
+
*/
|
32 |
+
public function toOptionArray()
|
33 |
+
{
|
34 |
+
$options = array();
|
35 |
+
|
36 |
+
foreach (static::getEnvironmentOptions() as $code => $name) {
|
37 |
+
$options[] = array(
|
38 |
+
'value' => $code,
|
39 |
+
'label' => $name
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
return $options;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Get the available environment types
|
48 |
+
*
|
49 |
+
* @return array
|
50 |
+
*/
|
51 |
+
static function getEnvironmentOptions()
|
52 |
+
{
|
53 |
+
return array(
|
54 |
+
'sandbox' => Mage::helper('emerchantpay')->__('Yes'),
|
55 |
+
'production' => Mage::helper('emerchantpay')->__('No'),
|
56 |
+
);
|
57 |
+
}
|
58 |
+
}
|
app/code/community/EMerchantPay/Genesis/Model/Checkout.php
ADDED
@@ -0,0 +1,664 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
class EMerchantPay_Genesis_Model_Checkout extends Mage_Payment_Model_Method_Abstract
|
21 |
+
{
|
22 |
+
protected $_code = 'emerchantpay_checkout';
|
23 |
+
|
24 |
+
protected $_formBlockType = 'emerchantpay/form_checkout';
|
25 |
+
protected $_infoBlockType = 'emerchantpay/info_checkout';
|
26 |
+
|
27 |
+
protected $_isGateway = true;
|
28 |
+
protected $_canOrder = true;
|
29 |
+
protected $_canAuthorize = true;
|
30 |
+
protected $_canCapture = true;
|
31 |
+
protected $_canCapturePartial = true;
|
32 |
+
protected $_canRefund = true;
|
33 |
+
protected $_canVoid = true;
|
34 |
+
protected $_canUseInternal = false;
|
35 |
+
protected $_canUseCheckout = true;
|
36 |
+
|
37 |
+
protected $_canUseForMultishipping = false;
|
38 |
+
protected $_canFetchTransactionInfo = true;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* WPF Create method piggyback-ing the Magento's internal Authorize method
|
42 |
+
*
|
43 |
+
* @param Mage_Sales_Model_Order_Payment|Varien_Object $payment
|
44 |
+
* @param String $amount
|
45 |
+
* @return EMerchantPay_Genesis_Model_Checkout
|
46 |
+
* @throws Mage_Core_Exception
|
47 |
+
*/
|
48 |
+
public function order(Varien_Object $payment, $amount)
|
49 |
+
{
|
50 |
+
Mage::log('Checkout transaction for order #' . $payment->getOrder()->getIncrementId());
|
51 |
+
|
52 |
+
try {
|
53 |
+
$this->getHelper()->initClient($this->getCode());
|
54 |
+
|
55 |
+
/** @var Mage_Sales_Model_Order $order */
|
56 |
+
$order = $payment->getOrder();
|
57 |
+
|
58 |
+
$billing = $order->getBillingAddress();
|
59 |
+
$shipping = $order->getShippingAddress();
|
60 |
+
|
61 |
+
$genesis = new \Genesis\Genesis('WPF\Create');
|
62 |
+
|
63 |
+
$genesis
|
64 |
+
->request()
|
65 |
+
->setTransactionId(
|
66 |
+
$this->getHelper()->genTransactionId(
|
67 |
+
$order->getIncrementId()
|
68 |
+
)
|
69 |
+
)
|
70 |
+
->setCurrency($order->getBaseCurrencyCode())
|
71 |
+
->setAmount($amount)
|
72 |
+
->setUsage(
|
73 |
+
$this->getHelper()->__('Magento Payment')
|
74 |
+
)
|
75 |
+
->setDescription($this->getHelper()->getItemList($order))
|
76 |
+
->setCustomerPhone($billing->getTelephone())
|
77 |
+
->setCustomerEmail($order->getCustomerEmail())
|
78 |
+
->setNotificationUrl(
|
79 |
+
$this->getHelper()->getNotifyURL('checkout')
|
80 |
+
)
|
81 |
+
->setReturnSuccessUrl(
|
82 |
+
$this->getHelper()->getSuccessURL('checkout')
|
83 |
+
)
|
84 |
+
->setReturnFailureUrl(
|
85 |
+
$this->getHelper()->getFailureURL('checkout')
|
86 |
+
)
|
87 |
+
->setReturnCancelUrl(
|
88 |
+
$this->getHelper()->getCancelURL('checkout')
|
89 |
+
)
|
90 |
+
->setBillingFirstName($billing->getData('firstname'))
|
91 |
+
->setBillingLastName($billing->getData('lastname'))
|
92 |
+
->setBillingAddress1($billing->getStreet(1))
|
93 |
+
->setBillingAddress2($billing->getStreet(2))
|
94 |
+
->setBillingZipCode($billing->getPostcode())
|
95 |
+
->setBillingCity($billing->getCity())
|
96 |
+
->setBillingState($billing->getRegion())
|
97 |
+
->setBillingCountry($billing->getCountry())
|
98 |
+
->setShippingFirstName($shipping->getData('firstname'))
|
99 |
+
->setShippingLastName($shipping->getData('lastname'))
|
100 |
+
->setShippingAddress1($shipping->getStreet(1))
|
101 |
+
->setShippingAddress2($shipping->getStreet(2))
|
102 |
+
->setShippingZipCode($shipping->getPostcode())
|
103 |
+
->setShippingCity($shipping->getCity())
|
104 |
+
->setShippingState($shipping->getRegion())
|
105 |
+
->setShippinCountry($shipping->getCountry())
|
106 |
+
->setLanguage($this->getHelper()->getLocale());
|
107 |
+
|
108 |
+
|
109 |
+
foreach ($this->getTransactionTypes() as $transaction_type) {
|
110 |
+
if (is_array($transaction_type)) {
|
111 |
+
$genesis->request()->addTransactionType(
|
112 |
+
$transaction_type['name'], $transaction_type['parameters']
|
113 |
+
);
|
114 |
+
} else {
|
115 |
+
$genesis->request()->addTransactionType($transaction_type);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
$genesis->execute();
|
120 |
+
|
121 |
+
$payment
|
122 |
+
->setTransactionId(
|
123 |
+
$genesis->response()->getResponseObject()->unique_id
|
124 |
+
)
|
125 |
+
->setIsTransactionPending(true)
|
126 |
+
->addTransaction(
|
127 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER
|
128 |
+
);
|
129 |
+
|
130 |
+
$payment->setSkipTransactionCreation(true);
|
131 |
+
|
132 |
+
// Save the redirect url with our
|
133 |
+
$this->getHelper()->getCheckoutSession()->setEmerchantPayCheckoutRedirectUrl(
|
134 |
+
$genesis->response()->getResponseObject()->redirect_url
|
135 |
+
);
|
136 |
+
} catch (Exception $exception) {
|
137 |
+
Mage::logException($exception);
|
138 |
+
|
139 |
+
Mage::throwException(
|
140 |
+
$this->getHelper()->__($exception->getMessage())
|
141 |
+
);
|
142 |
+
}
|
143 |
+
|
144 |
+
return $this;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
149 |
+
* @param float $amount
|
150 |
+
* @return $this|bool
|
151 |
+
* @throws Mage_Core_Exception
|
152 |
+
*/
|
153 |
+
public function capture(Varien_Object $payment, $amount)
|
154 |
+
{
|
155 |
+
Mage::log('Capture transaction for order #' . $payment->getOrder()->getIncrementId());
|
156 |
+
|
157 |
+
try {
|
158 |
+
$this->getHelper()->initClient($this->getCode());
|
159 |
+
|
160 |
+
$this->getHelper()->setTokenByPaymentTransaction($payment);
|
161 |
+
|
162 |
+
$authorize = $payment->lookupTransaction(null, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
163 |
+
|
164 |
+
/* Capture should only be possible, when Authorize Transaction Exists */
|
165 |
+
if (!isset($authorize) || $authorize === false) {
|
166 |
+
Mage::log('Capture transaction for order #' . $payment->getOrder()->getIncrementId() . ' cannot be finished (No Authorize Transaction exists)');
|
167 |
+
return $this;
|
168 |
+
}
|
169 |
+
|
170 |
+
$reference_id = $authorize->getTxnId();
|
171 |
+
|
172 |
+
$genesis = new \Genesis\Genesis('Financial\Capture');
|
173 |
+
|
174 |
+
$genesis
|
175 |
+
->request()
|
176 |
+
->setTransactionId(
|
177 |
+
$this->getHelper()->genTransactionId(
|
178 |
+
$payment->getOrder()->getIncrementId()
|
179 |
+
)
|
180 |
+
)
|
181 |
+
->setRemoteIp(
|
182 |
+
$this->getHelper('core/http')->getRemoteAddr(false)
|
183 |
+
)
|
184 |
+
->setReferenceId(
|
185 |
+
$reference_id
|
186 |
+
)
|
187 |
+
->setCurrency(
|
188 |
+
$payment->getOrder()->getBaseCurrencyCode()
|
189 |
+
)
|
190 |
+
->setAmount(
|
191 |
+
$amount
|
192 |
+
);
|
193 |
+
|
194 |
+
$genesis->execute();
|
195 |
+
|
196 |
+
$payment
|
197 |
+
->setTransactionId(
|
198 |
+
$genesis->response()->getResponseObject()->unique_id
|
199 |
+
)
|
200 |
+
->setParentTransactionId(
|
201 |
+
$reference_id
|
202 |
+
)
|
203 |
+
->setShouldCloseParentTransaction(
|
204 |
+
true
|
205 |
+
)
|
206 |
+
->resetTransactionAdditionalInfo(
|
207 |
+
|
208 |
+
)
|
209 |
+
->setTransactionAdditionalInfo(
|
210 |
+
array(
|
211 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
212 |
+
$genesis->response()->getResponseObject()
|
213 |
+
)
|
214 |
+
),
|
215 |
+
null
|
216 |
+
);
|
217 |
+
|
218 |
+
$payment->save();
|
219 |
+
} catch (Exception $exception) {
|
220 |
+
Mage::logException($exception);
|
221 |
+
|
222 |
+
Mage::throwException(
|
223 |
+
$this->getHelper()->__($exception->getMessage())
|
224 |
+
);
|
225 |
+
}
|
226 |
+
|
227 |
+
return $this;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Refund the last successful transaction
|
232 |
+
*
|
233 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
234 |
+
* @param float $amount
|
235 |
+
*
|
236 |
+
* @return EMerchantPay_Genesis_Model_Checkout
|
237 |
+
*/
|
238 |
+
public function refund(Varien_Object $payment, $amount)
|
239 |
+
{
|
240 |
+
Mage::log('Refund transaction for order #' . $payment->getOrder()->getIncrementId());
|
241 |
+
|
242 |
+
try {
|
243 |
+
$this->getHelper()->initClient($this->getCode());
|
244 |
+
|
245 |
+
$this->getHelper()->setTokenByPaymentTransaction($payment);
|
246 |
+
|
247 |
+
$capture = $payment->lookupTransaction(null, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
|
248 |
+
|
249 |
+
/* Refund Transaction is only possible, when Capture Transaction Exists */
|
250 |
+
if (!isset($capture) || $capture === false) {
|
251 |
+
Mage::log('Refund transaction for order #' . $payment->getOrder()->getIncrementId() . ' could not be completed! (No Capture Transaction Exists');
|
252 |
+
return $this;
|
253 |
+
}
|
254 |
+
|
255 |
+
$reference_id = $capture->getTxnId();
|
256 |
+
|
257 |
+
$genesis = new \Genesis\Genesis('Financial\Refund');
|
258 |
+
|
259 |
+
$genesis
|
260 |
+
->request()
|
261 |
+
->setTransactionId(
|
262 |
+
$this->getHelper()->genTransactionId(
|
263 |
+
$payment->getOrder()->getIncrementId()
|
264 |
+
)
|
265 |
+
)
|
266 |
+
->setRemoteIp(
|
267 |
+
$this->getHelper('core/http')->getRemoteAddr(false)
|
268 |
+
)
|
269 |
+
->setReferenceId(
|
270 |
+
$reference_id
|
271 |
+
)
|
272 |
+
->setCurrency(
|
273 |
+
$payment->getOrder()->getBaseCurrencyCode()
|
274 |
+
)
|
275 |
+
->setAmount($amount);
|
276 |
+
|
277 |
+
$genesis->execute();
|
278 |
+
|
279 |
+
$payment
|
280 |
+
->setTransactionId(
|
281 |
+
$genesis->response()->getResponseObject()->unique_id
|
282 |
+
)
|
283 |
+
->setParentTransactionId(
|
284 |
+
$reference_id
|
285 |
+
)
|
286 |
+
->setShouldCloseParentTransaction(
|
287 |
+
true
|
288 |
+
)
|
289 |
+
->resetTransactionAdditionalInfo(
|
290 |
+
|
291 |
+
)
|
292 |
+
->setTransactionAdditionalInfo(
|
293 |
+
array(
|
294 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
295 |
+
$genesis->response()->getResponseObject()
|
296 |
+
)
|
297 |
+
),
|
298 |
+
null
|
299 |
+
);
|
300 |
+
|
301 |
+
$payment->save();
|
302 |
+
} catch (Exception $exception) {
|
303 |
+
Mage::logException($exception);
|
304 |
+
|
305 |
+
Mage::throwException(
|
306 |
+
$exception->getMessage()
|
307 |
+
);
|
308 |
+
}
|
309 |
+
|
310 |
+
return $this;
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Void the last successful transaction
|
315 |
+
*
|
316 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
317 |
+
*
|
318 |
+
* @return EMerchantPay_Genesis_Model_Checkout
|
319 |
+
*/
|
320 |
+
public function void(Varien_Object $payment)
|
321 |
+
{
|
322 |
+
Mage::log('Void transaction for order #' . $payment->getOrder()->getIncrementId());
|
323 |
+
|
324 |
+
try {
|
325 |
+
$this->getHelper()->initClient($this->getCode());
|
326 |
+
|
327 |
+
$this->getHelper()->setTokenByPaymentTransaction($payment);
|
328 |
+
|
329 |
+
$transactions = $this->getHelper()->getTransactionFromPaymentObject($payment, array(
|
330 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,
|
331 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE
|
332 |
+
));
|
333 |
+
|
334 |
+
$reference_id = $transactions ? reset($transactions)->getTxnId() : null;
|
335 |
+
|
336 |
+
$genesis = new \Genesis\Genesis('Financial\Void');
|
337 |
+
|
338 |
+
$genesis
|
339 |
+
->request()
|
340 |
+
->setTransactionId(
|
341 |
+
$this->getHelper()->genTransactionId(
|
342 |
+
$payment->getOrder()->getIncrementId()
|
343 |
+
)
|
344 |
+
)
|
345 |
+
->setRemoteIp(
|
346 |
+
$this->getHelper('core/http')->getRemoteAddr(false)
|
347 |
+
)
|
348 |
+
->setReferenceId(
|
349 |
+
$reference_id
|
350 |
+
);
|
351 |
+
|
352 |
+
$genesis->execute();
|
353 |
+
|
354 |
+
$payment
|
355 |
+
->setTransactionId(
|
356 |
+
$genesis->response()->getResponseObject()->unique_id
|
357 |
+
)
|
358 |
+
->setParentTransactionId(
|
359 |
+
$reference_id
|
360 |
+
)
|
361 |
+
->setShouldCloseParentTransaction(
|
362 |
+
true
|
363 |
+
)
|
364 |
+
->resetTransactionAdditionalInfo(
|
365 |
+
|
366 |
+
)
|
367 |
+
->setTransactionAdditionalInfo(
|
368 |
+
array(
|
369 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
370 |
+
$genesis->response()->getResponseObject()
|
371 |
+
)
|
372 |
+
),
|
373 |
+
null
|
374 |
+
);
|
375 |
+
|
376 |
+
$payment->save();
|
377 |
+
} catch (Exception $exception) {
|
378 |
+
Mage::logException($exception);
|
379 |
+
|
380 |
+
Mage::throwException(
|
381 |
+
$exception->getMessage()
|
382 |
+
);
|
383 |
+
}
|
384 |
+
|
385 |
+
return $this;
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* Cancel payment abstract method
|
390 |
+
*
|
391 |
+
* @param Varien_Object $payment
|
392 |
+
*
|
393 |
+
* @return EMerchantPay_Genesis_Model_Checkout
|
394 |
+
*/
|
395 |
+
public function cancel(Varien_Object $payment)
|
396 |
+
{
|
397 |
+
return $this->void($payment);
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* Fetch transaction details info
|
402 |
+
*
|
403 |
+
* @param Mage_Payment_Model_Info $payment
|
404 |
+
* @param string $transactionId
|
405 |
+
* @return array
|
406 |
+
*/
|
407 |
+
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
|
408 |
+
{
|
409 |
+
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
|
410 |
+
$transaction = Mage::getModel('sales/order_payment_transaction')->load($transactionId, 'txn_id');
|
411 |
+
|
412 |
+
$checkout_transaction = $transaction->getOrder()->getPayment()->lookupTransaction(
|
413 |
+
null,
|
414 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER
|
415 |
+
);
|
416 |
+
|
417 |
+
$reconcile = $this->reconcile($checkout_transaction->getTxnId());
|
418 |
+
|
419 |
+
// Get the current details
|
420 |
+
$transaction_details = $payment->getAdditionalInformation(
|
421 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
|
422 |
+
);
|
423 |
+
|
424 |
+
// Try to extract transaction details from the Gateway response
|
425 |
+
if ($reconcile->unique_id == $transactionId) {
|
426 |
+
$transaction_details = $reconcile;
|
427 |
+
}
|
428 |
+
else {
|
429 |
+
if ($reconcile->payment_transaction instanceof stdClass) {
|
430 |
+
if ($reconcile->payment_transaction->unique_id == $transactionId) {
|
431 |
+
$transaction_details = $reconcile->payment_transaction;
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
if ($reconcile->payment_transaction instanceof ArrayObject) {
|
436 |
+
foreach ($reconcile->payment_transaction as $payment_transaction) {
|
437 |
+
if ($payment_transaction->unique_id == $transactionId) {
|
438 |
+
$transaction_details = $payment_transaction;
|
439 |
+
}
|
440 |
+
}
|
441 |
+
}
|
442 |
+
}
|
443 |
+
|
444 |
+
// Remove the current details
|
445 |
+
$payment->unsAdditionalInformation(
|
446 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
|
447 |
+
);
|
448 |
+
|
449 |
+
// Set the default/updated transaction details
|
450 |
+
$payment->setAdditionalInformation(
|
451 |
+
array(
|
452 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
453 |
+
$transaction_details
|
454 |
+
)
|
455 |
+
),
|
456 |
+
null
|
457 |
+
);
|
458 |
+
|
459 |
+
$payment->save();
|
460 |
+
|
461 |
+
return $payment->getAdditionalInformation(
|
462 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
|
463 |
+
);
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Execute a WPF Reconcile
|
468 |
+
*
|
469 |
+
* @param $unique_id
|
470 |
+
*
|
471 |
+
* @return EMerchantPay_Genesis_Model_Checkout
|
472 |
+
*
|
473 |
+
* @throws Mage_Core_Exception
|
474 |
+
*/
|
475 |
+
public function reconcile($unique_id)
|
476 |
+
{
|
477 |
+
try {
|
478 |
+
$this->getHelper()->initClient($this->getCode());
|
479 |
+
|
480 |
+
$genesis = new \Genesis\Genesis('WPF\Reconcile');
|
481 |
+
|
482 |
+
$genesis->request()->setUniqueId($unique_id);
|
483 |
+
|
484 |
+
$genesis->execute();
|
485 |
+
|
486 |
+
return $genesis->response()->getResponseObject();
|
487 |
+
} catch (Exception $exception) {
|
488 |
+
Mage::logException($exception);
|
489 |
+
|
490 |
+
Mage::throwException(
|
491 |
+
$exception->getMessage()
|
492 |
+
);
|
493 |
+
}
|
494 |
+
|
495 |
+
return false;
|
496 |
+
}
|
497 |
+
|
498 |
+
public function processNotification($checkout_transaction)
|
499 |
+
{
|
500 |
+
try {
|
501 |
+
$this->getHelper()->initClient($this->getCode());
|
502 |
+
|
503 |
+
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
|
504 |
+
$transaction = Mage::getModel('sales/order_payment_transaction')->load($checkout_transaction->unique_id, 'txn_id');
|
505 |
+
|
506 |
+
$order = $transaction->getOrder();
|
507 |
+
|
508 |
+
if ($order) {
|
509 |
+
$transaction
|
510 |
+
->setOrderPaymentObject(
|
511 |
+
$order->getPayment()
|
512 |
+
)
|
513 |
+
->setAdditionalInformation(
|
514 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
|
515 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
516 |
+
$checkout_transaction
|
517 |
+
)
|
518 |
+
)
|
519 |
+
->save();
|
520 |
+
|
521 |
+
if (isset($checkout_transaction->payment_transaction)) {
|
522 |
+
$payment_transaction = $checkout_transaction->payment_transaction;
|
523 |
+
|
524 |
+
$payment = $order->getPayment();
|
525 |
+
|
526 |
+
$payment
|
527 |
+
->setTransactionId($payment_transaction->unique_id)
|
528 |
+
->setParentTransactionId($checkout_transaction->unique_id)
|
529 |
+
->setShouldCloseParentTransaction(true)
|
530 |
+
->setIsTransactionPending(false)
|
531 |
+
->resetTransactionAdditionalInfo()
|
532 |
+
->setTransactionAdditionalInfo(
|
533 |
+
array(
|
534 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
535 |
+
$payment_transaction
|
536 |
+
)
|
537 |
+
),
|
538 |
+
null
|
539 |
+
);
|
540 |
+
|
541 |
+
if ($payment_transaction->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
542 |
+
$payment->setIsTransactionClosed(false);
|
543 |
+
}
|
544 |
+
else {
|
545 |
+
$payment->setIsTransactionClosed(true);
|
546 |
+
}
|
547 |
+
|
548 |
+
switch ($payment_transaction->transaction_type) {
|
549 |
+
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE:
|
550 |
+
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
551 |
+
$payment->registerAuthorizationNotification($payment_transaction->amount, true);
|
552 |
+
break;
|
553 |
+
case \Genesis\API\Constants\Transaction\Types::ABNIDEAL:
|
554 |
+
case \Genesis\API\Constants\Transaction\Types::CASHU:
|
555 |
+
case \Genesis\API\Constants\Transaction\Types::NETELLER:
|
556 |
+
case \Genesis\API\Constants\Transaction\Types::PAYSAFECARD:
|
557 |
+
case \Genesis\API\Constants\Transaction\Types::PPRO:
|
558 |
+
case \Genesis\API\Constants\Transaction\Types::SALE:
|
559 |
+
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
560 |
+
case \Genesis\API\Constants\Transaction\Types::SOFORT:
|
561 |
+
$payment->registerCaptureNotification($payment_transaction->amount, true);
|
562 |
+
break;
|
563 |
+
default:
|
564 |
+
break;
|
565 |
+
}
|
566 |
+
|
567 |
+
|
568 |
+
$payment->save();
|
569 |
+
}
|
570 |
+
|
571 |
+
$this->getHelper()->setOrderState(
|
572 |
+
$order,
|
573 |
+
isset($payment_transaction) ? $payment_transaction->status : $checkout_transaction->status
|
574 |
+
);
|
575 |
+
|
576 |
+
return true;
|
577 |
+
}
|
578 |
+
} catch (Exception $exception) {
|
579 |
+
Mage::logException($exception);
|
580 |
+
}
|
581 |
+
|
582 |
+
return false;
|
583 |
+
}
|
584 |
+
|
585 |
+
/**
|
586 |
+
* Get the selected transaction types in array
|
587 |
+
*
|
588 |
+
* @return array
|
589 |
+
*/
|
590 |
+
public function getTransactionTypes()
|
591 |
+
{
|
592 |
+
$processed_list = array();
|
593 |
+
|
594 |
+
$selected_types = array_filter(
|
595 |
+
explode(',', $this->getConfigData('genesis_types'))
|
596 |
+
);
|
597 |
+
|
598 |
+
$alias_map = array(
|
599 |
+
\Genesis\API\Constants\Payment\Methods::EPS =>
|
600 |
+
\Genesis\API\Constants\Transaction\Types::PPRO,
|
601 |
+
\Genesis\API\Constants\Payment\Methods::GIRO_PAY =>
|
602 |
+
\Genesis\API\Constants\Transaction\Types::PPRO,
|
603 |
+
\Genesis\API\Constants\Payment\Methods::PRZELEWY24 =>
|
604 |
+
\Genesis\API\Constants\Transaction\Types::PPRO,
|
605 |
+
\Genesis\API\Constants\Payment\Methods::QIWI =>
|
606 |
+
\Genesis\API\Constants\Transaction\Types::PPRO,
|
607 |
+
\Genesis\API\Constants\Payment\Methods::SAFETY_PAY =>
|
608 |
+
\Genesis\API\Constants\Transaction\Types::PPRO,
|
609 |
+
\Genesis\API\Constants\Payment\Methods::TELEINGRESO =>
|
610 |
+
\Genesis\API\Constants\Transaction\Types::PPRO,
|
611 |
+
\Genesis\API\Constants\Payment\Methods::TRUST_PAY =>
|
612 |
+
\Genesis\API\Constants\Transaction\Types::PPRO,
|
613 |
+
);
|
614 |
+
|
615 |
+
foreach ($selected_types as $selected_type) {
|
616 |
+
if (array_key_exists($selected_type, $alias_map)) {
|
617 |
+
$transaction_type = $alias_map[$selected_type];
|
618 |
+
|
619 |
+
$processed_list[$transaction_type]['name'] = $transaction_type;
|
620 |
+
|
621 |
+
$processed_list[$transaction_type]['parameters'][] = array(
|
622 |
+
'payment_method' => $selected_type
|
623 |
+
);
|
624 |
+
} else {
|
625 |
+
$processed_list[] = $selected_type;
|
626 |
+
}
|
627 |
+
}
|
628 |
+
|
629 |
+
return $processed_list;
|
630 |
+
}
|
631 |
+
|
632 |
+
/**
|
633 |
+
* Get URL to "Redirect" block
|
634 |
+
*
|
635 |
+
* @see EMerchantPay_Genesis_CheckoutController
|
636 |
+
*
|
637 |
+
* @note In order for redirect to work, you must
|
638 |
+
* set the session variable:
|
639 |
+
*
|
640 |
+
* EmerchantPayGenesisCheckoutRedirectUrl
|
641 |
+
*
|
642 |
+
* @return mixed
|
643 |
+
*/
|
644 |
+
public function getOrderPlaceRedirectUrl()
|
645 |
+
{
|
646 |
+
return $this->getHelper()->getRedirectUrl('checkout');
|
647 |
+
}
|
648 |
+
|
649 |
+
/**
|
650 |
+
* Get the helper or return its instance
|
651 |
+
*
|
652 |
+
* @param $helper string - Name of the helper, empty for the default class helper
|
653 |
+
*
|
654 |
+
* @return EMerchantPay_Genesis_Helper_Data|mixed
|
655 |
+
*/
|
656 |
+
private function getHelper($helper = '')
|
657 |
+
{
|
658 |
+
if (empty($helper)) {
|
659 |
+
return Mage::helper('emerchantpay');
|
660 |
+
} else {
|
661 |
+
return Mage::helper($helper);
|
662 |
+
}
|
663 |
+
}
|
664 |
+
}
|
app/code/community/EMerchantPay/Genesis/Model/Direct.php
ADDED
@@ -0,0 +1,982 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* eMerchantPay Direct Payment Method
|
22 |
+
*
|
23 |
+
* This class requires the user to input
|
24 |
+
* their CC data and as such requires PCI
|
25 |
+
* compliance.
|
26 |
+
*
|
27 |
+
* @see http://magento.com/resources/pci
|
28 |
+
* @extends Mage_Payment_Model_Method_Cc
|
29 |
+
*
|
30 |
+
* @category
|
31 |
+
*/
|
32 |
+
class EMerchantPay_Genesis_Model_Direct extends Mage_Payment_Model_Method_Cc
|
33 |
+
{
|
34 |
+
// Variables
|
35 |
+
protected $_code = 'emerchantpay_direct';
|
36 |
+
|
37 |
+
protected $_formBlockType = 'emerchantpay/form_direct';
|
38 |
+
protected $_infoBlockType = 'emerchantpay/info_direct';
|
39 |
+
|
40 |
+
// Configurations
|
41 |
+
protected $_isGateway = true;
|
42 |
+
protected $_canAuthorize = true;
|
43 |
+
protected $_canCapture = true;
|
44 |
+
protected $_canCapturePartial = true;
|
45 |
+
protected $_canRefund = true;
|
46 |
+
protected $_canVoid = true;
|
47 |
+
protected $_canUseInternal = false;
|
48 |
+
protected $_canUseCheckout = true;
|
49 |
+
|
50 |
+
protected $_isInitializeNeeded = false;
|
51 |
+
|
52 |
+
protected $_canFetchTransactionInfo = true;
|
53 |
+
protected $_canUseForMultishipping = false;
|
54 |
+
protected $_canSaveCc = false;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Check if we're on a secure page and run
|
58 |
+
* the parent verification
|
59 |
+
*
|
60 |
+
* @param Mage_Sales_Model_Quote|null $quote
|
61 |
+
*
|
62 |
+
* @return bool
|
63 |
+
*/
|
64 |
+
public function isAvailable($quote = null)
|
65 |
+
{
|
66 |
+
$isSecure = (bool) Mage::app()->getStore()->isCurrentlySecure();
|
67 |
+
|
68 |
+
if (!$isSecure) {
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
|
72 |
+
return parent::isAvailable($quote);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Assign the incoming $data to internal variables
|
77 |
+
*
|
78 |
+
* @param mixed $data
|
79 |
+
* @return $this
|
80 |
+
*/
|
81 |
+
public function assignData($data)
|
82 |
+
{
|
83 |
+
if (!($data instanceof Varien_Object)) {
|
84 |
+
$data = new Varien_Object($data);
|
85 |
+
}
|
86 |
+
|
87 |
+
$info = $this->getInfoInstance();
|
88 |
+
|
89 |
+
$info->setCcOwner($data->getCcOwner())
|
90 |
+
->setCcNumber($data->getCcNumber())
|
91 |
+
->setCcCid($data->getCcCid())
|
92 |
+
->setCcExpMonth($data->getCcExpMonth())
|
93 |
+
->setCcExpYear($data->getCcExpYear())
|
94 |
+
->setCcType($data->getCcType());
|
95 |
+
|
96 |
+
return $this;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Payment action getter compatible with payment model
|
101 |
+
*
|
102 |
+
* @see Mage_Sales_Model_Order_Payment::place()
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function getConfigPaymentAction()
|
107 |
+
{
|
108 |
+
$this->getHelper()->initLibrary();
|
109 |
+
|
110 |
+
switch ($this->getConfigData('genesis_type')) {
|
111 |
+
default:
|
112 |
+
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE:
|
113 |
+
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
114 |
+
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
|
115 |
+
break;
|
116 |
+
case \Genesis\API\Constants\Transaction\Types::SALE:
|
117 |
+
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
118 |
+
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE;
|
119 |
+
break;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Authorize transaction type
|
125 |
+
*
|
126 |
+
* @param Varien_Object $payment
|
127 |
+
* @param float $amount
|
128 |
+
*
|
129 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
130 |
+
*/
|
131 |
+
public function authorize(Varien_Object $payment, $amount)
|
132 |
+
{
|
133 |
+
if ($this->is3dEnabled()) {
|
134 |
+
return $this->_authorize3d($payment, $amount);
|
135 |
+
} else {
|
136 |
+
return $this->_authorize($payment, $amount);
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Capture transaction type
|
142 |
+
*
|
143 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
144 |
+
* @param float $amount
|
145 |
+
*
|
146 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
147 |
+
*/
|
148 |
+
public function capture(Varien_Object $payment, $amount)
|
149 |
+
{
|
150 |
+
$authorize = $payment->lookupTransaction(null, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
151 |
+
|
152 |
+
if ($authorize) {
|
153 |
+
return $this->_capture($payment, $amount);
|
154 |
+
} else {
|
155 |
+
if ($this->is3dEnabled()) {
|
156 |
+
return $this->_sale3d($payment, $amount);
|
157 |
+
} else {
|
158 |
+
return $this->_sale($payment, $amount);
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Genesis Authorize Payment Method
|
165 |
+
*
|
166 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
167 |
+
* @param String $amount
|
168 |
+
*
|
169 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
170 |
+
*/
|
171 |
+
private function _authorize($payment, $amount)
|
172 |
+
{
|
173 |
+
Mage::log('Authorize transaction for order #' . $payment->getOrder()->getIncrementId());
|
174 |
+
|
175 |
+
try {
|
176 |
+
$this->getHelper()->initClient($this->getCode());
|
177 |
+
|
178 |
+
/** @var Mage_Sales_Model_Order $order */
|
179 |
+
$order = $payment->getOrder();
|
180 |
+
|
181 |
+
$billing = $order->getBillingAddress();
|
182 |
+
$shipping = $order->getShippingAddress();
|
183 |
+
|
184 |
+
$genesis = new \Genesis\Genesis('Financial\Cards\Authorize');
|
185 |
+
|
186 |
+
$genesis
|
187 |
+
->request()
|
188 |
+
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
189 |
+
->setRemoteIp($this->getHelper('core/http')->getRemoteAddr(false))
|
190 |
+
->setUsage($this->getHelper()->getItemList($order))
|
191 |
+
->setCurrency($order->getBaseCurrencyCode())
|
192 |
+
->setAmount($amount)
|
193 |
+
->setCardHolder($payment->getCcOwner())
|
194 |
+
->setCardNumber($payment->getCcNumber())
|
195 |
+
->setExpirationYear($payment->getCcExpYear())
|
196 |
+
->setExpirationMonth($payment->getCcExpMonth())
|
197 |
+
->setCvv($payment->getCcCid())
|
198 |
+
->setCustomerEmail($order->getCustomerEmail())
|
199 |
+
->setCustomerPhone($billing->getTelephone())
|
200 |
+
->setBillingFirstName($billing->getData('firstname'))
|
201 |
+
->setBillingLastName($billing->getData('lastname'))
|
202 |
+
->setBillingAddress1($billing->getStreet(1))
|
203 |
+
->setBillingAddress2($billing->getStreet(2))
|
204 |
+
->setBillingZipCode($billing->getPostcode())
|
205 |
+
->setBillingCity($billing->getCity())
|
206 |
+
->setBillingState($billing->getRegion())
|
207 |
+
->setBillingCountry($billing->getCountry())
|
208 |
+
->setShippingFirstName($shipping->getData('firstname'))
|
209 |
+
->setShippingLastName($shipping->getData('lastname'))
|
210 |
+
->setShippingAddress1($shipping->getStreet(1))
|
211 |
+
->setShippingAddress2($shipping->getStreet(2))
|
212 |
+
->setShippingZipCode($shipping->getPostcode())
|
213 |
+
->setShippingCity($shipping->getCity())
|
214 |
+
->setShippingState($shipping->getRegion())
|
215 |
+
->setShippinCountry($shipping->getCountry());
|
216 |
+
|
217 |
+
$genesis->execute();
|
218 |
+
|
219 |
+
$this->setGenesisResponse(
|
220 |
+
$genesis->response()->getResponseObject()
|
221 |
+
);
|
222 |
+
|
223 |
+
$payment
|
224 |
+
->setTransactionId(
|
225 |
+
$this->getGenesisResponse()->unique_id
|
226 |
+
)
|
227 |
+
->setIsTransactionClosed(
|
228 |
+
false
|
229 |
+
)
|
230 |
+
->setIsTransactionPending(
|
231 |
+
false
|
232 |
+
)
|
233 |
+
->setTransactionAdditionalInfo(
|
234 |
+
array(
|
235 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
236 |
+
$this->getGenesisResponse()
|
237 |
+
)
|
238 |
+
),
|
239 |
+
null
|
240 |
+
);
|
241 |
+
|
242 |
+
$payment->save();
|
243 |
+
|
244 |
+
if ($this->getGenesisResponse()->status == \Genesis\API\Constants\Transaction\States::DECLINED) {
|
245 |
+
throw new \Genesis\Exceptions\ErrorAPI(
|
246 |
+
$this->getGenesisResponse()->message
|
247 |
+
);
|
248 |
+
}
|
249 |
+
} catch (Exception $exception) {
|
250 |
+
Mage::logException($exception);
|
251 |
+
|
252 |
+
Mage::throwException(
|
253 |
+
$this->getHelper()->__($exception->getMessage())
|
254 |
+
);
|
255 |
+
}
|
256 |
+
|
257 |
+
return $this;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Genesis Authorize Payment Method with 3D-Secure
|
262 |
+
*
|
263 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
264 |
+
* @param String $amount
|
265 |
+
*
|
266 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
267 |
+
*/
|
268 |
+
private function _authorize3d($payment, $amount)
|
269 |
+
{
|
270 |
+
Mage::log('Authorize 3D-Secure transaction for order #' . $payment->getOrder()->getIncrementId());
|
271 |
+
|
272 |
+
try {
|
273 |
+
$this->getHelper()->initClient($this->getCode());
|
274 |
+
|
275 |
+
$order = $payment->getOrder();
|
276 |
+
|
277 |
+
$billing = $order->getBillingAddress();
|
278 |
+
$shipping = $order->getShippingAddress();
|
279 |
+
|
280 |
+
$genesis = new \Genesis\Genesis('Financial\Cards\Authorize3D');
|
281 |
+
|
282 |
+
$genesis
|
283 |
+
->request()
|
284 |
+
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
285 |
+
->setRemoteIp(Mage::helper('core/http')->getRemoteAddr(false))
|
286 |
+
->setUsage($this->getHelper()->getItemList($order))
|
287 |
+
->setCurrency($order->getBaseCurrencyCode())
|
288 |
+
->setAmount($amount)
|
289 |
+
->setCardHolder($payment->getCcOwner())
|
290 |
+
->setCardNumber($payment->getCcNumber())
|
291 |
+
->setExpirationYear($payment->getCcExpYear())
|
292 |
+
->setExpirationMonth($payment->getCcExpMonth())
|
293 |
+
->setCvv($payment->getCcCid())
|
294 |
+
->setCustomerEmail($order->getCustomerEmail())
|
295 |
+
->setCustomerPhone($billing->getTelephone())
|
296 |
+
->setBillingFirstName($billing->getData('firstname'))
|
297 |
+
->setBillingLastName($billing->getData('lastname'))
|
298 |
+
->setBillingAddress1($billing->getStreet(1))
|
299 |
+
->setBillingAddress2($billing->getStreet(2))
|
300 |
+
->setBillingZipCode($billing->getPostcode())
|
301 |
+
->setBillingCity($billing->getCity())
|
302 |
+
->setBillingState($billing->getRegion())
|
303 |
+
->setBillingCountry($billing->getCountry())
|
304 |
+
->setShippingFirstName($shipping->getData('firstname'))
|
305 |
+
->setShippingLastName($shipping->getData('lastname'))
|
306 |
+
->setShippingAddress1($shipping->getStreet(1))
|
307 |
+
->setShippingAddress2($shipping->getStreet(2))
|
308 |
+
->setShippingZipCode($shipping->getPostcode())
|
309 |
+
->setShippingCity($shipping->getCity())
|
310 |
+
->setShippingState($shipping->getRegion())
|
311 |
+
->setShippinCountry($shipping->getCountry())
|
312 |
+
->setNotificationUrl($this->getHelper()->getNotifyURL('direct'))
|
313 |
+
->setReturnSuccessUrl($this->getHelper()->getSuccessURL('direct'))
|
314 |
+
->setReturnFailureUrl($this->getHelper()->getFailureURL('direct'));
|
315 |
+
|
316 |
+
$genesis->execute();
|
317 |
+
|
318 |
+
$this->setGenesisResponse(
|
319 |
+
$genesis->response()->getResponseObject()
|
320 |
+
);
|
321 |
+
|
322 |
+
$payment
|
323 |
+
->setTransactionId(
|
324 |
+
$this->getGenesisResponse()->unique_id
|
325 |
+
)
|
326 |
+
->setIsTransactionClosed(false)
|
327 |
+
->setIsTransactionPending(true)
|
328 |
+
->setPreparedMessage('3D-Secure: Redirecting customer to a verification page.')
|
329 |
+
->setTransactionAdditionalInfo(
|
330 |
+
array(
|
331 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
332 |
+
$this->getGenesisResponse()
|
333 |
+
)
|
334 |
+
),
|
335 |
+
null
|
336 |
+
);
|
337 |
+
|
338 |
+
$payment->save();
|
339 |
+
|
340 |
+
if ($this->getGenesisResponse()->status == \Genesis\API\Constants\Transaction\States::DECLINED) {
|
341 |
+
throw new \Genesis\Exceptions\ErrorAPI(
|
342 |
+
$this->getGenesisResponse()->message
|
343 |
+
);
|
344 |
+
}
|
345 |
+
|
346 |
+
// Save the redirect url with our
|
347 |
+
$this->getHelper()->getCheckoutSession()->setEmerchantPayDirectRedirectUrl(
|
348 |
+
$this->getGenesisResponse()->redirect_url
|
349 |
+
);
|
350 |
+
} catch (Exception $exception) {
|
351 |
+
Mage::logException($exception);
|
352 |
+
|
353 |
+
Mage::throwException(
|
354 |
+
$this->getHelper()->__($exception->getMessage())
|
355 |
+
);
|
356 |
+
}
|
357 |
+
|
358 |
+
return $this;
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Genesis Sale (Auth/Capture) Payment Method
|
363 |
+
*
|
364 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
365 |
+
* @param String $amount
|
366 |
+
*
|
367 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
368 |
+
*/
|
369 |
+
private function _sale($payment, $amount)
|
370 |
+
{
|
371 |
+
Mage::log('Sale transaction for order #' . $payment->getOrder()->getIncrementId());
|
372 |
+
|
373 |
+
try {
|
374 |
+
$this->getHelper()->initClient($this->getCode());
|
375 |
+
|
376 |
+
$order = $payment->getOrder();
|
377 |
+
|
378 |
+
$billing = $order->getBillingAddress();
|
379 |
+
$shipping = $order->getShippingAddress();
|
380 |
+
|
381 |
+
$genesis = new \Genesis\Genesis('Financial\Cards\Sale');
|
382 |
+
|
383 |
+
$genesis
|
384 |
+
->request()
|
385 |
+
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
386 |
+
->setRemoteIp($this->getHelper('core/http')->getRemoteAddr(false))
|
387 |
+
->setUsage($this->getHelper()->getItemList($order))
|
388 |
+
->setCurrency($order->getBaseCurrencyCode())
|
389 |
+
->setAmount($amount)
|
390 |
+
->setCardHolder($payment->getCcOwner())
|
391 |
+
->setCardNumber($payment->getCcNumber())
|
392 |
+
->setExpirationYear($payment->getCcExpYear())
|
393 |
+
->setExpirationMonth($payment->getCcExpMonth())
|
394 |
+
->setCvv($payment->getCcCid())
|
395 |
+
->setCustomerEmail($order->getCustomerEmail())
|
396 |
+
->setCustomerPhone($billing->getTelephone())
|
397 |
+
->setBillingFirstName($billing->getData('firstname'))
|
398 |
+
->setBillingLastName($billing->getData('lastname'))
|
399 |
+
->setBillingAddress1($billing->getStreet(1))
|
400 |
+
->setBillingAddress2($billing->getStreet(2))
|
401 |
+
->setBillingZipCode($billing->getPostcode())
|
402 |
+
->setBillingCity($billing->getCity())
|
403 |
+
->setBillingState($billing->getRegion())
|
404 |
+
->setBillingCountry($billing->getCountry())
|
405 |
+
->setShippingFirstName($shipping->getData('firstname'))
|
406 |
+
->setShippingLastName($shipping->getData('lastname'))
|
407 |
+
->setShippingAddress1($shipping->getStreet(1))
|
408 |
+
->setShippingAddress2($shipping->getStreet(2))
|
409 |
+
->setShippingZipCode($shipping->getPostcode())
|
410 |
+
->setShippingCity($shipping->getCity())
|
411 |
+
->setShippingState($shipping->getRegion())
|
412 |
+
->setShippinCountry($shipping->getCountry());
|
413 |
+
|
414 |
+
$genesis->execute();
|
415 |
+
|
416 |
+
$this->setGenesisResponse(
|
417 |
+
$genesis->response()->getResponseObject()
|
418 |
+
);
|
419 |
+
|
420 |
+
$payment
|
421 |
+
->setTransactionId(
|
422 |
+
$this->getGenesisResponse()->unique_id
|
423 |
+
)
|
424 |
+
->setCurrencyCode(
|
425 |
+
$this->getGenesisResponse()->currency
|
426 |
+
)
|
427 |
+
->setIsTransactionClosed(false)
|
428 |
+
->setIsTransactionPending(false)
|
429 |
+
->setTransactionAdditionalInfo(
|
430 |
+
array(
|
431 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
432 |
+
$this->getGenesisResponse()
|
433 |
+
)
|
434 |
+
),
|
435 |
+
null
|
436 |
+
);
|
437 |
+
|
438 |
+
$payment->save();
|
439 |
+
|
440 |
+
if ($this->getGenesisResponse()->status == \Genesis\API\Constants\Transaction\States::DECLINED) {
|
441 |
+
throw new \Genesis\Exceptions\ErrorAPI(
|
442 |
+
$this->getGenesisResponse()->message
|
443 |
+
);
|
444 |
+
}
|
445 |
+
|
446 |
+
} catch (Exception $exception) {
|
447 |
+
Mage::logException($exception);
|
448 |
+
|
449 |
+
Mage::throwException(
|
450 |
+
$exception->getMessage()
|
451 |
+
);
|
452 |
+
}
|
453 |
+
|
454 |
+
return $this;
|
455 |
+
}
|
456 |
+
|
457 |
+
/**
|
458 |
+
* Genesis Sale (Auth/Capture) Payment Method with 3D-Secure
|
459 |
+
*
|
460 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
461 |
+
* @param String $amount
|
462 |
+
*
|
463 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
464 |
+
*/
|
465 |
+
private function _sale3d($payment, $amount)
|
466 |
+
{
|
467 |
+
Mage::log('Sale 3D-Secure transaction for order #' . $payment->getOrder()->getIncrementId());
|
468 |
+
|
469 |
+
try {
|
470 |
+
$this->getHelper()->initClient($this->getCode());
|
471 |
+
|
472 |
+
$order = $payment->getOrder();
|
473 |
+
|
474 |
+
$billing = $order->getBillingAddress();
|
475 |
+
$shipping = $order->getShippingAddress();
|
476 |
+
|
477 |
+
$genesis = new \Genesis\Genesis('Financial\Cards\Sale3D');
|
478 |
+
|
479 |
+
$genesis
|
480 |
+
->request()
|
481 |
+
->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))
|
482 |
+
->setRemoteIp($this->getHelper('core/http')->getRemoteAddr(false))
|
483 |
+
->setUsage($this->getHelper()->getItemList($order))
|
484 |
+
->setCurrency($order->getBaseCurrencyCode())
|
485 |
+
->setAmount($amount)
|
486 |
+
->setCardHolder($payment->getCcOwner())
|
487 |
+
->setCardNumber($payment->getCcNumber())
|
488 |
+
->setExpirationYear($payment->getCcExpYear())
|
489 |
+
->setExpirationMonth($payment->getCcExpMonth())
|
490 |
+
->setCvv($payment->getCcCid())
|
491 |
+
->setCustomerEmail($order->getCustomerEmail())
|
492 |
+
->setCustomerPhone($billing->getTelephone())
|
493 |
+
->setBillingFirstName($billing->getData('firstname'))
|
494 |
+
->setBillingLastName($billing->getData('lastname'))
|
495 |
+
->setBillingAddress1($billing->getStreet(1))
|
496 |
+
->setBillingAddress2($billing->getStreet(2))
|
497 |
+
->setBillingZipCode($billing->getPostcode())
|
498 |
+
->setBillingCity($billing->getCity())
|
499 |
+
->setBillingState($billing->getRegion())
|
500 |
+
->setBillingCountry($billing->getCountry())
|
501 |
+
->setShippingFirstName($shipping->getData('firstname'))
|
502 |
+
->setShippingLastName($shipping->getData('lastname'))
|
503 |
+
->setShippingAddress1($shipping->getStreet(1))
|
504 |
+
->setShippingAddress2($shipping->getStreet(2))
|
505 |
+
->setShippingZipCode($shipping->getPostcode())
|
506 |
+
->setShippingCity($shipping->getCity())
|
507 |
+
->setShippingState($shipping->getRegion())
|
508 |
+
->setShippinCountry($shipping->getCountry())
|
509 |
+
->setNotificationUrl($this->getHelper()->getNotifyURL('direct'))
|
510 |
+
->setReturnSuccessUrl($this->getHelper()->getSuccessURL('direct'))
|
511 |
+
->setReturnFailureUrl($this->getHelper()->getFailureURL('direct'));
|
512 |
+
|
513 |
+
$genesis->execute();
|
514 |
+
|
515 |
+
$this->setGenesisResponse(
|
516 |
+
$genesis->response()->getResponseObject()
|
517 |
+
);
|
518 |
+
|
519 |
+
// Hold transaction creation
|
520 |
+
$payment
|
521 |
+
->setTransactionId(
|
522 |
+
$this->getGenesisResponse()->unique_id
|
523 |
+
)
|
524 |
+
->setIsTransactionClosed(false)
|
525 |
+
->setIsTransactionPending(true)
|
526 |
+
->setPreparedMessage(
|
527 |
+
$this->getHelper()->__('3D-Secure: Redirecting customer to a verification page.')
|
528 |
+
)
|
529 |
+
->setTransactionAdditionalInfo(
|
530 |
+
array(
|
531 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
532 |
+
$this->getGenesisResponse()
|
533 |
+
)
|
534 |
+
),
|
535 |
+
null
|
536 |
+
);
|
537 |
+
|
538 |
+
$payment->save();
|
539 |
+
|
540 |
+
if ($this->getGenesisResponse()->status == \Genesis\API\Constants\Transaction\States::DECLINED) {
|
541 |
+
throw new \Genesis\Exceptions\ErrorAPI(
|
542 |
+
$this->getGenesisResponse()->message
|
543 |
+
);
|
544 |
+
}
|
545 |
+
|
546 |
+
// Save the redirect url with our
|
547 |
+
$this->getHelper()->getCheckoutSession()->setEmerchantPayDirectRedirectUrl(
|
548 |
+
$this->getGenesisResponse()->redirect_url
|
549 |
+
);
|
550 |
+
|
551 |
+
} catch (Exception $exception) {
|
552 |
+
Mage::logException($exception);
|
553 |
+
|
554 |
+
Mage::throwException(
|
555 |
+
$this->getHelper()->__($exception->getMessage())
|
556 |
+
);
|
557 |
+
}
|
558 |
+
|
559 |
+
return $this;
|
560 |
+
}
|
561 |
+
|
562 |
+
/**
|
563 |
+
* Capture a successful auth transaction
|
564 |
+
*
|
565 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
566 |
+
* @param float $amount
|
567 |
+
*
|
568 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
569 |
+
*
|
570 |
+
* @throws Mage_Core_Exception
|
571 |
+
*/
|
572 |
+
private function _capture($payment, $amount)
|
573 |
+
{
|
574 |
+
Mage::log('Capture transaction for order #' . $payment->getOrder()->getIncrementId());
|
575 |
+
|
576 |
+
try {
|
577 |
+
$this->getHelper()->initClient($this->getCode());
|
578 |
+
|
579 |
+
$authorize = $payment->lookupTransaction(null, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
580 |
+
|
581 |
+
$reference_id = $authorize->getTxnId();
|
582 |
+
|
583 |
+
$genesis = new \Genesis\Genesis('Financial\Capture');
|
584 |
+
|
585 |
+
$genesis
|
586 |
+
->request()
|
587 |
+
->setTransactionId(
|
588 |
+
$this->getHelper()->genTransactionId(
|
589 |
+
$payment->getOrder()->getIncrementId()
|
590 |
+
)
|
591 |
+
)
|
592 |
+
->setRemoteIp(
|
593 |
+
$this->getHelper('core/http')->getRemoteAddr(false)
|
594 |
+
)
|
595 |
+
->setReferenceId(
|
596 |
+
$reference_id
|
597 |
+
)
|
598 |
+
->setCurrency(
|
599 |
+
$payment->getOrder()->getBaseCurrencyCode()
|
600 |
+
)
|
601 |
+
->setAmount(
|
602 |
+
$amount
|
603 |
+
);
|
604 |
+
|
605 |
+
$genesis->execute();
|
606 |
+
|
607 |
+
$payment
|
608 |
+
->setTransactionId(
|
609 |
+
$genesis->response()->getResponseObject()->unique_id
|
610 |
+
)
|
611 |
+
->setParentTransactionId(
|
612 |
+
$reference_id
|
613 |
+
)
|
614 |
+
->setIsTransactionClosed(
|
615 |
+
false
|
616 |
+
)
|
617 |
+
->setShouldCloseParentTransaction(
|
618 |
+
true
|
619 |
+
)
|
620 |
+
->resetTransactionAdditionalInfo(
|
621 |
+
|
622 |
+
)
|
623 |
+
->setTransactionAdditionalInfo(
|
624 |
+
array(
|
625 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
626 |
+
$genesis->response()->getResponseObject()
|
627 |
+
)
|
628 |
+
),
|
629 |
+
null
|
630 |
+
);
|
631 |
+
|
632 |
+
$payment->save();
|
633 |
+
} catch (Exception $exception) {
|
634 |
+
Mage::logException($exception);
|
635 |
+
|
636 |
+
Mage::throwException(
|
637 |
+
$this->getHelper()->__($exception->getMessage())
|
638 |
+
);
|
639 |
+
}
|
640 |
+
|
641 |
+
return $this;
|
642 |
+
}
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Refund the last successful transaction
|
646 |
+
*
|
647 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
648 |
+
* @param float $amount
|
649 |
+
*
|
650 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
651 |
+
*/
|
652 |
+
public function refund(Varien_Object $payment, $amount)
|
653 |
+
{
|
654 |
+
Mage::log('Refund transaction for order #' . $payment->getOrder()->getIncrementId());
|
655 |
+
|
656 |
+
try {
|
657 |
+
$this->getHelper()->initClient($this->getCode());
|
658 |
+
|
659 |
+
$capture = $payment->lookupTransaction(null, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
|
660 |
+
|
661 |
+
$reference_id = $capture->getTxnId();
|
662 |
+
|
663 |
+
$genesis = new \Genesis\Genesis('Financial\Refund');
|
664 |
+
|
665 |
+
$genesis
|
666 |
+
->request()
|
667 |
+
->setTransactionId(
|
668 |
+
$this->getHelper()->genTransactionId(
|
669 |
+
$payment->getOrder()->getIncrementId()
|
670 |
+
)
|
671 |
+
)
|
672 |
+
->setRemoteIp(
|
673 |
+
$this->getHelper('core/http')->getRemoteAddr(false)
|
674 |
+
)
|
675 |
+
->setReferenceId(
|
676 |
+
$reference_id
|
677 |
+
)
|
678 |
+
->setCurrency(
|
679 |
+
$payment->getOrder()->getBaseCurrencyCode()
|
680 |
+
)
|
681 |
+
->setAmount($amount);
|
682 |
+
|
683 |
+
$genesis->execute();
|
684 |
+
|
685 |
+
$payment
|
686 |
+
->setTransactionId(
|
687 |
+
$genesis->response()->getResponseObject()->unique_id
|
688 |
+
)
|
689 |
+
->setParentTransactionId(
|
690 |
+
$reference_id
|
691 |
+
)
|
692 |
+
->setShouldCloseParentTransaction(
|
693 |
+
true
|
694 |
+
)
|
695 |
+
->setTransactionAdditionalInfo(
|
696 |
+
array(
|
697 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
698 |
+
$genesis->response()->getResponseObject()
|
699 |
+
)
|
700 |
+
),
|
701 |
+
null
|
702 |
+
);
|
703 |
+
|
704 |
+
$payment->save();
|
705 |
+
} catch (Exception $exception) {
|
706 |
+
Mage::logException($exception);
|
707 |
+
|
708 |
+
Mage::throwException(
|
709 |
+
$exception->getMessage()
|
710 |
+
);
|
711 |
+
}
|
712 |
+
|
713 |
+
return $this;
|
714 |
+
}
|
715 |
+
|
716 |
+
/**
|
717 |
+
* Void the last successful transaction
|
718 |
+
*
|
719 |
+
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
|
720 |
+
*
|
721 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
722 |
+
*/
|
723 |
+
public function void(Varien_Object $payment)
|
724 |
+
{
|
725 |
+
Mage::log('Void transaction for order #' . $payment->getOrder()->getIncrementId());
|
726 |
+
|
727 |
+
try {
|
728 |
+
$this->getHelper()->initClient($this->getCode());
|
729 |
+
|
730 |
+
$transactions = $this->getHelper()->getTransactionFromPaymentObject($payment, array(
|
731 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,
|
732 |
+
Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE
|
733 |
+
));
|
734 |
+
|
735 |
+
$reference_id = $transactions ? reset($transactions)->getTxnId() : null;
|
736 |
+
|
737 |
+
$genesis = new \Genesis\Genesis('Financial\Void');
|
738 |
+
|
739 |
+
$genesis
|
740 |
+
->request()
|
741 |
+
->setTransactionId(
|
742 |
+
$this->getHelper()->genTransactionId($payment->getOrder()->getIncrementId())
|
743 |
+
)
|
744 |
+
->setRemoteIp(
|
745 |
+
$this->getHelper('core/http')->getRemoteAddr(false)
|
746 |
+
)
|
747 |
+
->setReferenceId(
|
748 |
+
$reference_id
|
749 |
+
);
|
750 |
+
|
751 |
+
$genesis->execute();
|
752 |
+
|
753 |
+
$payment
|
754 |
+
->setTransactionId(
|
755 |
+
$genesis->response()->getResponseObject()->unique_id
|
756 |
+
)
|
757 |
+
->setParentTransactionId(
|
758 |
+
$reference_id
|
759 |
+
)
|
760 |
+
->setShouldCloseParentTransaction(
|
761 |
+
true
|
762 |
+
)
|
763 |
+
->setTransactionAdditionalInfo(
|
764 |
+
array(
|
765 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
766 |
+
$genesis->response()->getResponseObject()
|
767 |
+
)
|
768 |
+
),
|
769 |
+
null
|
770 |
+
);
|
771 |
+
|
772 |
+
$payment->save();
|
773 |
+
} catch (Exception $exception) {
|
774 |
+
Mage::logException($exception);
|
775 |
+
|
776 |
+
Mage::throwException(
|
777 |
+
$exception->getMessage()
|
778 |
+
);
|
779 |
+
}
|
780 |
+
|
781 |
+
return $this;
|
782 |
+
}
|
783 |
+
|
784 |
+
/**
|
785 |
+
* Cancel order
|
786 |
+
*
|
787 |
+
* @param Varien_Object $payment
|
788 |
+
*
|
789 |
+
* @return EMerchantPay_Genesis_Model_Direct
|
790 |
+
*/
|
791 |
+
public function cancel(Varien_Object $payment)
|
792 |
+
{
|
793 |
+
return $this->void($payment);
|
794 |
+
}
|
795 |
+
|
796 |
+
/**
|
797 |
+
* Fetch transaction details info
|
798 |
+
*
|
799 |
+
* @param Mage_Payment_Model_Info $payment
|
800 |
+
* @param string $transactionId
|
801 |
+
*
|
802 |
+
* @return array
|
803 |
+
*/
|
804 |
+
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
|
805 |
+
{
|
806 |
+
$reconcile = $this->reconcile($transactionId);
|
807 |
+
|
808 |
+
// Remove the current details
|
809 |
+
$payment->unsAdditionalInformation(
|
810 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
|
811 |
+
);
|
812 |
+
|
813 |
+
// Set the default/updated transaction details
|
814 |
+
$payment->setAdditionalInformation(
|
815 |
+
array(
|
816 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse(
|
817 |
+
$reconcile
|
818 |
+
)
|
819 |
+
),
|
820 |
+
null
|
821 |
+
);
|
822 |
+
|
823 |
+
$payment->save();
|
824 |
+
|
825 |
+
return $payment->getAdditionalInformation(
|
826 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
|
827 |
+
);
|
828 |
+
}
|
829 |
+
|
830 |
+
/**
|
831 |
+
* Reconcile (Get Transaction) from Genesis Gateway
|
832 |
+
*
|
833 |
+
* @see EMerchantPay_Genesis_DirectController::notifyAction
|
834 |
+
*
|
835 |
+
* @param $unique_id
|
836 |
+
* @return mixed
|
837 |
+
*/
|
838 |
+
public function reconcile($unique_id)
|
839 |
+
{
|
840 |
+
try {
|
841 |
+
$this->getHelper()->initClient($this->getCode());
|
842 |
+
|
843 |
+
$genesis = new \Genesis\Genesis('NonFinancial\Reconcile\Transaction');
|
844 |
+
|
845 |
+
$genesis->request()->setUniqueId($unique_id);
|
846 |
+
|
847 |
+
$genesis->execute();
|
848 |
+
|
849 |
+
return $genesis->response()->getResponseObject();
|
850 |
+
} catch (Exception $exception) {
|
851 |
+
Mage::logException($exception);
|
852 |
+
|
853 |
+
Mage::throwException(
|
854 |
+
$this->getHelper()->__($exception->getMessage())
|
855 |
+
);
|
856 |
+
}
|
857 |
+
|
858 |
+
return false;
|
859 |
+
}
|
860 |
+
|
861 |
+
/**
|
862 |
+
* Handle an incoming Genesis notification
|
863 |
+
*
|
864 |
+
* @param stdClass $reconcile
|
865 |
+
* @return bool
|
866 |
+
*/
|
867 |
+
public function processNotification($reconcile)
|
868 |
+
{
|
869 |
+
try {
|
870 |
+
$this->getHelper()->initClient($this->getCode());
|
871 |
+
|
872 |
+
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
|
873 |
+
$transaction = Mage::getModel('sales/order_payment_transaction')->load($reconcile->unique_id, 'txn_id');
|
874 |
+
|
875 |
+
$order = $transaction->getOrder();
|
876 |
+
|
877 |
+
if ($order) {
|
878 |
+
$payment = $order->getPayment();
|
879 |
+
|
880 |
+
$transaction->setOrderPaymentObject($payment);
|
881 |
+
|
882 |
+
$transaction->unsAdditionalInformation(
|
883 |
+
Mage_Sales_Model_Order_Payment_transaction::RAW_DETAILS
|
884 |
+
);
|
885 |
+
|
886 |
+
$transaction->setAdditionalInformation(
|
887 |
+
Mage_Sales_Model_Order_Payment_transaction::RAW_DETAILS,
|
888 |
+
$this->getHelper()->getArrayFromGatewayResponse(
|
889 |
+
$reconcile
|
890 |
+
)
|
891 |
+
);
|
892 |
+
|
893 |
+
if ($reconcile->status == \Genesis\API\Constants\Transaction\States::APPROVED) {
|
894 |
+
$transaction->setIsClosed(false);
|
895 |
+
}
|
896 |
+
else {
|
897 |
+
$transaction->setIsClosed(true);
|
898 |
+
}
|
899 |
+
|
900 |
+
$transaction->save();
|
901 |
+
|
902 |
+
switch ($reconcile->transaction_type) {
|
903 |
+
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE:
|
904 |
+
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
905 |
+
$payment->registerAuthorizationNotification($reconcile->amount, true);
|
906 |
+
break;
|
907 |
+
case \Genesis\API\Constants\Transaction\Types::SALE:
|
908 |
+
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
909 |
+
$payment->setShouldCloseParentTransaction(true);
|
910 |
+
$payment->registerCaptureNotification($reconcile->amount, true);
|
911 |
+
break;
|
912 |
+
default:
|
913 |
+
break;
|
914 |
+
}
|
915 |
+
|
916 |
+
$payment->save();
|
917 |
+
|
918 |
+
$this->getHelper()->setOrderState($order, $reconcile->status, $reconcile->message);
|
919 |
+
}
|
920 |
+
} catch (Exception $exception) {
|
921 |
+
Mage::logException($exception);
|
922 |
+
}
|
923 |
+
|
924 |
+
return $this;
|
925 |
+
}
|
926 |
+
|
927 |
+
/**
|
928 |
+
* Get URL to "Redirect" block
|
929 |
+
*
|
930 |
+
* @see EMerchantPay_Genesis_DirectController
|
931 |
+
*
|
932 |
+
* @note In order for redirect to work, you must
|
933 |
+
* set the session variable "EmerchantPayGenesisDirectRedirectUrl"
|
934 |
+
*
|
935 |
+
* @return mixed
|
936 |
+
*/
|
937 |
+
public function getOrderPlaceRedirectUrl()
|
938 |
+
{
|
939 |
+
if ($this->is3dEnabled()) {
|
940 |
+
return $this->getHelper()->getRedirectUrl('direct');
|
941 |
+
}
|
942 |
+
|
943 |
+
return false;
|
944 |
+
}
|
945 |
+
|
946 |
+
/**
|
947 |
+
* Check whether we're doing 3D transactions,
|
948 |
+
* based on the module configuration
|
949 |
+
*
|
950 |
+
* @return bool
|
951 |
+
*/
|
952 |
+
private function is3dEnabled()
|
953 |
+
{
|
954 |
+
$this->getHelper()->initLibrary();
|
955 |
+
|
956 |
+
switch ($this->getConfigData('genesis_type')) {
|
957 |
+
default:
|
958 |
+
return false;
|
959 |
+
break;
|
960 |
+
case \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D:
|
961 |
+
case \Genesis\API\Constants\Transaction\Types::SALE_3D:
|
962 |
+
return true;
|
963 |
+
break;
|
964 |
+
}
|
965 |
+
}
|
966 |
+
|
967 |
+
/**
|
968 |
+
* Get the helper or return its instance
|
969 |
+
*
|
970 |
+
* @param $helper string - Name of the helper, empty for the default class helper
|
971 |
+
*
|
972 |
+
* @return EMerchantPay_Genesis_Helper_Data|mixed
|
973 |
+
*/
|
974 |
+
private function getHelper($helper = '')
|
975 |
+
{
|
976 |
+
if (empty($helper)) {
|
977 |
+
return Mage::helper('emerchantpay');
|
978 |
+
} else {
|
979 |
+
return Mage::helper($helper);
|
980 |
+
}
|
981 |
+
}
|
982 |
+
}
|
app/code/community/EMerchantPay/Genesis/Observer/GenesisAutoLoader.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2016 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2016 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_Observer_GenesisAutoLoader
|
22 |
+
*
|
23 |
+
* Handler for event "emerchantpay_genesis_init_library"
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_Observer_GenesisAutoLoader
|
26 |
+
{
|
27 |
+
public function addAutoLoad($observer)
|
28 |
+
{
|
29 |
+
$event = $observer->getEvent();
|
30 |
+
$genesisAutoLoadParams = $event->getGenesisAutoLoadParams();
|
31 |
+
|
32 |
+
$mustCheckGenesisLibVersion = $genesisAutoLoadParams->getCheckGenesisLibVersion() == '1';
|
33 |
+
|
34 |
+
// Mitigate PHP Bug #52339, as Magento already registers their AutoLoader
|
35 |
+
if (!class_exists('\Genesis\Genesis', false)) {
|
36 |
+
$vendorDir = $genesisAutoLoadParams->getMagentoRoot() . DS . 'vendor';
|
37 |
+
$genesisGatewayVendorDir = $vendorDir . DS . $genesisAutoLoadParams->getGenesisComposerDir();
|
38 |
+
$vendorAutoload = $vendorDir . DS . 'autoload.php';
|
39 |
+
|
40 |
+
if (file_exists($vendorAutoload) && file_exists($genesisGatewayVendorDir))
|
41 |
+
include $vendorAutoload;
|
42 |
+
|
43 |
+
if (class_exists('Genesis\Genesis') && $mustCheckGenesisLibVersion)
|
44 |
+
$this->checkGenesisLibVersion(
|
45 |
+
$genesisAutoLoadParams->getRequiredGenesisLibVersion()
|
46 |
+
);
|
47 |
+
|
48 |
+
if (!class_exists('Genesis\Genesis')) {
|
49 |
+
$integratedGenesisLibAutoLoader = $genesisAutoLoadParams->getIntegratedGenesisLibAutoLoader();
|
50 |
+
if (file_exists($integratedGenesisLibAutoLoader))
|
51 |
+
include $integratedGenesisLibAutoLoader;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
elseif ($mustCheckGenesisLibVersion) {
|
55 |
+
$this->checkGenesisLibVersion(
|
56 |
+
$genesisAutoLoadParams->getRequiredGenesisLibVersion()
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
private function checkGenesisLibVersion($requiredVersion) {
|
64 |
+
$params = explode(' ', $requiredVersion);
|
65 |
+
$operator = $params[0];
|
66 |
+
$version = $params[1];
|
67 |
+
|
68 |
+
if (class_exists('\Genesis\Config') && !version_compare(\Genesis\Config::getVersion(), $version, $operator)) {
|
69 |
+
$currentGenesisVersion = \Genesis\Config::getVersion();
|
70 |
+
Mage::throwException(sprintf("Incompatible GenesisPHP Lib Version (Found %s; Required %s %s)", $currentGenesisVersion, $operator, $version));
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
}
|
app/code/community/EMerchantPay/Genesis/controllers/CheckoutController.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_CheckoutController
|
22 |
+
*
|
23 |
+
* Front-end controller for Checkout method
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_CheckoutController extends Mage_Core_Controller_Front_Action
|
26 |
+
{
|
27 |
+
/** @var EMerchantPay_Genesis_Helper_Data $helper */
|
28 |
+
private $helper;
|
29 |
+
|
30 |
+
/** @var EMerchantPay_Genesis_Model_Checkout $checkout */
|
31 |
+
private $checkout;
|
32 |
+
|
33 |
+
protected function _construct()
|
34 |
+
{
|
35 |
+
$this->helper = Mage::helper('emerchantpay');
|
36 |
+
|
37 |
+
$this->checkout = Mage::getModel('emerchantpay/checkout');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Process an incoming Genesis Notification
|
42 |
+
* If it appears valid, do a reconcile and
|
43 |
+
* use the reconcile data to save details
|
44 |
+
* about the transaction
|
45 |
+
*
|
46 |
+
* @see Genesis_API_Documentation \ notification_url
|
47 |
+
*
|
48 |
+
* @return void
|
49 |
+
*/
|
50 |
+
public function notifyAction()
|
51 |
+
{
|
52 |
+
// Notifications are only POST, deny everything else
|
53 |
+
if (!$this->getRequest()->isPost()) {
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
try {
|
58 |
+
$this->helper->initClient($this->checkout->getCode());
|
59 |
+
|
60 |
+
$notification = new \Genesis\API\Notification(
|
61 |
+
$this->getRequest()->getPost()
|
62 |
+
);
|
63 |
+
|
64 |
+
if ($notification->isAuthentic()) {
|
65 |
+
$notification->initReconciliation();
|
66 |
+
|
67 |
+
$reconcile = $notification->getReconciliationObject();
|
68 |
+
|
69 |
+
if (isset($reconcile->unique_id)) {
|
70 |
+
$this->checkout->processNotification($reconcile);
|
71 |
+
|
72 |
+
$this->getResponse()->setHeader('Content-type', 'application/xml');
|
73 |
+
|
74 |
+
$this->getResponse()->setBody(
|
75 |
+
$notification->generateResponse()
|
76 |
+
);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
} catch (Exception $exception) {
|
80 |
+
Mage::logException($exception);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* When a customer has to be redirected, show
|
86 |
+
* a "transition" page where you notify them,
|
87 |
+
* that they will be redirected to a new website.
|
88 |
+
*
|
89 |
+
* @see Genesis_API_Documentation \ notification_url
|
90 |
+
*
|
91 |
+
* @return void
|
92 |
+
*/
|
93 |
+
public function redirectAction()
|
94 |
+
{
|
95 |
+
$this->helper->redirectIfNotLoggedIn();
|
96 |
+
|
97 |
+
$this->getResponse()->setBody(
|
98 |
+
$this->getLayout()->createBlock('emerchantpay/redirect_checkout')->toHtml()
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Customer landing page for successful payment
|
104 |
+
*
|
105 |
+
* @see Genesis_API_Documentation \ return_success_url
|
106 |
+
*
|
107 |
+
* @return void
|
108 |
+
*/
|
109 |
+
public function successAction()
|
110 |
+
{
|
111 |
+
$this->helper->redirectIfNotLoggedIn();
|
112 |
+
|
113 |
+
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Customer landing page for unsuccessful payment
|
118 |
+
*
|
119 |
+
* @see Genesis_API_Documentation \ return_failure_url
|
120 |
+
*
|
121 |
+
* @return void
|
122 |
+
*/
|
123 |
+
public function failureAction()
|
124 |
+
{
|
125 |
+
$this->helper->redirectIfNotLoggedIn();
|
126 |
+
|
127 |
+
$this->helper->restoreQuote();
|
128 |
+
|
129 |
+
$this->helper->getCheckoutSession()->addError(
|
130 |
+
$this->helper->__('We were unable to process your payment! Please check your input or try again later.')
|
131 |
+
);
|
132 |
+
|
133 |
+
$this->_redirect('checkout/cart', array('_secure' => true));
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Customer landing page for cancelled payment
|
138 |
+
*
|
139 |
+
* @return void
|
140 |
+
*/
|
141 |
+
public function cancelAction()
|
142 |
+
{
|
143 |
+
$this->helper->redirectIfNotLoggedIn();
|
144 |
+
|
145 |
+
$this->helper->restoreQuote($shouldCancel = true);
|
146 |
+
|
147 |
+
$this->helper->getCheckoutSession()->addSuccess(
|
148 |
+
$this->helper->__('Your payment session has been cancelled successfully!')
|
149 |
+
);
|
150 |
+
|
151 |
+
$this->_redirect('checkout/cart', array('_secure' => true));
|
152 |
+
}
|
153 |
+
}
|
app/code/community/EMerchantPay/Genesis/controllers/DirectController.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class EMerchantPay_Genesis_DirectController
|
22 |
+
*
|
23 |
+
* Front-end method for Direct method
|
24 |
+
*/
|
25 |
+
class EMerchantPay_Genesis_DirectController extends Mage_Core_Controller_Front_Action
|
26 |
+
{
|
27 |
+
/** @var EMerchantPay_Genesis_Helper_Data $helper */
|
28 |
+
private $helper;
|
29 |
+
|
30 |
+
/** @var EMerchantPay_Genesis_Model_Direct $direct */
|
31 |
+
private $direct;
|
32 |
+
|
33 |
+
protected function _construct()
|
34 |
+
{
|
35 |
+
$this->helper = Mage::helper('emerchantpay');
|
36 |
+
|
37 |
+
$this->direct = Mage::getModel('emerchantpay/direct');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Process an incoming Genesis Notification
|
42 |
+
* If it appears valid, do a reconcile and
|
43 |
+
* use the reconcile data to save details
|
44 |
+
* about the transaction
|
45 |
+
*
|
46 |
+
* @see Genesis_API_Documentation \ notification_url
|
47 |
+
*
|
48 |
+
* @return void
|
49 |
+
*/
|
50 |
+
public function notifyAction()
|
51 |
+
{
|
52 |
+
// Notifications are only POST, deny everything else
|
53 |
+
if (!$this->getRequest()->isPost()) {
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
try {
|
58 |
+
$this->helper->initClient($this->direct->getCode());
|
59 |
+
|
60 |
+
$notification = new \Genesis\API\Notification(
|
61 |
+
$this->getRequest()->getPost()
|
62 |
+
);
|
63 |
+
|
64 |
+
if ($notification->isAuthentic()) {
|
65 |
+
$notification->initReconciliation();
|
66 |
+
|
67 |
+
$reconcile = $notification->getReconciliationObject();
|
68 |
+
|
69 |
+
if (isset($reconcile->unique_id)) {
|
70 |
+
$this->direct->processNotification($reconcile);
|
71 |
+
|
72 |
+
$this->getResponse()->setHeader('Content-type', 'application/xml');
|
73 |
+
|
74 |
+
$this->getResponse()->setBody(
|
75 |
+
$notification->generateResponse()
|
76 |
+
);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
} catch (Exception $exception) {
|
80 |
+
Mage::logException($exception);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* When a customer has to be redirected, show
|
86 |
+
* a "transition" page where you notify them,
|
87 |
+
* that they will be redirected to a new website.
|
88 |
+
*
|
89 |
+
* @return void
|
90 |
+
*/
|
91 |
+
public function redirectAction()
|
92 |
+
{
|
93 |
+
$this->helper->redirectIfNotLoggedIn();
|
94 |
+
|
95 |
+
$this->getResponse()->setBody(
|
96 |
+
$this->getLayout()->createBlock('emerchantpay/redirect_direct')->toHtml()
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Customer landing page for successful payment
|
102 |
+
*
|
103 |
+
* @see Genesis_API_Documentation \ return_success_url
|
104 |
+
*
|
105 |
+
* @return void
|
106 |
+
*/
|
107 |
+
public function successAction()
|
108 |
+
{
|
109 |
+
$this->helper->redirectIfNotLoggedIn();
|
110 |
+
|
111 |
+
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Customer landing page for unsuccessful payment
|
116 |
+
*
|
117 |
+
* @see Genesis_API_Documentation \ return_failure_url
|
118 |
+
*
|
119 |
+
* @return void
|
120 |
+
*/
|
121 |
+
public function failureAction()
|
122 |
+
{
|
123 |
+
$this->helper->redirectIfNotLoggedIn();
|
124 |
+
|
125 |
+
$this->helper->restoreQuote();
|
126 |
+
|
127 |
+
$this->helper->getCheckoutSession()->addError(
|
128 |
+
$this->helper->__('We were unable to process your payment! Please check your input or try again later.')
|
129 |
+
);
|
130 |
+
|
131 |
+
$this->_redirect('checkout/cart', array('_secure' => true));
|
132 |
+
}
|
133 |
+
}
|
app/code/community/EMerchantPay/Genesis/etc/config.xml
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or
|
6 |
+
modify it under the terms of the GNU General Public License
|
7 |
+
as published by the Free Software Foundation; either version 2
|
8 |
+
of the License, or (at your option) any later version.
|
9 |
+
|
10 |
+
This program is distributed in the hope that it will be useful,
|
11 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
GNU General Public License for more details.
|
14 |
+
|
15 |
+
@author eMerchantPay
|
16 |
+
@copyright 2015 eMerchantPay Ltd.
|
17 |
+
@license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<modules>
|
21 |
+
<EMerchantPay_Genesis>
|
22 |
+
<version>1.2.5</version>
|
23 |
+
</EMerchantPay_Genesis>
|
24 |
+
</modules>
|
25 |
+
|
26 |
+
<global>
|
27 |
+
<blocks>
|
28 |
+
<emerchantpay>
|
29 |
+
<class>EMerchantPay_Genesis_Block</class>
|
30 |
+
</emerchantpay>
|
31 |
+
</blocks>
|
32 |
+
|
33 |
+
<models>
|
34 |
+
<emerchantpay>
|
35 |
+
<class>EMerchantPay_Genesis_Model</class>
|
36 |
+
</emerchantpay>
|
37 |
+
</models>
|
38 |
+
|
39 |
+
<helpers>
|
40 |
+
<emerchantpay>
|
41 |
+
<class>EMerchantPay_Genesis_Helper</class>
|
42 |
+
</emerchantpay>
|
43 |
+
</helpers>
|
44 |
+
|
45 |
+
<payment>
|
46 |
+
<groups>
|
47 |
+
<emerchantpay>eMerchantPay</emerchantpay>
|
48 |
+
</groups>
|
49 |
+
</payment>
|
50 |
+
|
51 |
+
<events>
|
52 |
+
<emerchantpay_genesis_init_library>
|
53 |
+
<observers>
|
54 |
+
<EMerchantPay_Genesis>
|
55 |
+
<class>EMerchantPay_Genesis_Observer_GenesisAutoLoader</class>
|
56 |
+
<method>addAutoLoad</method>
|
57 |
+
</EMerchantPay_Genesis>
|
58 |
+
</observers>
|
59 |
+
</emerchantpay_genesis_init_library>
|
60 |
+
</events>
|
61 |
+
|
62 |
+
</global>
|
63 |
+
|
64 |
+
<frontend>
|
65 |
+
<routers>
|
66 |
+
<emerchantpay>
|
67 |
+
<use>standard</use>
|
68 |
+
<args>
|
69 |
+
<module>EMerchantPay_Genesis</module>
|
70 |
+
<frontName>emerchantpay</frontName>
|
71 |
+
</args>
|
72 |
+
</emerchantpay>
|
73 |
+
</routers>
|
74 |
+
<secure_url>
|
75 |
+
<emerchantpay>/emerchantpay/</emerchantpay>
|
76 |
+
</secure_url>
|
77 |
+
<translate>
|
78 |
+
<modules>
|
79 |
+
<EMerchantPay_Genesis>
|
80 |
+
<files>
|
81 |
+
<default>EMerchantPay_Genesis.csv</default>
|
82 |
+
</files>
|
83 |
+
</EMerchantPay_Genesis>
|
84 |
+
</modules>
|
85 |
+
</translate>
|
86 |
+
</frontend>
|
87 |
+
|
88 |
+
<adminhtml>
|
89 |
+
<translate>
|
90 |
+
<modules>
|
91 |
+
<EMerchantPay_Genesis>
|
92 |
+
<files>
|
93 |
+
<default>EMerchantPay_Genesis.csv</default>
|
94 |
+
</files>
|
95 |
+
</EMerchantPay_Genesis>
|
96 |
+
</modules>
|
97 |
+
</translate>
|
98 |
+
</adminhtml>
|
99 |
+
|
100 |
+
<default>
|
101 |
+
<payment>
|
102 |
+
<emerchantpay_direct>
|
103 |
+
<model>emerchantpay/direct</model>
|
104 |
+
<order_status>pending</order_status>
|
105 |
+
<title>Credit Card (eMerchantPay Direct)</title>
|
106 |
+
<cctypes>VI,MC,SM,AE,DI,JCB,OT</cctypes>
|
107 |
+
<payment_action>authorize</payment_action>
|
108 |
+
<group>emerchantpay</group>
|
109 |
+
</emerchantpay_direct>
|
110 |
+
<emerchantpay_checkout>
|
111 |
+
<model>emerchantpay/checkout</model>
|
112 |
+
<order_status>pending</order_status>
|
113 |
+
<title>Credit Card (eMerchantPay Checkout)</title>
|
114 |
+
<payment_action>order</payment_action>
|
115 |
+
<group>emerchantpay</group>
|
116 |
+
</emerchantpay_checkout>
|
117 |
+
</payment>
|
118 |
+
</default>
|
119 |
+
</config>
|
app/code/community/EMerchantPay/Genesis/etc/system.xml
ADDED
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or
|
6 |
+
modify it under the terms of the GNU General Public License
|
7 |
+
as published by the Free Software Foundation; either version 2
|
8 |
+
of the License, or (at your option) any later version.
|
9 |
+
|
10 |
+
This program is distributed in the hope that it will be useful,
|
11 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
GNU General Public License for more details.
|
14 |
+
|
15 |
+
@author eMerchantPay
|
16 |
+
@copyright 2015 eMerchantPay Ltd.
|
17 |
+
@license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<sections>
|
21 |
+
<payment>
|
22 |
+
<groups>
|
23 |
+
<emerchantpay_direct translate="label" module="emerchantpay">
|
24 |
+
<label>eMerchantPay Direct</label>
|
25 |
+
<sort_order>10</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
<fields>
|
30 |
+
<active translate="label">
|
31 |
+
<label>Enabled</label>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
34 |
+
<sort_order>01</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
</active>
|
39 |
+
<title translate="label">
|
40 |
+
<label>Title</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>02</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</title>
|
47 |
+
<genesis_token translate="label">
|
48 |
+
<label>Token</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>03</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>0</show_in_store>
|
54 |
+
</genesis_token>
|
55 |
+
<genesis_username translate="label">
|
56 |
+
<label>Username</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>04</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>0</show_in_store>
|
62 |
+
</genesis_username>
|
63 |
+
<genesis_password translate="label">
|
64 |
+
<label>Password</label>
|
65 |
+
<frontend_type>text</frontend_type>
|
66 |
+
<sort_order>05</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>0</show_in_store>
|
70 |
+
</genesis_password>
|
71 |
+
<genesis_environment translate="label">
|
72 |
+
<label>Test Mode</label>
|
73 |
+
<comment>
|
74 |
+
If enabled, your transactions are forwarded to our test (staging) environment.
|
75 |
+
</comment>
|
76 |
+
<frontend_type>select</frontend_type>
|
77 |
+
<source_model>emerchantpay/admin_environment</source_model>
|
78 |
+
<sort_order>06</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>0</show_in_store>
|
82 |
+
</genesis_environment>
|
83 |
+
<genesis_type translate="label">
|
84 |
+
<label>Transaction Type</label>
|
85 |
+
<comment>
|
86 |
+
Select the transaction type for the initial transaction.
|
87 |
+
</comment>
|
88 |
+
<frontend_type>select</frontend_type>
|
89 |
+
<source_model>emerchantpay/admin_direct_options_transaction_type</source_model>
|
90 |
+
<sort_order>07</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>0</show_in_store>
|
94 |
+
</genesis_type>
|
95 |
+
<order_status translate="label">
|
96 |
+
<label>New Order Status</label>
|
97 |
+
<frontend_type>select</frontend_type>
|
98 |
+
<source_model>adminhtml/system_config_source_order_status_new</source_model>
|
99 |
+
<sort_order>08</sort_order>
|
100 |
+
<show_in_default>1</show_in_default>
|
101 |
+
<show_in_website>1</show_in_website>
|
102 |
+
<show_in_store>0</show_in_store>
|
103 |
+
</order_status>
|
104 |
+
<allowspecific translate="label">
|
105 |
+
<label>Payment from Applicable Countries</label>
|
106 |
+
<frontend_type>allowspecific</frontend_type>
|
107 |
+
<sort_order>10</sort_order>
|
108 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>0</show_in_store>
|
112 |
+
</allowspecific>
|
113 |
+
<specificcountry translate="label">
|
114 |
+
<label>Payment from Specific Countries</label>
|
115 |
+
<frontend_type>multiselect</frontend_type>
|
116 |
+
<sort_order>11</sort_order>
|
117 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>0</show_in_store>
|
121 |
+
<can_be_empty>1</can_be_empty>
|
122 |
+
</specificcountry>
|
123 |
+
<cctypes translate="label">
|
124 |
+
<label>Credit Card Types</label>
|
125 |
+
<frontend_type>multiselect</frontend_type>
|
126 |
+
<source_model>adminhtml/system_config_source_payment_cctype</source_model>
|
127 |
+
<sort_order>12</sort_order>
|
128 |
+
<show_in_default>1</show_in_default>
|
129 |
+
<show_in_website>1</show_in_website>
|
130 |
+
<show_in_store>0</show_in_store>
|
131 |
+
<can_be_empty>1</can_be_empty>
|
132 |
+
</cctypes>
|
133 |
+
<min_order_total translate="label">
|
134 |
+
<label>Minimum Order Total</label>
|
135 |
+
<frontend_type>text</frontend_type>
|
136 |
+
<sort_order>13</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>0</show_in_store>
|
140 |
+
</min_order_total>
|
141 |
+
<max_order_total translate="label">
|
142 |
+
<label>Maximum Order Total</label>
|
143 |
+
<frontend_type>text</frontend_type>
|
144 |
+
<sort_order>14</sort_order>
|
145 |
+
<show_in_default>1</show_in_default>
|
146 |
+
<show_in_website>1</show_in_website>
|
147 |
+
<show_in_store>0</show_in_store>
|
148 |
+
</max_order_total>
|
149 |
+
<sort_order translate="label">
|
150 |
+
<label>Sort Order</label>
|
151 |
+
<frontend_type>text</frontend_type>
|
152 |
+
<sort_order>15</sort_order>
|
153 |
+
<show_in_default>1</show_in_default>
|
154 |
+
<show_in_website>1</show_in_website>
|
155 |
+
<show_in_store>0</show_in_store>
|
156 |
+
<frontend_class>validate-number</frontend_class>
|
157 |
+
</sort_order>
|
158 |
+
</fields>
|
159 |
+
</emerchantpay_direct>
|
160 |
+
<emerchantpay_checkout translate="label" module="emerchantpay">
|
161 |
+
<label>eMerchantPay Checkout</label>
|
162 |
+
<sort_order>10</sort_order>
|
163 |
+
<show_in_default>1</show_in_default>
|
164 |
+
<show_in_website>1</show_in_website>
|
165 |
+
<show_in_store>1</show_in_store>
|
166 |
+
<fields>
|
167 |
+
<active translate="label">
|
168 |
+
<label>Enabled</label>
|
169 |
+
<frontend_type>select</frontend_type>
|
170 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
171 |
+
<sort_order>01</sort_order>
|
172 |
+
<show_in_default>1</show_in_default>
|
173 |
+
<show_in_website>1</show_in_website>
|
174 |
+
<show_in_store>0</show_in_store>
|
175 |
+
</active>
|
176 |
+
<title translate="label">
|
177 |
+
<label>Title</label>
|
178 |
+
<frontend_type>text</frontend_type>
|
179 |
+
<sort_order>02</sort_order>
|
180 |
+
<show_in_default>1</show_in_default>
|
181 |
+
<show_in_website>1</show_in_website>
|
182 |
+
<show_in_store>1</show_in_store>
|
183 |
+
</title>
|
184 |
+
<genesis_username translate="label">
|
185 |
+
<label>Username</label>
|
186 |
+
<frontend_type>text</frontend_type>
|
187 |
+
<sort_order>03</sort_order>
|
188 |
+
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>1</show_in_website>
|
190 |
+
<show_in_store>0</show_in_store>
|
191 |
+
</genesis_username>
|
192 |
+
<genesis_password translate="label">
|
193 |
+
<label>Password</label>
|
194 |
+
<frontend_type>text</frontend_type>
|
195 |
+
<sort_order>04</sort_order>
|
196 |
+
<show_in_default>1</show_in_default>
|
197 |
+
<show_in_website>1</show_in_website>
|
198 |
+
<show_in_store>0</show_in_store>
|
199 |
+
</genesis_password>
|
200 |
+
<genesis_environment translate="label">
|
201 |
+
<label>Test Mode</label>
|
202 |
+
<comment>
|
203 |
+
If enabled, your transactions are forwarded to our test (staging) environment.
|
204 |
+
</comment>
|
205 |
+
<frontend_type>select</frontend_type>
|
206 |
+
<source_model>emerchantpay/admin_environment</source_model>
|
207 |
+
<sort_order>05</sort_order>
|
208 |
+
<show_in_default>1</show_in_default>
|
209 |
+
<show_in_website>1</show_in_website>
|
210 |
+
<show_in_store>0</show_in_store>
|
211 |
+
</genesis_environment>
|
212 |
+
<genesis_types translate="label">
|
213 |
+
<label>Transaction Types</label>
|
214 |
+
<comment>
|
215 |
+
Select the transaction types that must be attempted during the customer's Checkout session.
|
216 |
+
The first transaction type that is available will be selected by the gateway.
|
217 |
+
</comment>
|
218 |
+
<frontend_type>multiselect</frontend_type>
|
219 |
+
<source_model>emerchantpay/admin_checkout_options_transaction_type</source_model>
|
220 |
+
<sort_order>06</sort_order>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
<show_in_store>0</show_in_store>
|
224 |
+
<can_be_empty>1</can_be_empty>
|
225 |
+
</genesis_types>
|
226 |
+
<order_status translate="label">
|
227 |
+
<label>New Order Status</label>
|
228 |
+
<frontend_type>select</frontend_type>
|
229 |
+
<source_model>adminhtml/system_config_source_order_status_new</source_model>
|
230 |
+
<sort_order>07</sort_order>
|
231 |
+
<show_in_default>1</show_in_default>
|
232 |
+
<show_in_website>1</show_in_website>
|
233 |
+
<show_in_store>0</show_in_store>
|
234 |
+
</order_status>
|
235 |
+
<allowspecific translate="label">
|
236 |
+
<label>Payment from Applicable Countries</label>
|
237 |
+
<frontend_type>allowspecific</frontend_type>
|
238 |
+
<sort_order>08</sort_order>
|
239 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
240 |
+
<show_in_default>1</show_in_default>
|
241 |
+
<show_in_website>1</show_in_website>
|
242 |
+
<show_in_store>0</show_in_store>
|
243 |
+
</allowspecific>
|
244 |
+
<specificcountry translate="label">
|
245 |
+
<label>Payment from Specific Countries</label>
|
246 |
+
<frontend_type>multiselect</frontend_type>
|
247 |
+
<sort_order>09</sort_order>
|
248 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
249 |
+
<show_in_default>1</show_in_default>
|
250 |
+
<show_in_website>1</show_in_website>
|
251 |
+
<show_in_store>0</show_in_store>
|
252 |
+
<can_be_empty>1</can_be_empty>
|
253 |
+
</specificcountry>
|
254 |
+
<min_order_total translate="label">
|
255 |
+
<label>Minimum Order Total</label>
|
256 |
+
<frontend_type>text</frontend_type>
|
257 |
+
<sort_order>10</sort_order>
|
258 |
+
<show_in_default>1</show_in_default>
|
259 |
+
<show_in_website>1</show_in_website>
|
260 |
+
<show_in_store>0</show_in_store>
|
261 |
+
</min_order_total>
|
262 |
+
<max_order_total translate="label">
|
263 |
+
<label>Maximum Order Total</label>
|
264 |
+
<frontend_type>text</frontend_type>
|
265 |
+
<sort_order>11</sort_order>
|
266 |
+
<show_in_default>1</show_in_default>
|
267 |
+
<show_in_website>1</show_in_website>
|
268 |
+
<show_in_store>0</show_in_store>
|
269 |
+
</max_order_total>
|
270 |
+
<sort_order translate="label">
|
271 |
+
<label>Sort Order</label>
|
272 |
+
<frontend_type>text</frontend_type>
|
273 |
+
<sort_order>12</sort_order>
|
274 |
+
<show_in_default>1</show_in_default>
|
275 |
+
<show_in_website>1</show_in_website>
|
276 |
+
<show_in_store>0</show_in_store>
|
277 |
+
<frontend_class>validate-number</frontend_class>
|
278 |
+
</sort_order>
|
279 |
+
</fields>
|
280 |
+
</emerchantpay_checkout>
|
281 |
+
</groups>
|
282 |
+
</payment>
|
283 |
+
</sections>
|
284 |
+
</config>
|
app/design/adminhtml/default/default/template/emerchantpay/info/checkout.phtml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
?>
|
20 |
+
|
21 |
+
<p>
|
22 |
+
<?php echo $this->__('More details about the individual transactions can be found under the "Transactions" section'); ?>
|
23 |
+
</p>
|
app/design/adminhtml/default/default/template/emerchantpay/info/direct.phtml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
?>
|
20 |
+
|
21 |
+
<p>
|
22 |
+
<?php echo $this->__('More details about the individual transactions can be found under the "Transactions" section'); ?>
|
23 |
+
</p>
|
app/design/frontend/base/default/template/emerchantpay/form/checkout.phtml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
?>
|
20 |
+
<?php $_code = $this->getMethodCode() ?>
|
21 |
+
|
22 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
23 |
+
<li>
|
24 |
+
<p>
|
25 |
+
<?php echo $this->__("You will be redirected to our partner's website, where you can safely pay with your credit card."); ?>
|
26 |
+
</p>
|
27 |
+
</li>
|
28 |
+
</ul>
|
app/design/frontend/base/default/template/emerchantpay/form/direct.phtml
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
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_AFL.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 license@magentocommerce.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 Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $_code=$this->getMethodCode() ?>
|
28 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
29 |
+
<li>
|
30 |
+
<label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
|
31 |
+
<div class="input-box">
|
32 |
+
<input autocomplete="off" type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="" />
|
33 |
+
</div>
|
34 |
+
</li>
|
35 |
+
<li>
|
36 |
+
<label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
|
37 |
+
<div class="input-box">
|
38 |
+
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" title="<?php echo $this->__('Credit Card Type') ?>" class="required-entry validate-cc-type-select">
|
39 |
+
<option value=""><?php echo $this->__('--Please Select--') ?></option>
|
40 |
+
<?php $_ccType = $this->getInfoData('cc_type') ?>
|
41 |
+
<?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
|
42 |
+
<option value="<?php echo $_typeCode ?>"><?php echo $_typeName ?></option>
|
43 |
+
<?php endforeach ?>
|
44 |
+
</select>
|
45 |
+
</div>
|
46 |
+
</li>
|
47 |
+
<li>
|
48 |
+
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
49 |
+
<div class="input-box">
|
50 |
+
<input autocomplete="off" type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
|
51 |
+
</div>
|
52 |
+
</li>
|
53 |
+
<li>
|
54 |
+
<label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
|
55 |
+
<div class="input-box">
|
56 |
+
<div class="v-fix">
|
57 |
+
<select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
|
58 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
59 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
60 |
+
<option value="<?php echo $k?$k:'' ?>"><?php echo $v ?></option>
|
61 |
+
<?php endforeach ?>
|
62 |
+
</select>
|
63 |
+
</div>
|
64 |
+
<div class="v-fix">
|
65 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
66 |
+
<select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
|
67 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
68 |
+
<option value="<?php echo $k?$k:'' ?>"><?php echo $v ?></option>
|
69 |
+
<?php endforeach ?>
|
70 |
+
</select>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
</li>
|
74 |
+
<?php echo $this->getChildHtml() ?>
|
75 |
+
<?php if($this->hasVerification()): ?>
|
76 |
+
<li>
|
77 |
+
<label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
78 |
+
<div class="input-box">
|
79 |
+
<div class="v-fix">
|
80 |
+
<input autocomplete="off" type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
|
81 |
+
</div>
|
82 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
83 |
+
</div>
|
84 |
+
</li>
|
85 |
+
<?php endif; ?>
|
86 |
+
</ul>
|
app/design/frontend/base/default/template/emerchantpay/info/checkout.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
?>
|
20 |
+
<table>
|
21 |
+
<tr>
|
22 |
+
<td><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></td>
|
23 |
+
</tr>
|
24 |
+
</table>
|
app/design/frontend/base/default/template/emerchantpay/info/direct.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
?>
|
20 |
+
<table>
|
21 |
+
<tr>
|
22 |
+
<td><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></td>
|
23 |
+
</tr>
|
24 |
+
</table>
|
app/design/frontend/base/default/template/emerchantpay/redirect/checkout.phtml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
?>
|
20 |
+
<!DOCTYPE>
|
21 |
+
<html>
|
22 |
+
<head>
|
23 |
+
<title><?php echo $this->__('You are being redirected!'); ?></title>
|
24 |
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
25 |
+
<style>
|
26 |
+
html,body {
|
27 |
+
margin:0;
|
28 |
+
padding:0;
|
29 |
+
width:100%;
|
30 |
+
height:100%;
|
31 |
+
display:table;
|
32 |
+
}
|
33 |
+
.wrapper {
|
34 |
+
text-align:center;
|
35 |
+
display:table-cell;
|
36 |
+
vertical-align:middle;
|
37 |
+
}
|
38 |
+
.notice {
|
39 |
+
padding:16px;
|
40 |
+
}
|
41 |
+
</style>
|
42 |
+
</head>
|
43 |
+
<body>
|
44 |
+
|
45 |
+
<div class="wrapper">
|
46 |
+
<div class="notice">
|
47 |
+
<p>
|
48 |
+
<?php echo $this->__("You are being redirected to a secure page, where you can complete your payment!"); ?>
|
49 |
+
</p>
|
50 |
+
</div>
|
51 |
+
<div class="form">
|
52 |
+
<?php echo $this->generateForm(); ?>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<script type="text/javascript">
|
57 |
+
window.setTimeout(
|
58 |
+
function() {
|
59 |
+
document.getElementById("<?php echo $this->getButtonId(); ?>").click();
|
60 |
+
}, 3000
|
61 |
+
);
|
62 |
+
</script>
|
63 |
+
</body>
|
64 |
+
</html>
|
app/design/frontend/base/default/template/emerchantpay/redirect/direct.phtml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 eMerchantPay Ltd.
|
4 |
+
*
|
5 |
+
* This program is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License
|
7 |
+
* as published by the Free Software Foundation; either version 2
|
8 |
+
* of the License, or (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* @author eMerchantPay
|
16 |
+
* @copyright 2015 eMerchantPay Ltd.
|
17 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 (GPL-2.0)
|
18 |
+
*/
|
19 |
+
?>
|
20 |
+
<!DOCTYPE>
|
21 |
+
<html>
|
22 |
+
<head>
|
23 |
+
<title><?php echo $this->__('You are being redirected!'); ?></title>
|
24 |
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
25 |
+
<style>
|
26 |
+
html,body {
|
27 |
+
margin:0;
|
28 |
+
padding:0;
|
29 |
+
width:100%;
|
30 |
+
height:100%;
|
31 |
+
display:table;
|
32 |
+
}
|
33 |
+
.wrapper {
|
34 |
+
text-align:center;
|
35 |
+
display:table-cell;
|
36 |
+
vertical-align:middle;
|
37 |
+
}
|
38 |
+
.notice {
|
39 |
+
padding:16px;
|
40 |
+
}
|
41 |
+
</style>
|
42 |
+
</head>
|
43 |
+
<body>
|
44 |
+
|
45 |
+
<div class="wrapper">
|
46 |
+
<div class="notice">
|
47 |
+
<p>
|
48 |
+
<?php echo $this->__("You are being redirected to a secure page, where you can complete your payment!"); ?>
|
49 |
+
</p>
|
50 |
+
</div>
|
51 |
+
<div class="form">
|
52 |
+
<?php echo $this->generateForm(); ?>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<script type="text/javascript">
|
57 |
+
window.setTimeout(
|
58 |
+
function() {
|
59 |
+
document.getElementById("<?php echo $this->getButtonId(); ?>").click();
|
60 |
+
}, 3000
|
61 |
+
);
|
62 |
+
</script>
|
63 |
+
</body>
|
64 |
+
</html>
|
app/etc/modules/EMerchantPay_Genesis.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<EMerchantPay_Genesis>
|
4 |
+
<active>true</active>
|
5 |
+
<codePool>community</codePool>
|
6 |
+
<depends>
|
7 |
+
<Mage_Payment />
|
8 |
+
</depends>
|
9 |
+
</EMerchantPay_Genesis>
|
10 |
+
</modules>
|
11 |
+
</config>
|
app/locale/en_GB/EMerchantPay_Genesis.csv
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"--Please Select--","--Please Select--"
|
2 |
+
"3D-Secure: Redirecting customer to a verification page.","3D-Secure: Redirecting customer to a verification page."
|
3 |
+
"ABN iDEAL","ABN iDEAL"
|
4 |
+
"Authorize","Authorize"
|
5 |
+
"Authorize (3D-Secure)","Authorize (3D-Secure)"
|
6 |
+
"Card Verification Number","Card Verification Number"
|
7 |
+
"CashU","CashU"
|
8 |
+
"Click here, if you are not redirected within 10 seconds...","Click here, if you are not redirected within 10 seconds..."
|
9 |
+
"Credit Card Number","Credit Card Number"
|
10 |
+
"Credit Card Type","Credit Card Type"
|
11 |
+
"Expiration Date","Expiration Date"
|
12 |
+
"GiroPay","GiroPay"
|
13 |
+
"Magento Payment","Magento Payment"
|
14 |
+
"Month","Month"
|
15 |
+
"More details about the individual transactions can be found under the ""Transactions"" section","More details about the individual transactions can be found under the ""Transactions"" section"
|
16 |
+
"Name on Card","Name on Card"
|
17 |
+
"Neteller","Neteller"
|
18 |
+
"No","No"
|
19 |
+
"PaySafeCard","PaySafeCard"
|
20 |
+
"Przelewy24","Przelewy24"
|
21 |
+
"Qiwi","Qiwi"
|
22 |
+
"SOFORT","SOFORT"
|
23 |
+
"SafetyPay","SafetyPay"
|
24 |
+
"Sale","Sale"
|
25 |
+
"Sale (3D-Secure)","Sale (3D-Secure)"
|
26 |
+
"TeleIngreso","TeleIngreso"
|
27 |
+
"TrustPay","TrustPay"
|
28 |
+
"We were unable to process your payment! Please check your input or try again later.","We were unable to process your payment! Please check your input or try again later."
|
29 |
+
"What is this?","What is this?"
|
30 |
+
"Year","Year"
|
31 |
+
"Yes","Yes"
|
32 |
+
"You are being redirected to a secure page, where you can complete your payment!","You are being redirected to a secure page, where you can complete your payment!"
|
33 |
+
"You are being redirected!","You are being redirected!"
|
34 |
+
"You will be redirected to our partner's website, where you can safely pay with your credit card.","You will be redirected to our partner's website, where you can safely pay with your credit card."
|
35 |
+
"Your payment session has been cancelled successfully!","Your payment session has been cancelled successfully!"
|
36 |
+
"eps","eps"
|
app/locale/en_US/EMerchantPay_Genesis.csv
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"--Please Select--","--Please Select--"
|
2 |
+
"3D-Secure: Redirecting customer to a verification page.","3D-Secure: Redirecting customer to a verification page."
|
3 |
+
"ABN iDEAL","ABN iDEAL"
|
4 |
+
"Authorize","Authorize"
|
5 |
+
"Authorize (3D-Secure)","Authorize (3D-Secure)"
|
6 |
+
"Card Verification Number","Card Verification Number"
|
7 |
+
"CashU","CashU"
|
8 |
+
"Click here, if you are not redirected within 10 seconds...","Click here, if you are not redirected within 10 seconds..."
|
9 |
+
"Credit Card Number","Credit Card Number"
|
10 |
+
"Credit Card Type","Credit Card Type"
|
11 |
+
"Expiration Date","Expiration Date"
|
12 |
+
"GiroPay","GiroPay"
|
13 |
+
"Magento Payment","Magento Payment"
|
14 |
+
"Month","Month"
|
15 |
+
"More details about the individual transactions can be found under the ""Transactions"" section","More details about the individual transactions can be found under the ""Transactions"" section"
|
16 |
+
"Name on Card","Name on Card"
|
17 |
+
"Neteller","Neteller"
|
18 |
+
"No","No"
|
19 |
+
"PaySafeCard","PaySafeCard"
|
20 |
+
"Przelewy24","Przelewy24"
|
21 |
+
"Qiwi","Qiwi"
|
22 |
+
"SOFORT","SOFORT"
|
23 |
+
"SafetyPay","SafetyPay"
|
24 |
+
"Sale","Sale"
|
25 |
+
"Sale (3D-Secure)","Sale (3D-Secure)"
|
26 |
+
"TeleIngreso","TeleIngreso"
|
27 |
+
"TrustPay","TrustPay"
|
28 |
+
"We were unable to process your payment! Please check your input or try again later.","We were unable to process your payment! Please check your input or try again later."
|
29 |
+
"What is this?","What is this?"
|
30 |
+
"Year","Year"
|
31 |
+
"Yes","Yes"
|
32 |
+
"You are being redirected to a secure page, where you can complete your payment!","You are being redirected to a secure page, where you can complete your payment!"
|
33 |
+
"You are being redirected!","You are being redirected!"
|
34 |
+
"You will be redirected to our partner's website, where you can safely pay with your credit card.","You will be redirected to our partner's website, where you can safely pay with your credit card."
|
35 |
+
"Your payment session has been cancelled successfully!","Your payment session has been cancelled successfully!"
|
36 |
+
"eps","eps"
|
lib/Genesis/src/Genesis/API/Constants/Banks.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Constants;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Banks
|
27 |
+
*
|
28 |
+
* List of supported Banks
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Constants
|
31 |
+
*/
|
32 |
+
class Banks
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Industrial and Commercial Bank of China
|
36 |
+
*/
|
37 |
+
const ICBC = 'ICBC';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* China Merchants Bank
|
41 |
+
*/
|
42 |
+
const CMBCHINA = 'CMBCHINA';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Agricultural Bank of China
|
46 |
+
*/
|
47 |
+
const ABC = 'ABC';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* China Construction Bank
|
51 |
+
*/
|
52 |
+
const CCB = 'CCB';
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Bank of Beijing
|
56 |
+
*/
|
57 |
+
const BCCB = 'BCCB';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Bank of Communications
|
61 |
+
*/
|
62 |
+
const BOCO = 'BOCO';
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Industrial Bank
|
66 |
+
*/
|
67 |
+
const CIB = 'CIB';
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Bank of Nanjing
|
71 |
+
*/
|
72 |
+
const NJCB = 'NJCB';
|
73 |
+
|
74 |
+
/**
|
75 |
+
* China Minsheng Banking Corp Ltd
|
76 |
+
*/
|
77 |
+
const CMBC = 'CMBC';
|
78 |
+
|
79 |
+
/**
|
80 |
+
* China Everbright Bank
|
81 |
+
*/
|
82 |
+
const CEB = 'CEB';
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Bank of China
|
86 |
+
*/
|
87 |
+
const BOC = 'BOC';
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Ping An Bank
|
91 |
+
*/
|
92 |
+
const PINGANBANK = 'PINGANBANK';
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Bank of East Asia
|
96 |
+
*/
|
97 |
+
const HKBEA = 'HKBEA';
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Bank of Ningbo
|
101 |
+
*/
|
102 |
+
const NBCB = 'NBCB';
|
103 |
+
|
104 |
+
/**
|
105 |
+
* China Citic Bank
|
106 |
+
*/
|
107 |
+
const ECITIC = 'ECITIC';
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Shenzhen Development Bank
|
111 |
+
*/
|
112 |
+
const SDB = 'SDB';
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Guangdong Development Bank
|
116 |
+
*/
|
117 |
+
const GDB = 'GDB';
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Bank of Shanghai
|
121 |
+
*/
|
122 |
+
const SHB = 'SHB';
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Shanghai Pudong Development Bank
|
126 |
+
*/
|
127 |
+
const SPDB = 'SPDB';
|
128 |
+
|
129 |
+
/**
|
130 |
+
* China Post
|
131 |
+
*/
|
132 |
+
const POST = 'POST';
|
133 |
+
|
134 |
+
/**
|
135 |
+
* BEIJING RURAL COMMERCIAL BANK
|
136 |
+
*/
|
137 |
+
const BJRCB = 'BJRCB';
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Hua Xia Bank Co Ltd'
|
141 |
+
*/
|
142 |
+
const HXB = 'HXB';
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Bank of Hangzhou
|
146 |
+
*/
|
147 |
+
const HZBANK = 'HZBANK';
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Shanghai Rural Commercial Bank
|
151 |
+
*/
|
152 |
+
const SRCB = 'SRCB';
|
153 |
+
}
|
lib/Genesis/src/Genesis/API/Constants/Endpoints.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Constants;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Endpoints
|
27 |
+
*
|
28 |
+
* List of possible Genesis endpoints
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Constants
|
31 |
+
*/
|
32 |
+
class Endpoints
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Domain for E-ComProcessing's Genesis instance
|
36 |
+
*
|
37 |
+
* @link http://www.e-comprocessing.com/
|
38 |
+
*/
|
39 |
+
const ECOMPROCESSING = 'e-comprocessing.net';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Domain for eMerchantPay's Genesis instance
|
43 |
+
*
|
44 |
+
* @link https://www.emerchantpay.com
|
45 |
+
*/
|
46 |
+
const EMERCHANTPAY = 'emerchantpay.net';
|
47 |
+
}
|
lib/Genesis/src/Genesis/API/Constants/Environments.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Constants;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Environments
|
27 |
+
*
|
28 |
+
* List of server environments
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Constants
|
31 |
+
*/
|
32 |
+
class Environments
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Live (Production) environment
|
36 |
+
*/
|
37 |
+
const PRODUCTION = 'production';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Test (Staging) environment
|
41 |
+
*
|
42 |
+
* @note NO MONEY ARE BEING TRANSFERRED
|
43 |
+
*/
|
44 |
+
const STAGING = 'sandbox';
|
45 |
+
}
|
lib/Genesis/src/Genesis/API/Constants/Errors.php
ADDED
@@ -0,0 +1,618 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Constants;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Error codes used by Genesis / Issuer
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage API
|
30 |
+
*/
|
31 |
+
final class Errors
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Successfully completed request
|
35 |
+
*/
|
36 |
+
const SUCCESS = 000;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Undefined error
|
40 |
+
*/
|
41 |
+
const ERROR = 001;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* A general system error occurred
|
45 |
+
*/
|
46 |
+
const SYSTEM_ERROR = 100;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* System is undergoing maintenance, request could not be handled
|
50 |
+
*/
|
51 |
+
const MAINTENANCE_ERROR = 101;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Login failed. Check your API credentials.
|
55 |
+
*/
|
56 |
+
const AUTHENTICATION_ERROR = 110;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Config error occurred, e.g. terminal not configured properly.
|
60 |
+
*
|
61 |
+
* Check terminal settings
|
62 |
+
*/
|
63 |
+
const CONFIGURATION_ERROR = 120;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Communication with issuer failed, please contact support.
|
67 |
+
*/
|
68 |
+
const COMMUNICATION_ERROR = 200;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Connection to issuer could not be established, please contact support
|
72 |
+
*/
|
73 |
+
const CONNECTION_ERROR = 210;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Issuer account data invalid, please contact support
|
77 |
+
*/
|
78 |
+
const ACCOUNT_ERROR = 220;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Issuer does not respond within given time-frame - please reconcile
|
82 |
+
*/
|
83 |
+
const TIMEOUT_ERROR = 230;
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Issuer returned invalid response - please reconcile and contact support
|
87 |
+
*/
|
88 |
+
const RESPONSE_ERROR = 240;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Issuer response could not be parsed - please reconcile and contact support
|
92 |
+
*/
|
93 |
+
const PARSING_ERROR = 250;
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Invalid were data sent to the API.
|
97 |
+
*/
|
98 |
+
const INPUT_DATA_ERROR = 300;
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Invalid transaction type was passed to API
|
102 |
+
*/
|
103 |
+
const INVALID_TRANSACTION_TYPE_ERROR = 310;
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Required argument is missing
|
107 |
+
*/
|
108 |
+
const INPUT_DATA_MISSING_ERROR = 320;
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Argument passed in invalid format
|
112 |
+
*/
|
113 |
+
const INPUT_DATA_FORMAT_ERROR = 330;
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Argument passed in valid format but makes no sense (e.g. incorrect country code or currency)
|
117 |
+
*/
|
118 |
+
const INPUT_DATA_INVALID_ERROR = 340;
|
119 |
+
|
120 |
+
/**
|
121 |
+
* The input Builder could not be parsed due to invalid code
|
122 |
+
*/
|
123 |
+
const INVALID_XML_ERROR = 350;
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Invalid value for HTTP header - Content-Type
|
127 |
+
*/
|
128 |
+
const INVALID_CONTENT_TYPE_ERROR = 360;
|
129 |
+
|
130 |
+
/**
|
131 |
+
* A transaction was triggered that is not possible at this time in the workflow,
|
132 |
+
* e.g. a refund on a declined transaction.
|
133 |
+
*/
|
134 |
+
const WORKFLOW_ERROR = 400;
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Reference transaction was not found.
|
138 |
+
*/
|
139 |
+
const REFERENCE_NOT_FOUND_ERROR = 410;
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Wrong Workflow specified
|
143 |
+
*/
|
144 |
+
const REFERENCE_WORKFLOW_ERROR = 420;
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Reference transaction already invalidated
|
148 |
+
*/
|
149 |
+
const REFERENCE_INVALIDATED_ERROR = 430;
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Data mismatch with reference, e.g. amount exceeds reference
|
153 |
+
*/
|
154 |
+
const REFERENCE_MISMATCH_ERROR = 440;
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Transaction doublet was detected, transaction was blocked
|
158 |
+
*/
|
159 |
+
const DOUBLE_TRANSACTION_ERROR = 450;
|
160 |
+
|
161 |
+
/**
|
162 |
+
* The referenced transaction could not be found
|
163 |
+
*/
|
164 |
+
const TRANSACTION_NOT_FOUND_ERROR = 460;
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Transaction declined by issuer
|
168 |
+
*/
|
169 |
+
const PROCESSING_ERROR = 500;
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Transaction declined, Credit card number is invalid
|
173 |
+
*/
|
174 |
+
const INVALID_CARD_ERROR = 510;
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Transaction declined, expiration date not in the future or date invalid
|
178 |
+
*/
|
179 |
+
const EXPIRED_CARD_ERROR = 520;
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Transaction pending
|
183 |
+
*/
|
184 |
+
const TRANSACTION_PENDING_ERROR = 530;
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Amount exceeds credit card limit
|
188 |
+
*/
|
189 |
+
const CREDIT_EXCEEDED_ERROR = 540;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Transaction declined by risk management
|
193 |
+
*/
|
194 |
+
const RISK_ERROR = 600;
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Card bin does not match billing country
|
198 |
+
*/
|
199 |
+
const BIN_COUNTRY_CHECK_ERROR = 609;
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Card is blacklisted
|
203 |
+
*/
|
204 |
+
const CARD_BLACKLIST_ERROR = 610;
|
205 |
+
|
206 |
+
/**
|
207 |
+
* BIN blacklisted
|
208 |
+
*/
|
209 |
+
const BIN_BLACKLIST_ERROR = 611;
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Country blacklisted
|
213 |
+
*/
|
214 |
+
const COUNTRY_BLACKLIST_ERROR = 612;
|
215 |
+
|
216 |
+
/**
|
217 |
+
* IP address blacklisted
|
218 |
+
*/
|
219 |
+
const IP_BLACKLIST_ERROR = 613;
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Value from the Transaction Request or Risk Parameters is blacklisted
|
223 |
+
*/
|
224 |
+
const BLACKLIST_ERROR = 614;
|
225 |
+
|
226 |
+
/**
|
227 |
+
* PAN Whitelist Filter blocked the transaction
|
228 |
+
*/
|
229 |
+
const CARD_WHITELIST_ERROR = 615;
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Card limit exceeded configured limits
|
233 |
+
*/
|
234 |
+
const CARD_LIMIT_EXCEEDED_ERROR = 620;
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Terminal limits exceeded.
|
238 |
+
*/
|
239 |
+
const TERMINAL_LIMIT_EXCEEDED_ERROR = 621;
|
240 |
+
|
241 |
+
/**
|
242 |
+
* MID limits exceeded
|
243 |
+
*/
|
244 |
+
const CONTRACT_LIMIT_EXCEEDED_ERROR = 622;
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Velocity by unknown card exceeded
|
248 |
+
*/
|
249 |
+
const CARD_VELOCITY_EXCEEDED_ERROR = 623;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Ticket size by unknown card exceeded
|
253 |
+
*/
|
254 |
+
const CARD_TICKET_SIZE_EXCEEDED_ERROR = 624;
|
255 |
+
|
256 |
+
/**
|
257 |
+
* User limit exceeded configured limits
|
258 |
+
*/
|
259 |
+
const USER_LIMIT_EXCEEDED_ERROR = 625;
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Found user transaction declined by issuer
|
263 |
+
*/
|
264 |
+
const MULTIPLE_FAILURE_DETECTION_ERROR = 626;
|
265 |
+
|
266 |
+
/**
|
267 |
+
* CrossSelling Error!
|
268 |
+
*/
|
269 |
+
const CS_DETECTION_ERROR = 627;
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Amount/count by recurring subscription exceeded
|
273 |
+
*/
|
274 |
+
const RECURRING_LIMIT_EXCEEDED_ERROR = 628;
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Address Verification failed
|
278 |
+
*/
|
279 |
+
const AVS_ERROR = 690;
|
280 |
+
|
281 |
+
/**
|
282 |
+
* MaxMind High Risk Error
|
283 |
+
*/
|
284 |
+
const MAX_MIND_RISK_ERROR = 691;
|
285 |
+
|
286 |
+
/**
|
287 |
+
* ThreatMetrix High Risk Error
|
288 |
+
*/
|
289 |
+
const THREAT_METRIX_RISK_ERROR = 692;
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Some error occurred on the issuer side
|
293 |
+
*/
|
294 |
+
const REMOTE_ERROR = 900;
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Some error occurred on the issuer side
|
298 |
+
*/
|
299 |
+
const REMOTE_SYSTEM_ERROR = 910;
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Issuer configuration error
|
303 |
+
*/
|
304 |
+
const REMOTE_CONFIGURATION_ERROR = 920;
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Some passed data caused an error on the issuer
|
308 |
+
*/
|
309 |
+
const REMOTE_DATA_ERROR = 930;
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Remote workflow error
|
313 |
+
*/
|
314 |
+
const REMOTE_WORKFLOW_ERROR = 940;
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Issuer has time-out with clearing network
|
318 |
+
*/
|
319 |
+
const REMOTE_TIMEOUT_ERROR = 950;
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Issuer could not reach clearing network
|
323 |
+
*/
|
324 |
+
const REMOTE_CONNECTION_ERROR = 960;
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Get Genesis Error Code
|
328 |
+
*
|
329 |
+
* @param $error - error_msg to retrieve error code
|
330 |
+
*
|
331 |
+
* @return mixed
|
332 |
+
*/
|
333 |
+
public static function getErrorCode($error)
|
334 |
+
{
|
335 |
+
return constant('\Genesis\API\Constants\Errors::' . $error);
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Get detailed description of the provided error code
|
340 |
+
*
|
341 |
+
* @param int $errorCode
|
342 |
+
*
|
343 |
+
* @return string
|
344 |
+
*/
|
345 |
+
public static function getErrorDescription($errorCode)
|
346 |
+
{
|
347 |
+
switch (intval($errorCode)) {
|
348 |
+
default:
|
349 |
+
case 001:
|
350 |
+
return 'Undefined error.';
|
351 |
+
case 100:
|
352 |
+
return 'A general system error occurred.';
|
353 |
+
case 101:
|
354 |
+
return 'System is undergoing maintenance, request could not be handled.';
|
355 |
+
case 110:
|
356 |
+
return 'Login failed. Check your API credentials.';
|
357 |
+
case 120:
|
358 |
+
return 'Config error occurred, e.g. terminal not configured properly. Check terminal settings.';
|
359 |
+
case 200:
|
360 |
+
return 'Communication with issuer failed, please contact support.';
|
361 |
+
case 210:
|
362 |
+
return 'Connection to issuer could not be established, please contact support.';
|
363 |
+
case 220:
|
364 |
+
return 'Issuer account data invalid, please contact support.';
|
365 |
+
case 230:
|
366 |
+
return 'Issuer does not respond within given time-frame - please reconcile.';
|
367 |
+
case 240:
|
368 |
+
return 'Issuer returned invalid response - please reconcile and contact support.';
|
369 |
+
case 250:
|
370 |
+
return 'Issuer response could not be parsed - please reconcile and contact support.';
|
371 |
+
case 300:
|
372 |
+
return 'Invalid were data sent to the API.';
|
373 |
+
case 310:
|
374 |
+
return 'Invalid transaction type was passed to API.';
|
375 |
+
case 320:
|
376 |
+
return 'Required argument is missing.';
|
377 |
+
case 330:
|
378 |
+
return 'Argument passed in invalid format.';
|
379 |
+
case 340:
|
380 |
+
return 'Argument passed in valid format but makes no sense (e.g. incorrect country code or currency).';
|
381 |
+
case 350:
|
382 |
+
return 'The input Builder could not be parsed due to invalid code.';
|
383 |
+
case 400:
|
384 |
+
return 'A transaction was triggered that is not possible at this time in the workflow,' .
|
385 |
+
'e.g. a refund on a declined transaction.';
|
386 |
+
case 410:
|
387 |
+
return 'Reference transaction was not found.';
|
388 |
+
case 420:
|
389 |
+
return 'Wrong Workflow specified.';
|
390 |
+
case 430:
|
391 |
+
return 'Reference transaction already invalidated!';
|
392 |
+
case 440:
|
393 |
+
return 'Data mismatch with reference, e.g. amount exceeds reference.';
|
394 |
+
case 450:
|
395 |
+
return 'Transaction doublet was detected, transaction was blocked.';
|
396 |
+
case 460:
|
397 |
+
return 'The referenced transaction could not be found.';
|
398 |
+
case 500:
|
399 |
+
return 'Transaction declined by issuer.';
|
400 |
+
case 510:
|
401 |
+
return 'Transaction declined, Credit card number is invalid.';
|
402 |
+
case 520:
|
403 |
+
return 'Transaction declined, expiration date not in the future or date invalid.';
|
404 |
+
case 530:
|
405 |
+
return 'Transaction pending.';
|
406 |
+
case 540:
|
407 |
+
return 'Amount exceeds credit card limit.';
|
408 |
+
case 600:
|
409 |
+
return 'Transaction declined by risk management.';
|
410 |
+
case 609:
|
411 |
+
return 'Card bin does not match billing country.';
|
412 |
+
case 610:
|
413 |
+
return 'Card is blacklisted.';
|
414 |
+
case 611:
|
415 |
+
return 'BIN blacklisted.';
|
416 |
+
case 612:
|
417 |
+
return 'Country blacklisted.';
|
418 |
+
case 613:
|
419 |
+
return 'IP address blacklisted.';
|
420 |
+
case 614:
|
421 |
+
return 'Value from the Transaction Request or Risk Parameters is blacklisted.';
|
422 |
+
case 616:
|
423 |
+
return 'PAN Whitelist Filter blocked the transaction.';
|
424 |
+
case 620:
|
425 |
+
return 'Card limit exceeded configured limits.';
|
426 |
+
case 621:
|
427 |
+
return 'Terminal limits exceeded.';
|
428 |
+
case 622:
|
429 |
+
return 'MID limits exceeded.';
|
430 |
+
case 623:
|
431 |
+
return 'Velocity by unknown card exceeded!';
|
432 |
+
case 624:
|
433 |
+
return 'Ticket size by unknown card exceeded!';
|
434 |
+
case 625:
|
435 |
+
return 'User limit exceeded configured limits.';
|
436 |
+
case 626:
|
437 |
+
return 'Found user transaction declined by issuer.';
|
438 |
+
case 627:
|
439 |
+
return 'CrossSelling Error!';
|
440 |
+
case 628:
|
441 |
+
return 'Amount/count by recurring subscription exceeded.';
|
442 |
+
case 629:
|
443 |
+
return 'Address Verification failed.';
|
444 |
+
case 691:
|
445 |
+
return 'MaxMind High Risk Error.';
|
446 |
+
case 692:
|
447 |
+
return 'ThreatMetrix High Risk Error.';
|
448 |
+
case 900:
|
449 |
+
return 'Some error occurred on the issuer.';
|
450 |
+
case 910:
|
451 |
+
return 'Some error occurred on the issuer.';
|
452 |
+
case 920:
|
453 |
+
return 'Issuer configuration error.';
|
454 |
+
case 930:
|
455 |
+
return 'Some passed data caused an error on the issuer.';
|
456 |
+
case 940:
|
457 |
+
return 'Remote workflow error.';
|
458 |
+
case 950:
|
459 |
+
return 'Issuer has time-out with clearing network.';
|
460 |
+
case 960:
|
461 |
+
return 'Issuer could not reach clearing network.';
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Resolve Issuer Response Code
|
467 |
+
*
|
468 |
+
* @param $issuerResponseCode
|
469 |
+
*
|
470 |
+
* @return bool|string
|
471 |
+
*/
|
472 |
+
public static function getIssuerResponseCode($issuerResponseCode)
|
473 |
+
{
|
474 |
+
switch (strval($issuerResponseCode)) {
|
475 |
+
case '00':
|
476 |
+
return 'Approved or completed successfully';
|
477 |
+
case '02':
|
478 |
+
return 'Refer to card issue';
|
479 |
+
case '03':
|
480 |
+
return 'Invalid merchant';
|
481 |
+
case '04':
|
482 |
+
case '05':
|
483 |
+
return 'Do not honour';
|
484 |
+
case '06':
|
485 |
+
return 'Invalid Transaction for Terminal';
|
486 |
+
case '07':
|
487 |
+
return 'Honour with ID';
|
488 |
+
case '08':
|
489 |
+
return 'Time-Out';
|
490 |
+
case '09':
|
491 |
+
return 'No Original';
|
492 |
+
case '10':
|
493 |
+
return 'Unable to Reverse';
|
494 |
+
case '11':
|
495 |
+
return 'Partial Approval';
|
496 |
+
case '12':
|
497 |
+
return 'Invalid transaction card / issuer / acquirer';
|
498 |
+
case '13':
|
499 |
+
return 'Invalid amount';
|
500 |
+
case '14':
|
501 |
+
return 'Invalid card number';
|
502 |
+
case '17':
|
503 |
+
return 'Invalid Capture date (terminal business date)';
|
504 |
+
case '19':
|
505 |
+
return 'System Error; Re-enter transaction';
|
506 |
+
case '20':
|
507 |
+
return 'No From Account';
|
508 |
+
case '21':
|
509 |
+
return 'No To Account';
|
510 |
+
case '22':
|
511 |
+
return 'No Checking Account';
|
512 |
+
case '23':
|
513 |
+
return 'No Saving Account';
|
514 |
+
case '24':
|
515 |
+
return 'No Credit Account';
|
516 |
+
case '30':
|
517 |
+
return 'Format error';
|
518 |
+
case '34':
|
519 |
+
return 'Implausible card data';
|
520 |
+
case '39':
|
521 |
+
return 'Transaction Not Allowed';
|
522 |
+
case '41':
|
523 |
+
return 'Pick-up card';
|
524 |
+
case '42':
|
525 |
+
return 'Special Pickup';
|
526 |
+
case '43':
|
527 |
+
return 'Hot Card, Pickup (if possible)';
|
528 |
+
case '44':
|
529 |
+
return 'Pickup Card';
|
530 |
+
case '45':
|
531 |
+
return 'Transaction Back Off';
|
532 |
+
case '51':
|
533 |
+
return 'Not sufficient funds';
|
534 |
+
case '54':
|
535 |
+
return 'Expired card';
|
536 |
+
case '55':
|
537 |
+
return 'Incorrect PIN; Re-enter';
|
538 |
+
case '57':
|
539 |
+
return 'Not permitted on card';
|
540 |
+
case '58':
|
541 |
+
return 'Txn Not Permitted On Term';
|
542 |
+
case '61':
|
543 |
+
return 'Exceeds amount limit';
|
544 |
+
case '62':
|
545 |
+
return 'Restricted card';
|
546 |
+
case '63':
|
547 |
+
return 'MAC Key Error';
|
548 |
+
case '65':
|
549 |
+
return 'Exceeds frequency limit';
|
550 |
+
case '66':
|
551 |
+
return 'Exceeds Acquirer Limit';
|
552 |
+
case '67':
|
553 |
+
return 'Retain Card; no reason specified';
|
554 |
+
case '68':
|
555 |
+
return 'Response received too late';
|
556 |
+
case '75':
|
557 |
+
return 'Exceeds PIN Retry';
|
558 |
+
case '76':
|
559 |
+
return 'Invalid Account';
|
560 |
+
case '77':
|
561 |
+
return 'Issuer Does Not Participate In The Service';
|
562 |
+
case '78':
|
563 |
+
return 'Function Not Available';
|
564 |
+
case '79':
|
565 |
+
return 'Key Validation Error';
|
566 |
+
case '80':
|
567 |
+
return 'Approval for Purchase Amount Only';
|
568 |
+
case '81':
|
569 |
+
return 'Unable to Verify PIN';
|
570 |
+
case '82':
|
571 |
+
return 'Invalid Card Verification Value';
|
572 |
+
case '83':
|
573 |
+
return 'Not declined (AVS Only)';
|
574 |
+
case '84':
|
575 |
+
return 'Invalid Life Cycle of transaction';
|
576 |
+
case '85':
|
577 |
+
return 'No Keys To Use';
|
578 |
+
case '86':
|
579 |
+
return 'K M E Sync Error';
|
580 |
+
case '87':
|
581 |
+
return 'PIN Key Error';
|
582 |
+
case '88':
|
583 |
+
return 'MAC sync Error';
|
584 |
+
case '89':
|
585 |
+
return 'Security Violation';
|
586 |
+
case '91':
|
587 |
+
return 'Issuer not available';
|
588 |
+
case '92':
|
589 |
+
return 'Invalid Issuer';
|
590 |
+
case '93':
|
591 |
+
return 'Transaction cannot be completed';
|
592 |
+
case '94':
|
593 |
+
return 'Invalid originator';
|
594 |
+
case '96':
|
595 |
+
return 'System malfunction';
|
596 |
+
case '97':
|
597 |
+
return 'No Funds Transfer';
|
598 |
+
case '98':
|
599 |
+
return 'Duplicate Reversal';
|
600 |
+
case '99':
|
601 |
+
return 'Duplicate Transaction';
|
602 |
+
case 'N3':
|
603 |
+
return 'Cash Service Not Available';
|
604 |
+
case 'N4':
|
605 |
+
return 'Cash Back Request Exceeds Issuer Limit';
|
606 |
+
case 'N7':
|
607 |
+
return 'CVV2 Failure';
|
608 |
+
case 'R0':
|
609 |
+
return 'Stop Payment Order';
|
610 |
+
case 'R1':
|
611 |
+
return 'Revocation of Authorisation Order';
|
612 |
+
case 'R3':
|
613 |
+
return 'Revocation of all Authorisations Order';
|
614 |
+
}
|
615 |
+
|
616 |
+
return false;
|
617 |
+
}
|
618 |
+
}
|
lib/Genesis/src/Genesis/API/Constants/Payment/Methods.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Constants\Payment;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Methods
|
27 |
+
*
|
28 |
+
* Payment methods for Genesis Transactions
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Constants\Transaction
|
31 |
+
*/
|
32 |
+
class Methods
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* e-payment standard
|
36 |
+
*
|
37 |
+
* PPRO transaction
|
38 |
+
*/
|
39 |
+
const EPS = 'eps';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* GiroPay
|
43 |
+
*
|
44 |
+
* PPRO transaction
|
45 |
+
*/
|
46 |
+
const GIRO_PAY = 'giropay';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* iDEAL
|
50 |
+
*
|
51 |
+
* PPRO transaction
|
52 |
+
*/
|
53 |
+
const IDEAL = 'ideal';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Przelewy24
|
57 |
+
*
|
58 |
+
* PPRO transaction
|
59 |
+
*/
|
60 |
+
const PRZELEWY24 = 'przelewy24';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* QIWI
|
64 |
+
*
|
65 |
+
* PPRO transaction
|
66 |
+
*/
|
67 |
+
const QIWI = 'qiwi';
|
68 |
+
|
69 |
+
/**
|
70 |
+
* SafetyPay
|
71 |
+
*
|
72 |
+
* PPRO transaction
|
73 |
+
*/
|
74 |
+
const SAFETY_PAY = 'safetypay';
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Teleingreso
|
78 |
+
*
|
79 |
+
* PPRO transaction
|
80 |
+
*/
|
81 |
+
const TELEINGRESO = 'teleingreso';
|
82 |
+
|
83 |
+
/**
|
84 |
+
* TrustPay
|
85 |
+
*
|
86 |
+
* PPRO transaction
|
87 |
+
*/
|
88 |
+
const TRUST_PAY = 'trustpay';
|
89 |
+
}
|
lib/Genesis/src/Genesis/API/Constants/Transaction/States.php
ADDED
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Constants\Transaction;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class States
|
27 |
+
*
|
28 |
+
* Transaction states of a Genesis Transaction
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Constants\Transaction
|
31 |
+
*
|
32 |
+
* @method bool isApproved()
|
33 |
+
* @method bool isDeclined()
|
34 |
+
* @method bool isPending()
|
35 |
+
* @method bool isPendingAsync()
|
36 |
+
* @method bool isError()
|
37 |
+
* @method bool isRefunded()
|
38 |
+
* @method bool isVoided()
|
39 |
+
*/
|
40 |
+
class States
|
41 |
+
{
|
42 |
+
/**
|
43 |
+
* Transaction was approved by the schemes and is successful.
|
44 |
+
*/
|
45 |
+
const APPROVED = 'approved';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Transaction was declined by the schemes or risk management.
|
49 |
+
*/
|
50 |
+
const DECLINED = 'declined';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* The outcome of the transaction could not be determined, e.g. at a timeout situation.
|
54 |
+
*
|
55 |
+
* Transaction state will eventually change, so make a reconcile after a certain time frame.
|
56 |
+
*/
|
57 |
+
const PENDING = 'pending';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* An asynchronous transaction (3-D secure payment) has been initiated and is waiting for user
|
61 |
+
* input.
|
62 |
+
*
|
63 |
+
* Updates of this state will be sent to the notification url specified in request.
|
64 |
+
*/
|
65 |
+
const PENDING_ASYNC = 'pending_async';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Transaction is in-progress
|
69 |
+
*/
|
70 |
+
const IN_PROGRESS = 'in_progress';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Once an approved transaction is refunded the state changes to refunded.
|
74 |
+
*/
|
75 |
+
const REFUNDED = 'refunded';
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Transaction was authorized, but later the merchant canceled it.
|
79 |
+
*/
|
80 |
+
const VOIDED = 'voided';
|
81 |
+
|
82 |
+
/**
|
83 |
+
* An error has occurred while negotiating with the schemes.
|
84 |
+
*/
|
85 |
+
const ERROR = 'error';
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Transaction failed, but it was not declined
|
89 |
+
*/
|
90 |
+
const UNSUCCESSFUL = 'unsuccessful';
|
91 |
+
|
92 |
+
/**
|
93 |
+
* WPF initial status
|
94 |
+
*/
|
95 |
+
const NEW_STATUS = 'new';
|
96 |
+
|
97 |
+
/**
|
98 |
+
* WPF in-progress status
|
99 |
+
*/
|
100 |
+
const USER = 'user';
|
101 |
+
|
102 |
+
/**
|
103 |
+
* WPF timeout has occurred
|
104 |
+
*/
|
105 |
+
const TIMEOUT = 'timeout';
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Once an approved transaction is chargeback the state changes to change- backed.
|
109 |
+
*
|
110 |
+
* Chargeback is the state of rejecting an accepted transaction (with funds transferred)
|
111 |
+
* by the cardholder or the issuer
|
112 |
+
*/
|
113 |
+
const CHARGEBACKED = 'chargebacked';
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Once a chargebacked transaction is charged, the state changes to charge- back reversed.
|
117 |
+
*
|
118 |
+
* Chargeback has been canceled.
|
119 |
+
*/
|
120 |
+
const CHARGEBACK_REVERSED = 'chargeback_reversed';
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Once a chargeback reversed transaction is chargebacked the state changes to pre arbitrated.
|
124 |
+
*/
|
125 |
+
const PRE_ARBITRATED = 'pre_arbitrated';
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Store the state of transaction for comparison
|
129 |
+
*
|
130 |
+
* @var string
|
131 |
+
*/
|
132 |
+
private $status;
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Set the status if one is being passed
|
136 |
+
*
|
137 |
+
* @param $status
|
138 |
+
*/
|
139 |
+
public function __construct($status = null)
|
140 |
+
{
|
141 |
+
if (!is_null($status)) {
|
142 |
+
$this->status = trim($status);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Handle "magic" calls
|
148 |
+
*
|
149 |
+
* @param $method
|
150 |
+
* @param $args
|
151 |
+
*
|
152 |
+
* @return $this|bool
|
153 |
+
*/
|
154 |
+
public function __call($method, $args)
|
155 |
+
{
|
156 |
+
list($action, $target) = \Genesis\Utils\Common::resolveDynamicMethod($method);
|
157 |
+
|
158 |
+
switch ($action) {
|
159 |
+
case 'is':
|
160 |
+
if (isset($this->status)) {
|
161 |
+
return $this->compare($target);
|
162 |
+
}
|
163 |
+
|
164 |
+
break;
|
165 |
+
default:
|
166 |
+
break;
|
167 |
+
}
|
168 |
+
|
169 |
+
return null;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Check if the status is the same passed as parameter
|
174 |
+
*
|
175 |
+
* @param $subject
|
176 |
+
*
|
177 |
+
* @return bool
|
178 |
+
*/
|
179 |
+
public function compare($subject)
|
180 |
+
{
|
181 |
+
if ($this->status == constant('self::' . strtoupper($subject))) {
|
182 |
+
return true;
|
183 |
+
}
|
184 |
+
|
185 |
+
return false;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Check whether this is a valid (known) status
|
190 |
+
*
|
191 |
+
* @return bool
|
192 |
+
*/
|
193 |
+
public function isValid()
|
194 |
+
{
|
195 |
+
$statusList = array(
|
196 |
+
self::APPROVED,
|
197 |
+
self::DECLINED,
|
198 |
+
self::PENDING,
|
199 |
+
self::PENDING_ASYNC,
|
200 |
+
self::REFUNDED,
|
201 |
+
self::VOIDED,
|
202 |
+
self::ERROR,
|
203 |
+
self::UNSUCCESSFUL,
|
204 |
+
self::IN_PROGRESS,
|
205 |
+
self::NEW_STATUS,
|
206 |
+
self::USER,
|
207 |
+
self::TIMEOUT,
|
208 |
+
self::CHARGEBACKED,
|
209 |
+
self::CHARGEBACK_REVERSED,
|
210 |
+
self::PRE_ARBITRATED,
|
211 |
+
);
|
212 |
+
|
213 |
+
if (in_array(strtolower($this->status), $statusList)) {
|
214 |
+
return true;
|
215 |
+
}
|
216 |
+
|
217 |
+
return false;
|
218 |
+
}
|
219 |
+
}
|
lib/Genesis/src/Genesis/API/Constants/Transaction/Types.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Constants\Transaction;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Types
|
27 |
+
*
|
28 |
+
* Transaction types of a Genesis Transaction
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Constants\Transaction
|
31 |
+
*/
|
32 |
+
class Types
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Address Verification
|
36 |
+
*/
|
37 |
+
const AVS = 'avs';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Account Verification
|
41 |
+
*/
|
42 |
+
const ACCOUNT_VERIFICATION = 'account_verification';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* A standard Authorization
|
46 |
+
*/
|
47 |
+
const AUTHORIZE = 'authorize';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* 3D-Secure Authorization
|
51 |
+
*/
|
52 |
+
const AUTHORIZE_3D = 'authorize3d';
|
53 |
+
|
54 |
+
/**
|
55 |
+
* A standard Sale
|
56 |
+
*/
|
57 |
+
const SALE = 'sale';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* 3D-Secure Sale
|
61 |
+
*/
|
62 |
+
const SALE_3D = 'sale3d';
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Capture settles a transaction which has been authorized before.
|
66 |
+
*/
|
67 |
+
const CAPTURE = 'capture';
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Refunds allow to return already billed amounts to customers.
|
71 |
+
*/
|
72 |
+
const REFUND = 'refund';
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Void transactions undo previous transactions.
|
76 |
+
*/
|
77 |
+
const VOID = 'void';
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Credits (also known as Credit Fund Transfer a.k.a. CFT)
|
81 |
+
*/
|
82 |
+
const CREDIT = 'credit';
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Payouts transactions
|
86 |
+
*/
|
87 |
+
const PAYOUT = 'payout';
|
88 |
+
|
89 |
+
/**
|
90 |
+
* A standard initial recurring
|
91 |
+
*/
|
92 |
+
const INIT_RECURRING_SALE = 'init_recurring_sale';
|
93 |
+
|
94 |
+
/**
|
95 |
+
* 3D-based initial recurring
|
96 |
+
*/
|
97 |
+
const INIT_RECURRING_SALE_3D = 'init_recurring_sale3d';
|
98 |
+
|
99 |
+
/**
|
100 |
+
* A RecurringSale transaction is a "repeated" transaction which follows and references an initial transaction
|
101 |
+
*/
|
102 |
+
const RECURRING_SALE = 'recurring_sale';
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Bank transfer, popular in Netherlands (via ABN)
|
106 |
+
*/
|
107 |
+
const ABNIDEAL = 'abn_ideal';
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Voucher-based payment
|
111 |
+
*/
|
112 |
+
const CASHU = 'cashu';
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Wallet-based payment
|
116 |
+
*/
|
117 |
+
const EZEEWALLET = 'ezeewallet';
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Neteller
|
121 |
+
*/
|
122 |
+
const NETELLER = 'neteller';
|
123 |
+
|
124 |
+
/**
|
125 |
+
* POLi is Australia's most popular online real time debit payment system.
|
126 |
+
*/
|
127 |
+
const POLI = 'poli';
|
128 |
+
|
129 |
+
/**
|
130 |
+
* WebMoney is a global settlement system and environment for online business activities.
|
131 |
+
*/
|
132 |
+
const WEBMONEY = 'webmoney';
|
133 |
+
|
134 |
+
/**
|
135 |
+
* PayByVouchers via oBeP
|
136 |
+
*/
|
137 |
+
const PAYBYVOUCHER_YEEPAY = 'paybyvoucher_yeepay';
|
138 |
+
|
139 |
+
/**
|
140 |
+
* PayByVouchers via Credit/Debit Cards
|
141 |
+
*/
|
142 |
+
const PAYBYVOUCHER_SALE = 'paybyvoucher_sale';
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Voucher-based payment
|
146 |
+
*/
|
147 |
+
const PAYSAFECARD = 'paysafecard';
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Supports payments via EPS, TeleIngreso, SafetyPay, TrustPay, ELV, Przelewy24, QIWI, and GiroPay
|
151 |
+
*/
|
152 |
+
const PPRO = 'ppro';
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Bank transfer payment, popular in Germany
|
156 |
+
*/
|
157 |
+
const SOFORT = 'sofort';
|
158 |
+
}
|
lib/Genesis/src/Genesis/API/Constants/i18n.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Constants;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class i18n
|
27 |
+
*
|
28 |
+
* Get internationalisation (i18n) codes
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Constants
|
31 |
+
*/
|
32 |
+
// @codingStandardsIgnoreStart
|
33 |
+
class i18n
|
34 |
+
// @codingStandardsIgnoreEnd
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Arabic locale and language
|
38 |
+
*/
|
39 |
+
const AR = 'Arabic';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Bulgarian locale and language
|
43 |
+
*/
|
44 |
+
const BG = 'Bulgarian';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* German locale and language
|
48 |
+
*/
|
49 |
+
const DE = 'German';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* English locale and language settings (this is the default)
|
53 |
+
*/
|
54 |
+
const EN = 'English';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Spanish locale and language settings
|
58 |
+
*/
|
59 |
+
const ES = 'Spanish';
|
60 |
+
|
61 |
+
/**
|
62 |
+
* French locale and language settings
|
63 |
+
*/
|
64 |
+
const FR = 'French';
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Hindu locale and language
|
68 |
+
*/
|
69 |
+
const HI = 'Hindu';
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Japanese locale and language
|
73 |
+
*/
|
74 |
+
const JA = 'Japanese';
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Icelandic locale and language
|
78 |
+
*/
|
79 |
+
const IS = 'Icelandic';
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Italian locale and language settings
|
83 |
+
*/
|
84 |
+
const IT = 'Italian';
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Dutch locale and language
|
88 |
+
*/
|
89 |
+
const NL = 'Dutch';
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Portuguese locale and language
|
93 |
+
*/
|
94 |
+
const PT = 'Portuguese';
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Polish locale and language
|
98 |
+
*/
|
99 |
+
const PL = 'Polish';
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Russian locale and language
|
103 |
+
*/
|
104 |
+
const RU = 'Russian';
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Turkish locale and language
|
108 |
+
*/
|
109 |
+
const TR = 'Turkish';
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Mandarin Chinese locale and language
|
113 |
+
*/
|
114 |
+
const ZH = 'Chinese (Mandarin)';
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Check if a language code is supported
|
118 |
+
*
|
119 |
+
* @param $languageCode
|
120 |
+
* @return string
|
121 |
+
*/
|
122 |
+
public static function isValidLanguageCode($languageCode)
|
123 |
+
{
|
124 |
+
if (@constant('self::' . strtoupper($languageCode))) {
|
125 |
+
return true;
|
126 |
+
}
|
127 |
+
|
128 |
+
return false;
|
129 |
+
}
|
130 |
+
}
|
lib/Genesis/src/Genesis/API/Notification.php
ADDED
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Notification - process/validate incoming Async notifications
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage API
|
30 |
+
*/
|
31 |
+
class Notification
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Store the Unique Id of the transaction
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
private $unique_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Store the incoming notification as an object
|
42 |
+
*
|
43 |
+
* @var \ArrayObject()
|
44 |
+
*/
|
45 |
+
private $notificationObj;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Store the reconciled response
|
49 |
+
*
|
50 |
+
* @var \stdClass
|
51 |
+
*/
|
52 |
+
private $reconciliationObj;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initialize the object with notification data
|
56 |
+
*
|
57 |
+
* @param $data
|
58 |
+
*
|
59 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
60 |
+
*/
|
61 |
+
public function __construct($data = null)
|
62 |
+
{
|
63 |
+
if (!is_null($data)) {
|
64 |
+
$this->parseNotification($data, true);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Parse and Authenticate the incoming notification from Genesis
|
70 |
+
*
|
71 |
+
* @param array $notification - Incoming notification ($_POST)
|
72 |
+
* @param bool $authenticate - Set to true if you want to validate the notification
|
73 |
+
*
|
74 |
+
* @throws \Genesis\Exceptions\InvalidArgument()
|
75 |
+
*/
|
76 |
+
public function parseNotification($notification = array(), $authenticate = true)
|
77 |
+
{
|
78 |
+
$notificationWalk = array();
|
79 |
+
|
80 |
+
array_walk($notification, function ($val, $key) use (&$notificationWalk) {
|
81 |
+
$key = trim(rawurldecode($key));
|
82 |
+
$val = trim(rawurldecode($val));
|
83 |
+
|
84 |
+
$notificationWalk[$key] = $val;
|
85 |
+
});
|
86 |
+
|
87 |
+
$notification = $notificationWalk;
|
88 |
+
|
89 |
+
$this->notificationObj = \Genesis\Utils\Common::createArrayObject($notification);
|
90 |
+
|
91 |
+
if ($this->isAPINotification()) {
|
92 |
+
$this->unique_id = (string)$this->notificationObj->unique_id;
|
93 |
+
}
|
94 |
+
|
95 |
+
if ($this->isWPFNotification()) {
|
96 |
+
$this->unique_id = (string)$this->notificationObj->wpf_unique_id;
|
97 |
+
}
|
98 |
+
|
99 |
+
if ($authenticate && !$this->isAuthentic()) {
|
100 |
+
throw new \Genesis\Exceptions\InvalidArgument('Invalid Genesis Notification!');
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Reconcile with the Payment Gateway to get the latest
|
106 |
+
* status on the transaction
|
107 |
+
*
|
108 |
+
* @throws \Genesis\Exceptions\InvalidResponse
|
109 |
+
*/
|
110 |
+
public function initReconciliation()
|
111 |
+
{
|
112 |
+
if ($this->isAPINotification()) {
|
113 |
+
$type = 'NonFinancial\Reconcile\Transaction';
|
114 |
+
} elseif ($this->isWPFNotification()) {
|
115 |
+
$type = 'WPF\Reconcile';
|
116 |
+
} else {
|
117 |
+
$type = '';
|
118 |
+
}
|
119 |
+
|
120 |
+
$request = new \Genesis\Genesis($type);
|
121 |
+
|
122 |
+
try {
|
123 |
+
$request->request()->setUniqueId($this->unique_id);
|
124 |
+
|
125 |
+
$request->execute();
|
126 |
+
} catch (\Genesis\Exceptions\ErrorAPI $api) {
|
127 |
+
// This is reconciliation, don't throw on ErrorAPI
|
128 |
+
}
|
129 |
+
|
130 |
+
return $this->reconciliationObj = $request->response()->getResponseObject();
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Verify the signature on the parsed Notification
|
135 |
+
*
|
136 |
+
* @return bool
|
137 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
138 |
+
*/
|
139 |
+
public function isAuthentic()
|
140 |
+
{
|
141 |
+
if (!isset($this->unique_id) || !isset($this->notificationObj->signature)) {
|
142 |
+
throw new \Genesis\Exceptions\InvalidArgument(
|
143 |
+
'Missing field(s), required for validation!'
|
144 |
+
);
|
145 |
+
}
|
146 |
+
|
147 |
+
$messageSig = trim($this->notificationObj->signature);
|
148 |
+
$customerPwd = trim(\Genesis\Config::getPassword());
|
149 |
+
|
150 |
+
switch (strlen($messageSig)) {
|
151 |
+
default:
|
152 |
+
case 40:
|
153 |
+
$hashType = 'sha1';
|
154 |
+
break;
|
155 |
+
case 128:
|
156 |
+
$hashType = 'sha512';
|
157 |
+
break;
|
158 |
+
}
|
159 |
+
|
160 |
+
if ($messageSig === hash($hashType, $this->unique_id . $customerPwd)) {
|
161 |
+
return true;
|
162 |
+
}
|
163 |
+
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Is this API notification?
|
169 |
+
*
|
170 |
+
* @return bool
|
171 |
+
*/
|
172 |
+
public function isAPINotification()
|
173 |
+
{
|
174 |
+
return (bool)(isset($this->notificationObj->unique_id) && !empty($this->notificationObj->unique_id));
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Is this WPF Notification?
|
179 |
+
*
|
180 |
+
* @return bool
|
181 |
+
*/
|
182 |
+
public function isWPFNotification()
|
183 |
+
{
|
184 |
+
return (bool)(isset($this->notificationObj->wpf_unique_id) && !empty($this->notificationObj->wpf_unique_id));
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Return the already parsed, notification Object
|
189 |
+
*
|
190 |
+
* @return \ArrayObject
|
191 |
+
*/
|
192 |
+
public function getNotificationObject()
|
193 |
+
{
|
194 |
+
return $this->notificationObj;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Return the reconciled object
|
199 |
+
*
|
200 |
+
* @return \stdClass
|
201 |
+
*/
|
202 |
+
public function getReconciliationObject()
|
203 |
+
{
|
204 |
+
return $this->reconciliationObj;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Generate Builder response (Echo) required for acknowledging
|
209 |
+
* Genesis's Notification
|
210 |
+
*
|
211 |
+
* @return string
|
212 |
+
*/
|
213 |
+
public function generateResponse()
|
214 |
+
{
|
215 |
+
$uniqueId = $this->isWPFNotification() ? 'wpf_unique_id' : 'unique_id';
|
216 |
+
|
217 |
+
$structure = array(
|
218 |
+
'notification_echo' => array(
|
219 |
+
$uniqueId => $this->unique_id,
|
220 |
+
)
|
221 |
+
);
|
222 |
+
|
223 |
+
$builder = new \Genesis\Builder('xml');
|
224 |
+
$builder->parseStructure($structure);
|
225 |
+
|
226 |
+
return $builder->getDocument();
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Render the Gateway response
|
231 |
+
*
|
232 |
+
* @return void
|
233 |
+
*/
|
234 |
+
public function renderResponse()
|
235 |
+
{
|
236 |
+
if (!headers_sent()) {
|
237 |
+
header('Content-type: application/xml', true);
|
238 |
+
}
|
239 |
+
|
240 |
+
echo $this->generateResponse();
|
241 |
+
}
|
242 |
+
}
|
lib/Genesis/src/Genesis/API/Request.php
ADDED
@@ -0,0 +1,444 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Request
|
27 |
+
*
|
28 |
+
* Base of every API request
|
29 |
+
*
|
30 |
+
* @package Genesis
|
31 |
+
* @subpackage API
|
32 |
+
*/
|
33 |
+
abstract class Request
|
34 |
+
{
|
35 |
+
/**
|
36 |
+
* Store Request's configuration, like URL, Request Type, Transport Layer
|
37 |
+
*
|
38 |
+
* @var \ArrayObject
|
39 |
+
*/
|
40 |
+
public $config;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Store the API Response context
|
44 |
+
* s
|
45 |
+
* @var \Genesis\API\Response
|
46 |
+
*/
|
47 |
+
public $response;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Store the Request's Tree structure
|
51 |
+
*
|
52 |
+
* @var \ArrayObject
|
53 |
+
*/
|
54 |
+
protected $treeStructure;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Store the names of the fields that are Required
|
58 |
+
*
|
59 |
+
* @var \ArrayObject
|
60 |
+
*/
|
61 |
+
protected $requiredFields;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Store the names of "conditionally" Required fields.
|
65 |
+
*
|
66 |
+
* @var \ArrayObject
|
67 |
+
*/
|
68 |
+
protected $requiredFieldsConditional;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Store group name/fields where at least on the fields
|
72 |
+
* is required
|
73 |
+
*
|
74 |
+
* @var \ArrayObject
|
75 |
+
*/
|
76 |
+
protected $requiredFieldsGroups;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Store a OR relationship between fields, whether at
|
80 |
+
* least of of them has to be filled in.
|
81 |
+
*
|
82 |
+
* @var \ArrayObject
|
83 |
+
*/
|
84 |
+
protected $requiredFieldsOR;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Store the generated Builder Body
|
88 |
+
*
|
89 |
+
* @var \Genesis\Builder
|
90 |
+
*/
|
91 |
+
protected $builderContext;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Bootstrap per-request configuration
|
95 |
+
*/
|
96 |
+
public function __construct()
|
97 |
+
{
|
98 |
+
$this->initConfiguration();
|
99 |
+
|
100 |
+
// A request might not always feature 'required' fields
|
101 |
+
if (method_exists($this, 'setRequiredFields')) {
|
102 |
+
$this->setRequiredFields();
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Convert Pascal to Camel case and set the correct property
|
108 |
+
*
|
109 |
+
* @param $method
|
110 |
+
* @param $args
|
111 |
+
*
|
112 |
+
* @return $this
|
113 |
+
*/
|
114 |
+
public function __call($method, $args)
|
115 |
+
{
|
116 |
+
list($action, $target) = \Genesis\Utils\Common::resolveDynamicMethod($method);
|
117 |
+
|
118 |
+
switch ($action) {
|
119 |
+
case 'get':
|
120 |
+
if (property_exists($this, $target)) {
|
121 |
+
return $this->$target;
|
122 |
+
}
|
123 |
+
|
124 |
+
break;
|
125 |
+
case 'set':
|
126 |
+
if (property_exists($this, $target)) {
|
127 |
+
$this->$target = trim(reset($args));
|
128 |
+
return $this;
|
129 |
+
}
|
130 |
+
|
131 |
+
break;
|
132 |
+
}
|
133 |
+
|
134 |
+
return $this;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Generate the XML output
|
139 |
+
*
|
140 |
+
* @return string - XML Document with request data
|
141 |
+
*/
|
142 |
+
public function getDocument()
|
143 |
+
{
|
144 |
+
$this->processRequestParameters();
|
145 |
+
|
146 |
+
if ($this->treeStructure instanceof \ArrayObject) {
|
147 |
+
$this->builderContext = new \Genesis\Builder();
|
148 |
+
$this->builderContext->parseStructure($this->treeStructure->getArrayCopy());
|
149 |
+
|
150 |
+
return $this->builderContext->getDocument();
|
151 |
+
}
|
152 |
+
|
153 |
+
return null;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Process Everything the variables set previously
|
158 |
+
*
|
159 |
+
* Step 1: Execute per-field actions
|
160 |
+
* Step 2: Update the Tree structure
|
161 |
+
* Step 3: Clean the empty leafs
|
162 |
+
* Step 4: Check for Required Fields
|
163 |
+
*
|
164 |
+
* @return void
|
165 |
+
*/
|
166 |
+
protected function processRequestParameters()
|
167 |
+
{
|
168 |
+
// Step 1
|
169 |
+
$this->populateStructure();
|
170 |
+
// Step 2
|
171 |
+
$this->sanitizeStructure();
|
172 |
+
// Step 3
|
173 |
+
$this->checkRequirements();
|
174 |
+
}
|
175 |
+
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Remove empty keys/values from the structure
|
179 |
+
*
|
180 |
+
* @return void
|
181 |
+
*/
|
182 |
+
protected function sanitizeStructure()
|
183 |
+
{
|
184 |
+
if ($this->treeStructure instanceof \ArrayObject) {
|
185 |
+
$this->treeStructure->exchangeArray(
|
186 |
+
\Genesis\Utils\Common::emptyValueRecursiveRemoval(
|
187 |
+
$this->treeStructure->getArrayCopy()
|
188 |
+
)
|
189 |
+
);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Perform field validation
|
195 |
+
*
|
196 |
+
* @throws \Genesis\Exceptions\ErrorParameter
|
197 |
+
* @return void
|
198 |
+
*/
|
199 |
+
protected function checkRequirements()
|
200 |
+
{
|
201 |
+
$this->verifyFieldRequirements();
|
202 |
+
|
203 |
+
$this->verifyGroupRequirements();
|
204 |
+
|
205 |
+
$this->verifyConditionalRequirements();
|
206 |
+
|
207 |
+
$this->verifyConditionalFields();
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Verify that all required fields are populated
|
212 |
+
*
|
213 |
+
* @throws \Genesis\Exceptions\ErrorParameter
|
214 |
+
*/
|
215 |
+
protected function verifyFieldRequirements()
|
216 |
+
{
|
217 |
+
if (isset($this->requiredFields)) {
|
218 |
+
$this->requiredFields->setIteratorClass('RecursiveArrayIterator');
|
219 |
+
|
220 |
+
$iterator = new \RecursiveIteratorIterator($this->requiredFields->getIterator());
|
221 |
+
|
222 |
+
foreach ($iterator as $fieldName) {
|
223 |
+
if (empty($this->$fieldName)) {
|
224 |
+
throw new \Genesis\Exceptions\ErrorParameter(
|
225 |
+
sprintf('Empty (null) required parameter: %s', $fieldName)
|
226 |
+
);
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Verify that the group fields in the request are populated
|
234 |
+
*
|
235 |
+
* @throws \Genesis\Exceptions\ErrorParameter
|
236 |
+
*/
|
237 |
+
protected function verifyGroupRequirements()
|
238 |
+
{
|
239 |
+
if (isset($this->requiredFieldsGroups)) {
|
240 |
+
$fields = $this->requiredFieldsGroups->getArrayCopy();
|
241 |
+
|
242 |
+
$emptyFlag = false;
|
243 |
+
$groupsFormatted = array();
|
244 |
+
|
245 |
+
foreach ($fields as $group => $groupFields) {
|
246 |
+
$groupsFormatted[] = sprintf(
|
247 |
+
'%s (%s)',
|
248 |
+
ucfirst($group),
|
249 |
+
implode(', ', $groupFields)
|
250 |
+
);
|
251 |
+
|
252 |
+
foreach ($groupFields as $field) {
|
253 |
+
if (!empty($this->$field)) {
|
254 |
+
$emptyFlag = true;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
if (!$emptyFlag) {
|
260 |
+
throw new \Genesis\Exceptions\ErrorParameter(
|
261 |
+
sprintf(
|
262 |
+
'One of the following group/s of field/s must be filled in: %s%s',
|
263 |
+
PHP_EOL,
|
264 |
+
implode(
|
265 |
+
PHP_EOL,
|
266 |
+
$groupsFormatted
|
267 |
+
)
|
268 |
+
),
|
269 |
+
true
|
270 |
+
);
|
271 |
+
}
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Verify that all fields (who depend on previously populated fields) are populated
|
277 |
+
*
|
278 |
+
* @throws \Genesis\Exceptions\ErrorParameter
|
279 |
+
*/
|
280 |
+
protected function verifyConditionalRequirements()
|
281 |
+
{
|
282 |
+
if (isset($this->requiredFieldsConditional)) {
|
283 |
+
$fields = $this->requiredFieldsConditional->getArrayCopy();
|
284 |
+
|
285 |
+
foreach ($fields as $fieldName => $fieldDependencies) {
|
286 |
+
if (isset($this->$fieldName) && !empty($this->$fieldName)) {
|
287 |
+
foreach ($fieldDependencies as $field) {
|
288 |
+
if (empty($this->$field)) {
|
289 |
+
throw new \Genesis\Exceptions\ErrorParameter(
|
290 |
+
sprintf(
|
291 |
+
'%s is depending on: %s, which is empty (null)!',
|
292 |
+
$fieldName,
|
293 |
+
$field
|
294 |
+
)
|
295 |
+
);
|
296 |
+
}
|
297 |
+
}
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Verify conditional requirement, where either one of the fields are populated
|
305 |
+
*
|
306 |
+
* @throws \Genesis\Exceptions\ErrorParameter
|
307 |
+
*/
|
308 |
+
protected function verifyConditionalFields()
|
309 |
+
{
|
310 |
+
if (isset($this->requiredFieldsOR)) {
|
311 |
+
$fields = $this->requiredFieldsOR->getArrayCopy();
|
312 |
+
|
313 |
+
$status = false;
|
314 |
+
|
315 |
+
foreach ($fields as $fieldName) {
|
316 |
+
if (isset($this->$fieldName) && !empty($this->$fieldName)) {
|
317 |
+
$status = true;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
if (!$status) {
|
322 |
+
throw new \Genesis\Exceptions\ErrorParameter(implode($fields));
|
323 |
+
}
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Perform a field transformation
|
329 |
+
* and return the result
|
330 |
+
*
|
331 |
+
* @param string $method
|
332 |
+
* @param array $args
|
333 |
+
* @param string $prefix
|
334 |
+
*
|
335 |
+
* @return mixed
|
336 |
+
*/
|
337 |
+
protected function transform($method, $args, $prefix = 'transform')
|
338 |
+
{
|
339 |
+
$method = $prefix . \Genesis\Utils\Common::snakeCaseToCamelCase($method);
|
340 |
+
|
341 |
+
if (method_exists($this, $method)) {
|
342 |
+
$result = call_user_func_array(array($this, $method), $args);
|
343 |
+
|
344 |
+
if ($result) {
|
345 |
+
return $result;
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
return reset($args);
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Apply transformation: Convert to Minor currency unit
|
354 |
+
*
|
355 |
+
* @param string $amount
|
356 |
+
* @param string $currency
|
357 |
+
*
|
358 |
+
* @return string
|
359 |
+
*/
|
360 |
+
protected function transformAmount($amount = '', $currency = '')
|
361 |
+
{
|
362 |
+
if (!empty($amount) && !empty($currency)) {
|
363 |
+
return \Genesis\Utils\Currency::amountToExponent($amount, $currency);
|
364 |
+
}
|
365 |
+
|
366 |
+
return false;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Setter for per-request Config
|
371 |
+
*
|
372 |
+
* @param $key - setting name
|
373 |
+
* @param $value - setting value
|
374 |
+
*
|
375 |
+
* @return void
|
376 |
+
*/
|
377 |
+
protected function setApiConfig($key, $value)
|
378 |
+
{
|
379 |
+
$this->config->offsetSet($key, $value);
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Build the complete URL for the request
|
384 |
+
*
|
385 |
+
* @param $sub String - gateway/wpf etc.
|
386 |
+
* @param $path String - path of the current request
|
387 |
+
* @param $token String - should we append the token to the end of the url
|
388 |
+
*
|
389 |
+
* @return string - complete URL
|
390 |
+
*/
|
391 |
+
protected function buildRequestURL($sub = 'gateway', $path = '', $token = '')
|
392 |
+
{
|
393 |
+
$protocol = ($this->getApiConfig('protocol')) ? $this->getApiConfig('protocol') : 'https';
|
394 |
+
|
395 |
+
$sub = \Genesis\Config::getSubDomain($sub);
|
396 |
+
|
397 |
+
$domain = \Genesis\Config::getEndpoint();
|
398 |
+
|
399 |
+
$port = ($this->getApiConfig('port')) ? $this->getApiConfig('port') : 443;
|
400 |
+
|
401 |
+
$path = ($token) ? sprintf('%s/%s/', $path, $token) : $path;
|
402 |
+
|
403 |
+
return sprintf(
|
404 |
+
'%s://%s%s:%s/%s', $protocol, $sub, $domain, $port, $path
|
405 |
+
);
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Getter for per-request Config
|
410 |
+
*
|
411 |
+
* @param $key - setting name
|
412 |
+
*
|
413 |
+
* @return mixed - contents of the specified setting
|
414 |
+
*/
|
415 |
+
public function getApiConfig($key)
|
416 |
+
{
|
417 |
+
return $this->config->offsetGet($key);
|
418 |
+
}
|
419 |
+
|
420 |
+
/**
|
421 |
+
* Initialize per-request configuration
|
422 |
+
*/
|
423 |
+
protected function initConfiguration()
|
424 |
+
{
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Set the *required fields for the request
|
430 |
+
*/
|
431 |
+
protected function setRequiredFields()
|
432 |
+
{
|
433 |
+
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Create the Tree structure and populate
|
438 |
+
* the fields with the set parameters.
|
439 |
+
*/
|
440 |
+
protected function populateStructure()
|
441 |
+
{
|
442 |
+
|
443 |
+
}
|
444 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/ABNiDEAL.php
ADDED
@@ -0,0 +1,399 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Alternatives;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class ABNiDEAL
|
27 |
+
*
|
28 |
+
* Alternative payment method for The Netherlands
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Alternatives
|
31 |
+
*/
|
32 |
+
class ABNiDEAL extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by mer-chant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Description of the transaction for later use
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $usage;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* IPv4 address of customer
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $remote_ip;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* URL where customer is sent to after successful payment
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $return_success_url;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* URL where customer is sent to after un-successful payment
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $return_failure_url;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Amount of transaction in minor currency unit
|
71 |
+
*
|
72 |
+
* @var int
|
73 |
+
*/
|
74 |
+
protected $amount;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Currency code in ISO-4217
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $currency;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Email address of the Customer
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
*/
|
88 |
+
protected $customer_email;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Phone number of the customer
|
92 |
+
*
|
93 |
+
* @var string
|
94 |
+
*/
|
95 |
+
protected $customer_phone;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* The bank id of the bank where the customer resides
|
99 |
+
*
|
100 |
+
* @see Documentation for ABN iDEAL API
|
101 |
+
*
|
102 |
+
* @var string
|
103 |
+
*/
|
104 |
+
protected $customer_bank_id;
|
105 |
+
|
106 |
+
/**
|
107 |
+
*Customer's Billing Address: First name
|
108 |
+
*
|
109 |
+
* @var string
|
110 |
+
*/
|
111 |
+
protected $billing_first_name;
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Customer's Billing Address: Last name
|
115 |
+
*
|
116 |
+
* @var string
|
117 |
+
*/
|
118 |
+
protected $billing_last_name;
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Customer's Billing Address: Part 1
|
122 |
+
*
|
123 |
+
* @var string
|
124 |
+
*/
|
125 |
+
protected $billing_address1;
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Customer's Billing Address: Part 2
|
129 |
+
* @var string
|
130 |
+
*/
|
131 |
+
protected $billing_address2;
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Customer's Billing Address: ZIP
|
135 |
+
*
|
136 |
+
* @var string
|
137 |
+
*/
|
138 |
+
protected $billing_zip_code;
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Customer's Billing Address: City
|
142 |
+
*
|
143 |
+
* @var string
|
144 |
+
*/
|
145 |
+
protected $billing_city;
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Customer's Billing Address: State
|
149 |
+
*
|
150 |
+
* format: ISO-3166-2
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $billing_state;
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Customer's Billing Address: Country
|
158 |
+
*
|
159 |
+
* format: ISO-3166
|
160 |
+
*
|
161 |
+
* @var string
|
162 |
+
*/
|
163 |
+
protected $billing_country;
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Customer's Shipping Address: First name
|
167 |
+
*
|
168 |
+
* @var string
|
169 |
+
*/
|
170 |
+
protected $shipping_first_name;
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Customer's Shipping Address: Last name
|
174 |
+
*
|
175 |
+
* @var string
|
176 |
+
*/
|
177 |
+
protected $shipping_last_name;
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Customer's Shipping Address: Part 1
|
181 |
+
*
|
182 |
+
* @var string
|
183 |
+
*/
|
184 |
+
protected $shipping_address1;
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Customer's Shipping Address: Part 2
|
188 |
+
*
|
189 |
+
* @var string
|
190 |
+
*/
|
191 |
+
protected $shipping_address2;
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Customer's Shipping Address: ZIP
|
195 |
+
*
|
196 |
+
* @var string
|
197 |
+
*/
|
198 |
+
protected $shipping_zip_code;
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Customer's Shipping Address: City
|
202 |
+
*
|
203 |
+
* @var string
|
204 |
+
*/
|
205 |
+
protected $shipping_city;
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Customer's Shipping Address: State
|
209 |
+
*
|
210 |
+
* format: ISO-3166-2
|
211 |
+
*
|
212 |
+
* @var string
|
213 |
+
*/
|
214 |
+
protected $shipping_state;
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Customer's Shipping Address
|
218 |
+
*
|
219 |
+
* format: ISO-3166
|
220 |
+
*
|
221 |
+
* @var string
|
222 |
+
*/
|
223 |
+
protected $shipping_country;
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Social Security number or equivalent value for non US customers.
|
227 |
+
*
|
228 |
+
* @var string
|
229 |
+
*/
|
230 |
+
protected $risk_ssn;
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Customer's MAC address
|
234 |
+
*
|
235 |
+
* @var string
|
236 |
+
*/
|
237 |
+
protected $risk_mac_address;
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Customer's Session Id
|
241 |
+
*
|
242 |
+
* @var string
|
243 |
+
*/
|
244 |
+
protected $risk_session_id;
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Customer's User Id
|
248 |
+
*
|
249 |
+
* @var string
|
250 |
+
*/
|
251 |
+
protected $risk_user_id;
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Customer's User Level
|
255 |
+
*
|
256 |
+
* @var string
|
257 |
+
*/
|
258 |
+
protected $risk_user_level;
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Customer's Email address
|
262 |
+
*
|
263 |
+
* @note Set here if different from
|
264 |
+
* shipping / billing
|
265 |
+
*
|
266 |
+
* @var string
|
267 |
+
*/
|
268 |
+
protected $risk_email;
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Customer's Phone number
|
272 |
+
*
|
273 |
+
* @note Set here if different from
|
274 |
+
* shipping / billing
|
275 |
+
*
|
276 |
+
* @var string
|
277 |
+
*/
|
278 |
+
protected $risk_phone;
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Customer's IP address
|
282 |
+
*
|
283 |
+
* @note Set here if different from remote_ip
|
284 |
+
*
|
285 |
+
* @var string
|
286 |
+
*/
|
287 |
+
protected $risk_remote_ip;
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Customer's Serial Number
|
291 |
+
*
|
292 |
+
* @var string
|
293 |
+
*/
|
294 |
+
protected $risk_serial_number;
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Set the per-request configuration
|
298 |
+
*
|
299 |
+
* @return void
|
300 |
+
*/
|
301 |
+
protected function initConfiguration()
|
302 |
+
{
|
303 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
304 |
+
array(
|
305 |
+
'protocol' => 'https',
|
306 |
+
'port' => 443,
|
307 |
+
'type' => 'POST',
|
308 |
+
'format' => 'xml',
|
309 |
+
)
|
310 |
+
);
|
311 |
+
|
312 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Set the required fields
|
317 |
+
*
|
318 |
+
* @return void
|
319 |
+
*/
|
320 |
+
protected function setRequiredFields()
|
321 |
+
{
|
322 |
+
$requiredFields = array(
|
323 |
+
'transaction_id',
|
324 |
+
'remote_ip',
|
325 |
+
'amount',
|
326 |
+
'currency',
|
327 |
+
'return_success_url',
|
328 |
+
'return_failure_url',
|
329 |
+
'customer_email',
|
330 |
+
'customer_bank_id',
|
331 |
+
'billing_country'
|
332 |
+
);
|
333 |
+
|
334 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Create the request's Tree structure
|
339 |
+
*
|
340 |
+
* @return void
|
341 |
+
*/
|
342 |
+
protected function populateStructure()
|
343 |
+
{
|
344 |
+
$treeStructure = array(
|
345 |
+
'payment_transaction' => array(
|
346 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::ABNIDEAL,
|
347 |
+
'transaction_id' => $this->transaction_id,
|
348 |
+
'usage' => $this->usage,
|
349 |
+
'remote_ip' => $this->remote_ip,
|
350 |
+
'return_success_url' => $this->return_success_url,
|
351 |
+
'return_failure_url' => $this->return_failure_url,
|
352 |
+
'amount' => $this->transform(
|
353 |
+
'amount',
|
354 |
+
array(
|
355 |
+
$this->amount,
|
356 |
+
$this->currency,
|
357 |
+
)
|
358 |
+
),
|
359 |
+
'currency' => $this->currency,
|
360 |
+
'customer_email' => $this->customer_email,
|
361 |
+
'customer_phone' => $this->customer_phone,
|
362 |
+
'customer_bank_id' => $this->customer_bank_id,
|
363 |
+
'billing_address' => array(
|
364 |
+
'first_name' => $this->billing_first_name,
|
365 |
+
'last_name' => $this->billing_last_name,
|
366 |
+
'address1' => $this->billing_address1,
|
367 |
+
'address2' => $this->billing_address2,
|
368 |
+
'zip_code' => $this->billing_zip_code,
|
369 |
+
'city' => $this->billing_city,
|
370 |
+
'state' => $this->billing_state,
|
371 |
+
'country' => $this->billing_country,
|
372 |
+
),
|
373 |
+
'shipping_address' => array(
|
374 |
+
'first_name' => $this->shipping_first_name,
|
375 |
+
'last_name' => $this->shipping_last_name,
|
376 |
+
'address1' => $this->shipping_address1,
|
377 |
+
'address2' => $this->shipping_address2,
|
378 |
+
'zip_code' => $this->shipping_zip_code,
|
379 |
+
'city' => $this->shipping_city,
|
380 |
+
'state' => $this->shipping_state,
|
381 |
+
'country' => $this->shipping_country,
|
382 |
+
),
|
383 |
+
'risk_params' => array(
|
384 |
+
'ssn' => $this->risk_ssn,
|
385 |
+
'mac_address' => $this->risk_mac_address,
|
386 |
+
'session_id' => $this->risk_session_id,
|
387 |
+
'user_id' => $this->risk_user_id,
|
388 |
+
'user_level' => $this->risk_user_level,
|
389 |
+
'email' => $this->risk_email,
|
390 |
+
'phone' => $this->risk_phone,
|
391 |
+
'remote_ip' => $this->risk_remote_ip,
|
392 |
+
'serial_number' => $this->risk_serial_number,
|
393 |
+
),
|
394 |
+
)
|
395 |
+
);
|
396 |
+
|
397 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
398 |
+
}
|
399 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/CashU.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Alternatives;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class CashU
|
27 |
+
*
|
28 |
+
* Alternative payment method
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Alternatives
|
31 |
+
*/
|
32 |
+
class CashU extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by mer-chant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Description of the transaction for later use
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $usage;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* IPv4 address of customer
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $remote_ip;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* URL where customer is sent to after successful payment
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $return_success_url;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* URL where customer is sent to after un-successful payment
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $return_failure_url;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Amount of transaction in minor currency unit
|
71 |
+
*
|
72 |
+
* @var int
|
73 |
+
*/
|
74 |
+
protected $amount;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Currency code in ISO-4217
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $currency;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Email address of the Customer
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
*/
|
88 |
+
protected $customer_email;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Phone number of the customer
|
92 |
+
*
|
93 |
+
* @var string
|
94 |
+
*/
|
95 |
+
protected $customer_phone;
|
96 |
+
|
97 |
+
/**
|
98 |
+
*Customer's Billing Address: First name
|
99 |
+
*
|
100 |
+
* @var string
|
101 |
+
*/
|
102 |
+
protected $billing_first_name;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Customer's Billing Address: Last name
|
106 |
+
*
|
107 |
+
* @var string
|
108 |
+
*/
|
109 |
+
protected $billing_last_name;
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Customer's Billing Address: Part 1
|
113 |
+
*
|
114 |
+
* @var string
|
115 |
+
*/
|
116 |
+
protected $billing_address1;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Customer's Billing Address: Part 2
|
120 |
+
* @var string
|
121 |
+
*/
|
122 |
+
protected $billing_address2;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Customer's Billing Address: ZIP
|
126 |
+
*
|
127 |
+
* @var string
|
128 |
+
*/
|
129 |
+
protected $billing_zip_code;
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Customer's Billing Address: City
|
133 |
+
*
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
protected $billing_city;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Customer's Billing Address: State
|
140 |
+
*
|
141 |
+
* format: ISO-3166-2
|
142 |
+
*
|
143 |
+
* @var string
|
144 |
+
*/
|
145 |
+
protected $billing_state;
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Customer's Billing Address: Country
|
149 |
+
*
|
150 |
+
* format: ISO-3166
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $billing_country;
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Customer's Shipping Address: First name
|
158 |
+
*
|
159 |
+
* @var string
|
160 |
+
*/
|
161 |
+
protected $shipping_first_name;
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Customer's Shipping Address: Last name
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $shipping_last_name;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Shipping Address: Part 1
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $shipping_address1;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Shipping Address: Part 2
|
179 |
+
*
|
180 |
+
* @var string
|
181 |
+
*/
|
182 |
+
protected $shipping_address2;
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Customer's Shipping Address: ZIP
|
186 |
+
*
|
187 |
+
* @var string
|
188 |
+
*/
|
189 |
+
protected $shipping_zip_code;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Customer's Shipping Address: City
|
193 |
+
*
|
194 |
+
* @var string
|
195 |
+
*/
|
196 |
+
protected $shipping_city;
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Customer's Shipping Address: State
|
200 |
+
*
|
201 |
+
* format: ISO-3166-2
|
202 |
+
*
|
203 |
+
* @var string
|
204 |
+
*/
|
205 |
+
protected $shipping_state;
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Customer's Shipping Address
|
209 |
+
*
|
210 |
+
* format: ISO-3166
|
211 |
+
*
|
212 |
+
* @var string
|
213 |
+
*/
|
214 |
+
protected $shipping_country;
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Social Security number or equivalent value for non US customers.
|
218 |
+
*
|
219 |
+
* @var string
|
220 |
+
*/
|
221 |
+
protected $risk_ssn;
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Customer's MAC address
|
225 |
+
*
|
226 |
+
* @var string
|
227 |
+
*/
|
228 |
+
protected $risk_mac_address;
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Customer's Session Id
|
232 |
+
*
|
233 |
+
* @var string
|
234 |
+
*/
|
235 |
+
protected $risk_session_id;
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Customer's User Id
|
239 |
+
*
|
240 |
+
* @var string
|
241 |
+
*/
|
242 |
+
protected $risk_user_id;
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Customer's User Level
|
246 |
+
*
|
247 |
+
* @var string
|
248 |
+
*/
|
249 |
+
protected $risk_user_level;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Customer's Email address
|
253 |
+
*
|
254 |
+
* @note Set here if different from
|
255 |
+
* shipping / billing
|
256 |
+
*
|
257 |
+
* @var string
|
258 |
+
*/
|
259 |
+
protected $risk_email;
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Customer's Phone number
|
263 |
+
*
|
264 |
+
* @note Set here if different from
|
265 |
+
* shipping / billing
|
266 |
+
*
|
267 |
+
* @var string
|
268 |
+
*/
|
269 |
+
protected $risk_phone;
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Customer's IP address
|
273 |
+
*
|
274 |
+
* @note Set here if different from remote_ip
|
275 |
+
*
|
276 |
+
* @var string
|
277 |
+
*/
|
278 |
+
protected $risk_remote_ip;
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Customer's Serial Number
|
282 |
+
*
|
283 |
+
* @var string
|
284 |
+
*/
|
285 |
+
protected $risk_serial_number;
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Set the per-request configuration
|
289 |
+
*
|
290 |
+
* @return void
|
291 |
+
*/
|
292 |
+
protected function initConfiguration()
|
293 |
+
{
|
294 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
295 |
+
array(
|
296 |
+
'protocol' => 'https',
|
297 |
+
'port' => 443,
|
298 |
+
'type' => 'POST',
|
299 |
+
'format' => 'xml',
|
300 |
+
)
|
301 |
+
);
|
302 |
+
|
303 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Set the required fields
|
308 |
+
*
|
309 |
+
* @return void
|
310 |
+
*/
|
311 |
+
protected function setRequiredFields()
|
312 |
+
{
|
313 |
+
$requiredFields = array(
|
314 |
+
'transaction_id',
|
315 |
+
'remote_ip',
|
316 |
+
'amount',
|
317 |
+
'currency',
|
318 |
+
'return_success_url',
|
319 |
+
'return_failure_url',
|
320 |
+
'customer_email',
|
321 |
+
);
|
322 |
+
|
323 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Create the request's Tree structure
|
328 |
+
*
|
329 |
+
* @return void
|
330 |
+
*/
|
331 |
+
protected function populateStructure()
|
332 |
+
{
|
333 |
+
$treeStructure = array(
|
334 |
+
'payment_transaction' => array(
|
335 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::CASHU,
|
336 |
+
'transaction_id' => $this->transaction_id,
|
337 |
+
'usage' => $this->usage,
|
338 |
+
'remote_ip' => $this->remote_ip,
|
339 |
+
'return_success_url' => $this->return_success_url,
|
340 |
+
'return_failure_url' => $this->return_failure_url,
|
341 |
+
'amount' => $this->transform(
|
342 |
+
'amount',
|
343 |
+
array(
|
344 |
+
$this->amount,
|
345 |
+
$this->currency,
|
346 |
+
)
|
347 |
+
),
|
348 |
+
'currency' => $this->currency,
|
349 |
+
'customer_email' => $this->customer_email,
|
350 |
+
'customer_phone' => $this->customer_phone,
|
351 |
+
'billing_address' => array(
|
352 |
+
'first_name' => $this->billing_first_name,
|
353 |
+
'last_name' => $this->billing_last_name,
|
354 |
+
'address1' => $this->billing_address1,
|
355 |
+
'address2' => $this->billing_address2,
|
356 |
+
'zip_code' => $this->billing_zip_code,
|
357 |
+
'city' => $this->billing_city,
|
358 |
+
'state' => $this->billing_state,
|
359 |
+
'country' => $this->billing_country,
|
360 |
+
),
|
361 |
+
'shipping_address' => array(
|
362 |
+
'first_name' => $this->shipping_first_name,
|
363 |
+
'last_name' => $this->shipping_last_name,
|
364 |
+
'address1' => $this->shipping_address1,
|
365 |
+
'address2' => $this->shipping_address2,
|
366 |
+
'zip_code' => $this->shipping_zip_code,
|
367 |
+
'city' => $this->shipping_city,
|
368 |
+
'state' => $this->shipping_state,
|
369 |
+
'country' => $this->shipping_country,
|
370 |
+
),
|
371 |
+
'risk_params' => array(
|
372 |
+
'ssn' => $this->risk_ssn,
|
373 |
+
'mac_address' => $this->risk_mac_address,
|
374 |
+
'session_id' => $this->risk_session_id,
|
375 |
+
'user_id' => $this->risk_user_id,
|
376 |
+
'user_level' => $this->risk_user_level,
|
377 |
+
'email' => $this->risk_email,
|
378 |
+
'phone' => $this->risk_phone,
|
379 |
+
'remote_ip' => $this->risk_remote_ip,
|
380 |
+
'serial_number' => $this->risk_serial_number,
|
381 |
+
),
|
382 |
+
)
|
383 |
+
);
|
384 |
+
|
385 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
386 |
+
}
|
387 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/POLi.php
ADDED
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Alternatives;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class POLi
|
27 |
+
*
|
28 |
+
* Electronic Wallet
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Wallets
|
31 |
+
*/
|
32 |
+
class POLi extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by mer-chant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Description of the transaction for later use
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $usage;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* IPv4 address of customer
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $remote_ip;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* URL where customer is sent to after successful payment
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $return_success_url;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* URL where customer is sent to after un-successful payment
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $return_failure_url;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Amount of transaction in minor currency unit
|
71 |
+
*
|
72 |
+
* @var int
|
73 |
+
*/
|
74 |
+
protected $amount;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Currency code in ISO-4217
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $currency;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Email address of the Customer
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
*/
|
88 |
+
protected $customer_email;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Phone number of the customer
|
92 |
+
*
|
93 |
+
* @var string
|
94 |
+
*/
|
95 |
+
protected $customer_phone;
|
96 |
+
|
97 |
+
/**
|
98 |
+
*Customer's Billing Address: First name
|
99 |
+
*
|
100 |
+
* @var string
|
101 |
+
*/
|
102 |
+
protected $billing_first_name;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Customer's Billing Address: Last name
|
106 |
+
*
|
107 |
+
* @var string
|
108 |
+
*/
|
109 |
+
protected $billing_last_name;
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Customer's Billing Address: Part 1
|
113 |
+
*
|
114 |
+
* @var string
|
115 |
+
*/
|
116 |
+
protected $billing_address1;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Customer's Billing Address: Part 2
|
120 |
+
* @var string
|
121 |
+
*/
|
122 |
+
protected $billing_address2;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Customer's Billing Address: ZIP
|
126 |
+
*
|
127 |
+
* @var string
|
128 |
+
*/
|
129 |
+
protected $billing_zip_code;
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Customer's Billing Address: City
|
133 |
+
*
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
protected $billing_city;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Customer's Billing Address: State
|
140 |
+
*
|
141 |
+
* format: ISO-3166-2
|
142 |
+
*
|
143 |
+
* @var string
|
144 |
+
*/
|
145 |
+
protected $billing_state;
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Customer's Billing Address: Country
|
149 |
+
*
|
150 |
+
* format: ISO-3166
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $billing_country;
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Customer's Shipping Address: First name
|
158 |
+
*
|
159 |
+
* @var string
|
160 |
+
*/
|
161 |
+
protected $shipping_first_name;
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Customer's Shipping Address: Last name
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $shipping_last_name;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Shipping Address: Part 1
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $shipping_address1;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Shipping Address: Part 2
|
179 |
+
*
|
180 |
+
* @var string
|
181 |
+
*/
|
182 |
+
protected $shipping_address2;
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Customer's Shipping Address: ZIP
|
186 |
+
*
|
187 |
+
* @var string
|
188 |
+
*/
|
189 |
+
protected $shipping_zip_code;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Customer's Shipping Address: City
|
193 |
+
*
|
194 |
+
* @var string
|
195 |
+
*/
|
196 |
+
protected $shipping_city;
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Customer's Shipping Address: State
|
200 |
+
*
|
201 |
+
* format: ISO-3166-2
|
202 |
+
*
|
203 |
+
* @var string
|
204 |
+
*/
|
205 |
+
protected $shipping_state;
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Customer's Shipping Address
|
209 |
+
*
|
210 |
+
* format: ISO-3166
|
211 |
+
*
|
212 |
+
* @var string
|
213 |
+
*/
|
214 |
+
protected $shipping_country;
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Social Security number or equivalent value for non US customers.
|
218 |
+
*
|
219 |
+
* @var string
|
220 |
+
*/
|
221 |
+
protected $risk_ssn;
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Customer's MAC address
|
225 |
+
*
|
226 |
+
* @var string
|
227 |
+
*/
|
228 |
+
protected $risk_mac_address;
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Customer's Session Id
|
232 |
+
*
|
233 |
+
* @var string
|
234 |
+
*/
|
235 |
+
protected $risk_session_id;
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Customer's User Id
|
239 |
+
*
|
240 |
+
* @var string
|
241 |
+
*/
|
242 |
+
protected $risk_user_id;
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Customer's User Level
|
246 |
+
*
|
247 |
+
* @var string
|
248 |
+
*/
|
249 |
+
protected $risk_user_level;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Customer's Email address
|
253 |
+
*
|
254 |
+
* @note Set here if different from
|
255 |
+
* shipping / billing
|
256 |
+
*
|
257 |
+
* @var string
|
258 |
+
*/
|
259 |
+
protected $risk_email;
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Customer's Phone number
|
263 |
+
*
|
264 |
+
* @note Set here if different from
|
265 |
+
* shipping / billing
|
266 |
+
*
|
267 |
+
* @var string
|
268 |
+
*/
|
269 |
+
protected $risk_phone;
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Customer's IP address
|
273 |
+
*
|
274 |
+
* @note Set here if different from remote_ip
|
275 |
+
*
|
276 |
+
* @var string
|
277 |
+
*/
|
278 |
+
protected $risk_remote_ip;
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Customer's Serial Number
|
282 |
+
*
|
283 |
+
* @var string
|
284 |
+
*/
|
285 |
+
protected $risk_serial_number;
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Set the per-request configuration
|
289 |
+
*
|
290 |
+
* @return void
|
291 |
+
*/
|
292 |
+
protected function initConfiguration()
|
293 |
+
{
|
294 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(array(
|
295 |
+
'protocol' => 'https',
|
296 |
+
'port' => 443,
|
297 |
+
'type' => 'POST',
|
298 |
+
'format' => 'xml',
|
299 |
+
));
|
300 |
+
|
301 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Set the required fields
|
306 |
+
*
|
307 |
+
* @return void
|
308 |
+
*/
|
309 |
+
protected function setRequiredFields()
|
310 |
+
{
|
311 |
+
$requiredFields = array(
|
312 |
+
'transaction_id',
|
313 |
+
'remote_ip',
|
314 |
+
'amount',
|
315 |
+
'currency',
|
316 |
+
'return_success_url',
|
317 |
+
'return_failure_url',
|
318 |
+
'customer_email',
|
319 |
+
);
|
320 |
+
|
321 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Create the request's Tree structure
|
326 |
+
*
|
327 |
+
* @return void
|
328 |
+
*/
|
329 |
+
protected function populateStructure()
|
330 |
+
{
|
331 |
+
$treeStructure = array(
|
332 |
+
'payment_transaction' => array(
|
333 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::POLI,
|
334 |
+
'transaction_id' => $this->transaction_id,
|
335 |
+
'usage' => $this->usage,
|
336 |
+
'remote_ip' => $this->remote_ip,
|
337 |
+
'return_success_url' => $this->return_success_url,
|
338 |
+
'return_failure_url' => $this->return_failure_url,
|
339 |
+
'amount' => $this->transform(
|
340 |
+
'amount',
|
341 |
+
array(
|
342 |
+
$this->amount,
|
343 |
+
$this->currency,
|
344 |
+
)
|
345 |
+
),
|
346 |
+
'currency' => $this->currency,
|
347 |
+
'customer_email' => $this->customer_email,
|
348 |
+
'customer_phone' => $this->customer_phone,
|
349 |
+
'billing_address' => array(
|
350 |
+
'first_name' => $this->billing_first_name,
|
351 |
+
'last_name' => $this->billing_last_name,
|
352 |
+
'address1' => $this->billing_address1,
|
353 |
+
'address2' => $this->billing_address2,
|
354 |
+
'zip_code' => $this->billing_zip_code,
|
355 |
+
'city' => $this->billing_city,
|
356 |
+
'state' => $this->billing_state,
|
357 |
+
'country' => $this->billing_country,
|
358 |
+
),
|
359 |
+
'shipping_address' => array(
|
360 |
+
'first_name' => $this->shipping_first_name,
|
361 |
+
'last_name' => $this->shipping_last_name,
|
362 |
+
'address1' => $this->shipping_address1,
|
363 |
+
'address2' => $this->shipping_address2,
|
364 |
+
'zip_code' => $this->shipping_zip_code,
|
365 |
+
'city' => $this->shipping_city,
|
366 |
+
'state' => $this->shipping_state,
|
367 |
+
'country' => $this->shipping_country,
|
368 |
+
),
|
369 |
+
'risk_params' => array(
|
370 |
+
'ssn' => $this->risk_ssn,
|
371 |
+
'mac_address' => $this->risk_mac_address,
|
372 |
+
'session_id' => $this->risk_session_id,
|
373 |
+
'user_id' => $this->risk_user_id,
|
374 |
+
'user_level' => $this->risk_user_level,
|
375 |
+
'email' => $this->risk_email,
|
376 |
+
'phone' => $this->risk_phone,
|
377 |
+
'remote_ip' => $this->risk_remote_ip,
|
378 |
+
'serial_number' => $this->risk_serial_number,
|
379 |
+
),
|
380 |
+
)
|
381 |
+
);
|
382 |
+
|
383 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
384 |
+
}
|
385 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/PPRO.php
ADDED
@@ -0,0 +1,457 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Alternatives;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class PPRO
|
27 |
+
*
|
28 |
+
* Alternative payment method
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Alternatives
|
31 |
+
*/
|
32 |
+
class PPRO extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by merchant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Used payment method
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $payment_type;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Description of the transaction for later use
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $usage;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* IPv4 address of customer
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $remote_ip;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Amount of transaction in minor currency unit
|
64 |
+
*
|
65 |
+
* @var int
|
66 |
+
*/
|
67 |
+
protected $amount;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Currency code in ISO-4217
|
71 |
+
*
|
72 |
+
* @var string
|
73 |
+
*/
|
74 |
+
protected $currency;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* URL where customer is sent to after successful payment
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $return_success_url;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* URL where customer is sent to after un-successful payment
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
*/
|
88 |
+
protected $return_failure_url;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Email address of the Customer
|
92 |
+
*
|
93 |
+
* @var string
|
94 |
+
*/
|
95 |
+
protected $customer_email;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Phone number of the customer
|
99 |
+
*
|
100 |
+
* @var string
|
101 |
+
*/
|
102 |
+
protected $customer_phone;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Must contain valid account number, check:
|
106 |
+
*
|
107 |
+
* "PPRO Payment Method Requirements"
|
108 |
+
*
|
109 |
+
* in the official API documentation
|
110 |
+
*
|
111 |
+
* @var string
|
112 |
+
*/
|
113 |
+
protected $account_number;
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Must contain valid bank code, check:
|
117 |
+
*
|
118 |
+
* "PPRO Payment Method Requirements"
|
119 |
+
*
|
120 |
+
* in the official API documentation
|
121 |
+
*
|
122 |
+
* @var string
|
123 |
+
*/
|
124 |
+
protected $bank_code;
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Must contain valid BIC, check:
|
128 |
+
*
|
129 |
+
* "PPRO Payment Method Requirements"
|
130 |
+
*
|
131 |
+
* in the official API documentation
|
132 |
+
*
|
133 |
+
* @var string
|
134 |
+
*/
|
135 |
+
protected $bic;
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Must contain valid IBAN, check:
|
139 |
+
*
|
140 |
+
* "PPRO Payment Method Requirements"
|
141 |
+
*
|
142 |
+
* in the official API documentation
|
143 |
+
*
|
144 |
+
* @var string
|
145 |
+
*/
|
146 |
+
protected $iban;
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Must contain valid phone number for destination account to pay out, check:
|
150 |
+
*
|
151 |
+
* "PPRO Payment Method Requirements"
|
152 |
+
*
|
153 |
+
* in the official API documentation
|
154 |
+
*
|
155 |
+
* @var string
|
156 |
+
*/
|
157 |
+
protected $account_phone;
|
158 |
+
|
159 |
+
/**
|
160 |
+
*Customer's Billing Address: First name
|
161 |
+
*
|
162 |
+
* @var string
|
163 |
+
*/
|
164 |
+
protected $billing_first_name;
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Customer's Billing Address: Last name
|
168 |
+
*
|
169 |
+
* @var string
|
170 |
+
*/
|
171 |
+
protected $billing_last_name;
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Customer's Billing Address: Part 1
|
175 |
+
*
|
176 |
+
* @var string
|
177 |
+
*/
|
178 |
+
protected $billing_address1;
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Customer's Billing Address: Part 2
|
182 |
+
* @var string
|
183 |
+
*/
|
184 |
+
protected $billing_address2;
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Customer's Billing Address: ZIP
|
188 |
+
*
|
189 |
+
* @var string
|
190 |
+
*/
|
191 |
+
protected $billing_zip_code;
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Customer's Billing Address: City
|
195 |
+
*
|
196 |
+
* @var string
|
197 |
+
*/
|
198 |
+
protected $billing_city;
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Customer's Billing Address: State
|
202 |
+
*
|
203 |
+
* format: ISO-3166-2
|
204 |
+
*
|
205 |
+
* @var string
|
206 |
+
*/
|
207 |
+
protected $billing_state;
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Customer's Billing Address: Country
|
211 |
+
*
|
212 |
+
* format: ISO-3166
|
213 |
+
*
|
214 |
+
* @var string
|
215 |
+
*/
|
216 |
+
protected $billing_country;
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Customer's Shipping Address: First name
|
220 |
+
*
|
221 |
+
* @var string
|
222 |
+
*/
|
223 |
+
protected $shipping_first_name;
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Customer's Shipping Address: Last name
|
227 |
+
*
|
228 |
+
* @var string
|
229 |
+
*/
|
230 |
+
protected $shipping_last_name;
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Customer's Shipping Address: Part 1
|
234 |
+
*
|
235 |
+
* @var string
|
236 |
+
*/
|
237 |
+
protected $shipping_address1;
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Customer's Shipping Address: Part 2
|
241 |
+
*
|
242 |
+
* @var string
|
243 |
+
*/
|
244 |
+
protected $shipping_address2;
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Customer's Shipping Address: ZIP
|
248 |
+
*
|
249 |
+
* @var string
|
250 |
+
*/
|
251 |
+
protected $shipping_zip_code;
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Customer's Shipping Address: City
|
255 |
+
*
|
256 |
+
* @var string
|
257 |
+
*/
|
258 |
+
protected $shipping_city;
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Customer's Shipping Address: State
|
262 |
+
*
|
263 |
+
* format: ISO-3166-2
|
264 |
+
*
|
265 |
+
* @var string
|
266 |
+
*/
|
267 |
+
protected $shipping_state;
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Customer's Shipping Address
|
271 |
+
*
|
272 |
+
* format: ISO-3166
|
273 |
+
*
|
274 |
+
* @var string
|
275 |
+
*/
|
276 |
+
protected $shipping_country;
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Social Security number or equivalent value for non US customers.
|
280 |
+
*
|
281 |
+
* @var string
|
282 |
+
*/
|
283 |
+
protected $risk_ssn;
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Customer's MAC address
|
287 |
+
*
|
288 |
+
* @var string
|
289 |
+
*/
|
290 |
+
protected $risk_mac_address;
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Customer's Session Id
|
294 |
+
*
|
295 |
+
* @var string
|
296 |
+
*/
|
297 |
+
protected $risk_session_id;
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Customer's User Id
|
301 |
+
*
|
302 |
+
* @var string
|
303 |
+
*/
|
304 |
+
protected $risk_user_id;
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Customer's User Level
|
308 |
+
*
|
309 |
+
* @var string
|
310 |
+
*/
|
311 |
+
protected $risk_user_level;
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Customer's Email address
|
315 |
+
*
|
316 |
+
* @note Set here if different from
|
317 |
+
* shipping / billing
|
318 |
+
*
|
319 |
+
* @var string
|
320 |
+
*/
|
321 |
+
protected $risk_email;
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Customer's Phone number
|
325 |
+
*
|
326 |
+
* @note Set here if different from
|
327 |
+
* shipping / billing
|
328 |
+
*
|
329 |
+
* @var string
|
330 |
+
*/
|
331 |
+
protected $risk_phone;
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Customer's IP address
|
335 |
+
*
|
336 |
+
* @note Set here if different from remote_ip
|
337 |
+
*
|
338 |
+
* @var string
|
339 |
+
*/
|
340 |
+
protected $risk_remote_ip;
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Customer's Serial Number
|
344 |
+
*
|
345 |
+
* @var string
|
346 |
+
*/
|
347 |
+
protected $risk_serial_number;
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Set the per-request configuration
|
351 |
+
*
|
352 |
+
* @return void
|
353 |
+
*/
|
354 |
+
protected function initConfiguration()
|
355 |
+
{
|
356 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
357 |
+
array(
|
358 |
+
'protocol' => 'https',
|
359 |
+
'port' => 443,
|
360 |
+
'type' => 'POST',
|
361 |
+
'format' => 'xml',
|
362 |
+
)
|
363 |
+
);
|
364 |
+
|
365 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Set the required fields
|
370 |
+
*
|
371 |
+
* @return void
|
372 |
+
*/
|
373 |
+
protected function setRequiredFields()
|
374 |
+
{
|
375 |
+
$requiredFields = array(
|
376 |
+
'transaction_id',
|
377 |
+
'payment_type',
|
378 |
+
'remote_ip',
|
379 |
+
'amount',
|
380 |
+
'currency',
|
381 |
+
'return_success_url',
|
382 |
+
'return_failure_url',
|
383 |
+
'customer_email',
|
384 |
+
'billing_country'
|
385 |
+
);
|
386 |
+
|
387 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Create the request's Tree structure
|
392 |
+
*
|
393 |
+
* @return void
|
394 |
+
*/
|
395 |
+
protected function populateStructure()
|
396 |
+
{
|
397 |
+
$treeStructure = array(
|
398 |
+
'payment_transaction' => array(
|
399 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PPRO,
|
400 |
+
'transaction_id' => $this->transaction_id,
|
401 |
+
'payment_type' => $this->payment_type,
|
402 |
+
'usage' => $this->usage,
|
403 |
+
'remote_ip' => $this->remote_ip,
|
404 |
+
'amount' => $this->transform(
|
405 |
+
'amount',
|
406 |
+
array(
|
407 |
+
$this->amount,
|
408 |
+
$this->currency,
|
409 |
+
)
|
410 |
+
),
|
411 |
+
'currency' => $this->currency,
|
412 |
+
'return_success_url' => $this->return_success_url,
|
413 |
+
'return_failure_url' => $this->return_failure_url,
|
414 |
+
'customer_email' => $this->customer_email,
|
415 |
+
'customer_phone' => $this->customer_phone,
|
416 |
+
'account_number' => $this->account_number,
|
417 |
+
'bank_code' => $this->bank_code,
|
418 |
+
'bic' => $this->bic,
|
419 |
+
'iban' => $this->iban,
|
420 |
+
'account_phone' => $this->account_phone,
|
421 |
+
'billing_address' => array(
|
422 |
+
'first_name' => $this->billing_first_name,
|
423 |
+
'last_name' => $this->billing_last_name,
|
424 |
+
'address1' => $this->billing_address1,
|
425 |
+
'address2' => $this->billing_address2,
|
426 |
+
'zip_code' => $this->billing_zip_code,
|
427 |
+
'city' => $this->billing_city,
|
428 |
+
'state' => $this->billing_state,
|
429 |
+
'country' => $this->billing_country,
|
430 |
+
),
|
431 |
+
'shipping_address' => array(
|
432 |
+
'first_name' => $this->shipping_first_name,
|
433 |
+
'last_name' => $this->shipping_last_name,
|
434 |
+
'address1' => $this->shipping_address1,
|
435 |
+
'address2' => $this->shipping_address2,
|
436 |
+
'zip_code' => $this->shipping_zip_code,
|
437 |
+
'city' => $this->shipping_city,
|
438 |
+
'state' => $this->shipping_state,
|
439 |
+
'country' => $this->shipping_country,
|
440 |
+
),
|
441 |
+
'risk_params' => array(
|
442 |
+
'ssn' => $this->risk_ssn,
|
443 |
+
'mac_address' => $this->risk_mac_address,
|
444 |
+
'session_id' => $this->risk_session_id,
|
445 |
+
'user_id' => $this->risk_user_id,
|
446 |
+
'user_level' => $this->risk_user_level,
|
447 |
+
'email' => $this->risk_email,
|
448 |
+
'phone' => $this->risk_phone,
|
449 |
+
'remote_ip' => $this->risk_remote_ip,
|
450 |
+
'serial_number' => $this->risk_serial_number,
|
451 |
+
),
|
452 |
+
)
|
453 |
+
);
|
454 |
+
|
455 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
456 |
+
}
|
457 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Paysafecard.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Alternatives;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Paysafecard
|
27 |
+
*
|
28 |
+
* Alternative payment method
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Alternatives
|
31 |
+
*/
|
32 |
+
class Paysafecard extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by mer-chant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Description of the transaction for later use
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $usage;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* IPv4 address of customer
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $remote_ip;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* URL where customer is sent to after successful payment
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $return_success_url;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* URL where customer is sent to after un-successful payment
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $return_failure_url;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Amount of transaction in minor currency unit
|
71 |
+
*
|
72 |
+
* @var int
|
73 |
+
*/
|
74 |
+
protected $amount;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Currency code in ISO-4217
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $currency;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Email address of the Customer
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
*/
|
88 |
+
protected $customer_email;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Phone number of the customer
|
92 |
+
*
|
93 |
+
* @var string
|
94 |
+
*/
|
95 |
+
protected $customer_phone;
|
96 |
+
|
97 |
+
/**
|
98 |
+
*Customer's Billing Address: First name
|
99 |
+
*
|
100 |
+
* @var string
|
101 |
+
*/
|
102 |
+
protected $billing_first_name;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Customer's Billing Address: Last name
|
106 |
+
*
|
107 |
+
* @var string
|
108 |
+
*/
|
109 |
+
protected $billing_last_name;
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Customer's Billing Address: Part 1
|
113 |
+
*
|
114 |
+
* @var string
|
115 |
+
*/
|
116 |
+
protected $billing_address1;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Customer's Billing Address: Part 2
|
120 |
+
* @var string
|
121 |
+
*/
|
122 |
+
protected $billing_address2;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Customer's Billing Address: ZIP
|
126 |
+
*
|
127 |
+
* @var string
|
128 |
+
*/
|
129 |
+
protected $billing_zip_code;
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Customer's Billing Address: City
|
133 |
+
*
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
protected $billing_city;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Customer's Billing Address: State
|
140 |
+
*
|
141 |
+
* format: ISO-3166-2
|
142 |
+
*
|
143 |
+
* @var string
|
144 |
+
*/
|
145 |
+
protected $billing_state;
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Customer's Billing Address: Country
|
149 |
+
*
|
150 |
+
* format: ISO-3166
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $billing_country;
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Customer's Shipping Address: First name
|
158 |
+
*
|
159 |
+
* @var string
|
160 |
+
*/
|
161 |
+
protected $shipping_first_name;
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Customer's Shipping Address: Last name
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $shipping_last_name;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Shipping Address: Part 1
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $shipping_address1;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Shipping Address: Part 2
|
179 |
+
*
|
180 |
+
* @var string
|
181 |
+
*/
|
182 |
+
protected $shipping_address2;
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Customer's Shipping Address: ZIP
|
186 |
+
*
|
187 |
+
* @var string
|
188 |
+
*/
|
189 |
+
protected $shipping_zip_code;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Customer's Shipping Address: City
|
193 |
+
*
|
194 |
+
* @var string
|
195 |
+
*/
|
196 |
+
protected $shipping_city;
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Customer's Shipping Address: State
|
200 |
+
*
|
201 |
+
* format: ISO-3166-2
|
202 |
+
*
|
203 |
+
* @var string
|
204 |
+
*/
|
205 |
+
protected $shipping_state;
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Customer's Shipping Address
|
209 |
+
*
|
210 |
+
* format: ISO-3166
|
211 |
+
*
|
212 |
+
* @var string
|
213 |
+
*/
|
214 |
+
protected $shipping_country;
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Social Security number or equivalent value for non US customers.
|
218 |
+
*
|
219 |
+
* @var string
|
220 |
+
*/
|
221 |
+
protected $risk_ssn;
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Customer's MAC address
|
225 |
+
*
|
226 |
+
* @var string
|
227 |
+
*/
|
228 |
+
protected $risk_mac_address;
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Customer's Session Id
|
232 |
+
*
|
233 |
+
* @var string
|
234 |
+
*/
|
235 |
+
protected $risk_session_id;
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Customer's User Id
|
239 |
+
*
|
240 |
+
* @var string
|
241 |
+
*/
|
242 |
+
protected $risk_user_id;
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Customer's User Level
|
246 |
+
*
|
247 |
+
* @var string
|
248 |
+
*/
|
249 |
+
protected $risk_user_level;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Customer's Email address
|
253 |
+
*
|
254 |
+
* @note Set here if different from
|
255 |
+
* shipping / billing
|
256 |
+
*
|
257 |
+
* @var string
|
258 |
+
*/
|
259 |
+
protected $risk_email;
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Customer's Phone number
|
263 |
+
*
|
264 |
+
* @note Set here if different from
|
265 |
+
* shipping / billing
|
266 |
+
*
|
267 |
+
* @var string
|
268 |
+
*/
|
269 |
+
protected $risk_phone;
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Customer's IP address
|
273 |
+
*
|
274 |
+
* @note Set here if different from remote_ip
|
275 |
+
*
|
276 |
+
* @var string
|
277 |
+
*/
|
278 |
+
protected $risk_remote_ip;
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Customer's Serial Number
|
282 |
+
*
|
283 |
+
* @var string
|
284 |
+
*/
|
285 |
+
protected $risk_serial_number;
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Set the per-request configuration
|
289 |
+
*
|
290 |
+
* @return void
|
291 |
+
*/
|
292 |
+
protected function initConfiguration()
|
293 |
+
{
|
294 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
295 |
+
array(
|
296 |
+
'protocol' => 'https',
|
297 |
+
'port' => 443,
|
298 |
+
'type' => 'POST',
|
299 |
+
'format' => 'xml',
|
300 |
+
)
|
301 |
+
);
|
302 |
+
|
303 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Set the required fields
|
308 |
+
*
|
309 |
+
* @return void
|
310 |
+
*/
|
311 |
+
protected function setRequiredFields()
|
312 |
+
{
|
313 |
+
$requiredFields = array(
|
314 |
+
'transaction_id',
|
315 |
+
'remote_ip',
|
316 |
+
'amount',
|
317 |
+
'currency',
|
318 |
+
'return_success_url',
|
319 |
+
'return_failure_url',
|
320 |
+
'customer_email',
|
321 |
+
);
|
322 |
+
|
323 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Create the request's Tree structure
|
328 |
+
*
|
329 |
+
* @return void
|
330 |
+
*/
|
331 |
+
protected function populateStructure()
|
332 |
+
{
|
333 |
+
$treeStructure = array(
|
334 |
+
'payment_transaction' => array(
|
335 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYSAFECARD,
|
336 |
+
'transaction_id' => $this->transaction_id,
|
337 |
+
'usage' => $this->usage,
|
338 |
+
'remote_ip' => $this->remote_ip,
|
339 |
+
'return_success_url' => $this->return_success_url,
|
340 |
+
'return_failure_url' => $this->return_failure_url,
|
341 |
+
'amount' => $this->transform(
|
342 |
+
'amount',
|
343 |
+
array(
|
344 |
+
$this->amount,
|
345 |
+
$this->currency,
|
346 |
+
)
|
347 |
+
),
|
348 |
+
'currency' => $this->currency,
|
349 |
+
'customer_email' => $this->customer_email,
|
350 |
+
'customer_phone' => $this->customer_phone,
|
351 |
+
'billing_address' => array(
|
352 |
+
'first_name' => $this->billing_first_name,
|
353 |
+
'last_name' => $this->billing_last_name,
|
354 |
+
'address1' => $this->billing_address1,
|
355 |
+
'address2' => $this->billing_address2,
|
356 |
+
'zip_code' => $this->billing_zip_code,
|
357 |
+
'city' => $this->billing_city,
|
358 |
+
'state' => $this->billing_state,
|
359 |
+
'country' => $this->billing_country,
|
360 |
+
),
|
361 |
+
'shipping_address' => array(
|
362 |
+
'first_name' => $this->shipping_first_name,
|
363 |
+
'last_name' => $this->shipping_last_name,
|
364 |
+
'address1' => $this->shipping_address1,
|
365 |
+
'address2' => $this->shipping_address2,
|
366 |
+
'zip_code' => $this->shipping_zip_code,
|
367 |
+
'city' => $this->shipping_city,
|
368 |
+
'state' => $this->shipping_state,
|
369 |
+
'country' => $this->shipping_country,
|
370 |
+
),
|
371 |
+
'risk_params' => array(
|
372 |
+
'ssn' => $this->risk_ssn,
|
373 |
+
'mac_address' => $this->risk_mac_address,
|
374 |
+
'session_id' => $this->risk_session_id,
|
375 |
+
'user_id' => $this->risk_user_id,
|
376 |
+
'user_level' => $this->risk_user_level,
|
377 |
+
'email' => $this->risk_email,
|
378 |
+
'phone' => $this->risk_phone,
|
379 |
+
'remote_ip' => $this->risk_remote_ip,
|
380 |
+
'serial_number' => $this->risk_serial_number,
|
381 |
+
),
|
382 |
+
)
|
383 |
+
);
|
384 |
+
|
385 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
386 |
+
}
|
387 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Sofort.php
ADDED
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Alternatives;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Sofort
|
27 |
+
*
|
28 |
+
* Alternative payment method
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Alternatives
|
31 |
+
*/
|
32 |
+
class Sofort extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by mer-chant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Description of the transaction for later use
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $usage;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* IPv4 address of customer
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $remote_ip;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* URL where customer is sent to after successful payment
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $return_success_url;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* URL where customer is sent to after un-successful payment
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $return_failure_url;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Amount of transaction in minor currency unit
|
71 |
+
*
|
72 |
+
* @var int
|
73 |
+
*/
|
74 |
+
protected $amount;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Currency code in ISO-4217
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $currency;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Email address of the Customer
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
*/
|
88 |
+
protected $customer_email;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Phone number of the customer
|
92 |
+
*
|
93 |
+
* @var string
|
94 |
+
*/
|
95 |
+
protected $customer_phone;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* The bank id of the bank where the customer resides
|
99 |
+
*
|
100 |
+
* @var string
|
101 |
+
*/
|
102 |
+
protected $customer_bank_id;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Bank identification number of the customer
|
106 |
+
*
|
107 |
+
* @var string
|
108 |
+
*/
|
109 |
+
protected $bank_account_number;
|
110 |
+
|
111 |
+
/**
|
112 |
+
*Customer's Billing Address: First name
|
113 |
+
*
|
114 |
+
* @var string
|
115 |
+
*/
|
116 |
+
protected $billing_first_name;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Customer's Billing Address: Last name
|
120 |
+
*
|
121 |
+
* @var string
|
122 |
+
*/
|
123 |
+
protected $billing_last_name;
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Customer's Billing Address: Part 1
|
127 |
+
*
|
128 |
+
* @var string
|
129 |
+
*/
|
130 |
+
protected $billing_address1;
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Customer's Billing Address: Part 2
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
protected $billing_address2;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Customer's Billing Address: ZIP
|
140 |
+
*
|
141 |
+
* @var string
|
142 |
+
*/
|
143 |
+
protected $billing_zip_code;
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Customer's Billing Address: City
|
147 |
+
*
|
148 |
+
* @var string
|
149 |
+
*/
|
150 |
+
protected $billing_city;
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Customer's Billing Address: State
|
154 |
+
*
|
155 |
+
* format: ISO-3166-2
|
156 |
+
*
|
157 |
+
* @var string
|
158 |
+
*/
|
159 |
+
protected $billing_state;
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Customer's Billing Address: Country
|
163 |
+
*
|
164 |
+
* format: ISO-3166
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $billing_country;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Shipping Address: First name
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $shipping_first_name;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Shipping Address: Last name
|
179 |
+
*
|
180 |
+
* @var string
|
181 |
+
*/
|
182 |
+
protected $shipping_last_name;
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Customer's Shipping Address: Part 1
|
186 |
+
*
|
187 |
+
* @var string
|
188 |
+
*/
|
189 |
+
protected $shipping_address1;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Customer's Shipping Address: Part 2
|
193 |
+
*
|
194 |
+
* @var string
|
195 |
+
*/
|
196 |
+
protected $shipping_address2;
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Customer's Shipping Address: ZIP
|
200 |
+
*
|
201 |
+
* @var string
|
202 |
+
*/
|
203 |
+
protected $shipping_zip_code;
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Customer's Shipping Address: City
|
207 |
+
*
|
208 |
+
* @var string
|
209 |
+
*/
|
210 |
+
protected $shipping_city;
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Customer's Shipping Address: State
|
214 |
+
*
|
215 |
+
* format: ISO-3166-2
|
216 |
+
*
|
217 |
+
* @var string
|
218 |
+
*/
|
219 |
+
protected $shipping_state;
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Customer's Shipping Address
|
223 |
+
*
|
224 |
+
* format: ISO-3166
|
225 |
+
*
|
226 |
+
* @var string
|
227 |
+
*/
|
228 |
+
protected $shipping_country;
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Social Security number or equivalent value for non US customers.
|
232 |
+
*
|
233 |
+
* @var string
|
234 |
+
*/
|
235 |
+
protected $risk_ssn;
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Customer's MAC address
|
239 |
+
*
|
240 |
+
* @var string
|
241 |
+
*/
|
242 |
+
protected $risk_mac_address;
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Customer's Session Id
|
246 |
+
*
|
247 |
+
* @var string
|
248 |
+
*/
|
249 |
+
protected $risk_session_id;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Customer's User Id
|
253 |
+
*
|
254 |
+
* @var string
|
255 |
+
*/
|
256 |
+
protected $risk_user_id;
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Customer's User Level
|
260 |
+
*
|
261 |
+
* @var string
|
262 |
+
*/
|
263 |
+
protected $risk_user_level;
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Customer's Email address
|
267 |
+
*
|
268 |
+
* @note Set here if different from
|
269 |
+
* shipping / billing
|
270 |
+
*
|
271 |
+
* @var string
|
272 |
+
*/
|
273 |
+
protected $risk_email;
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Customer's Phone number
|
277 |
+
*
|
278 |
+
* @note Set here if different from
|
279 |
+
* shipping / billing
|
280 |
+
*
|
281 |
+
* @var string
|
282 |
+
*/
|
283 |
+
protected $risk_phone;
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Customer's IP address
|
287 |
+
*
|
288 |
+
* @note Set here if different from remote_ip
|
289 |
+
*
|
290 |
+
* @var string
|
291 |
+
*/
|
292 |
+
protected $risk_remote_ip;
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Customer's Serial Number
|
296 |
+
*
|
297 |
+
* @var string
|
298 |
+
*/
|
299 |
+
protected $risk_serial_number;
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Set the per-request configuration
|
303 |
+
*
|
304 |
+
* @return void
|
305 |
+
*/
|
306 |
+
protected function initConfiguration()
|
307 |
+
{
|
308 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
309 |
+
array(
|
310 |
+
'protocol' => 'https',
|
311 |
+
'port' => 443,
|
312 |
+
'type' => 'POST',
|
313 |
+
'format' => 'xml',
|
314 |
+
)
|
315 |
+
);
|
316 |
+
|
317 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Set the required fields
|
322 |
+
*
|
323 |
+
* @return void
|
324 |
+
*/
|
325 |
+
protected function setRequiredFields()
|
326 |
+
{
|
327 |
+
$requiredFields = array(
|
328 |
+
'transaction_id',
|
329 |
+
'remote_ip',
|
330 |
+
'amount',
|
331 |
+
'currency',
|
332 |
+
'return_success_url',
|
333 |
+
'return_failure_url',
|
334 |
+
'customer_email',
|
335 |
+
);
|
336 |
+
|
337 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Create the request's Tree structure
|
342 |
+
*
|
343 |
+
* @return void
|
344 |
+
*/
|
345 |
+
protected function populateStructure()
|
346 |
+
{
|
347 |
+
$treeStructure = array(
|
348 |
+
'payment_transaction' => array(
|
349 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::SOFORT,
|
350 |
+
'transaction_id' => $this->transaction_id,
|
351 |
+
'usage' => $this->usage,
|
352 |
+
'remote_ip' => $this->remote_ip,
|
353 |
+
'return_success_url' => $this->return_success_url,
|
354 |
+
'return_failure_url' => $this->return_failure_url,
|
355 |
+
'amount' => $this->transform(
|
356 |
+
'amount',
|
357 |
+
array(
|
358 |
+
$this->amount,
|
359 |
+
$this->currency,
|
360 |
+
)
|
361 |
+
),
|
362 |
+
'currency' => $this->currency,
|
363 |
+
'customer_email' => $this->customer_email,
|
364 |
+
'customer_phone' => $this->customer_phone,
|
365 |
+
'customer_bank_id' => $this->customer_bank_id,
|
366 |
+
'bank_account_number' => $this->bank_account_number,
|
367 |
+
'billing_address' => array(
|
368 |
+
'first_name' => $this->billing_first_name,
|
369 |
+
'last_name' => $this->billing_last_name,
|
370 |
+
'address1' => $this->billing_address1,
|
371 |
+
'address2' => $this->billing_address2,
|
372 |
+
'zip_code' => $this->billing_zip_code,
|
373 |
+
'city' => $this->billing_city,
|
374 |
+
'state' => $this->billing_state,
|
375 |
+
'country' => $this->billing_country,
|
376 |
+
),
|
377 |
+
'shipping_address' => array(
|
378 |
+
'first_name' => $this->shipping_first_name,
|
379 |
+
'last_name' => $this->shipping_last_name,
|
380 |
+
'address1' => $this->shipping_address1,
|
381 |
+
'address2' => $this->shipping_address2,
|
382 |
+
'zip_code' => $this->shipping_zip_code,
|
383 |
+
'city' => $this->shipping_city,
|
384 |
+
'state' => $this->shipping_state,
|
385 |
+
'country' => $this->shipping_country,
|
386 |
+
),
|
387 |
+
'risk_params' => array(
|
388 |
+
'ssn' => $this->risk_ssn,
|
389 |
+
'mac_address' => $this->risk_mac_address,
|
390 |
+
'session_id' => $this->risk_session_id,
|
391 |
+
'user_id' => $this->risk_user_id,
|
392 |
+
'user_level' => $this->risk_user_level,
|
393 |
+
'email' => $this->risk_email,
|
394 |
+
'phone' => $this->risk_phone,
|
395 |
+
'remote_ip' => $this->risk_remote_ip,
|
396 |
+
'serial_number' => $this->risk_serial_number,
|
397 |
+
),
|
398 |
+
)
|
399 |
+
);
|
400 |
+
|
401 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
402 |
+
}
|
403 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Capture.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Capture Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Capture extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by mer-chant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* IPv4 address of customer
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
protected $remote_ip;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Amount of transaction in minor currency unit
|
56 |
+
*
|
57 |
+
* @var int
|
58 |
+
*/
|
59 |
+
protected $amount;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Currency code in ISO-4217
|
63 |
+
*
|
64 |
+
* @var string
|
65 |
+
*/
|
66 |
+
protected $currency;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Unique id of the existing (target) transaction
|
70 |
+
*
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
+
protected $reference_id;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Set the per-request configuration
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
protected function initConfiguration()
|
81 |
+
{
|
82 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
83 |
+
array(
|
84 |
+
'protocol' => 'https',
|
85 |
+
'port' => 443,
|
86 |
+
'type' => 'POST',
|
87 |
+
'format' => 'xml',
|
88 |
+
)
|
89 |
+
);
|
90 |
+
|
91 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Set the required fields
|
96 |
+
*
|
97 |
+
* @return void
|
98 |
+
*/
|
99 |
+
protected function setRequiredFields()
|
100 |
+
{
|
101 |
+
$requiredFields = array(
|
102 |
+
'transaction_id',
|
103 |
+
'reference_id',
|
104 |
+
'amount',
|
105 |
+
'currency'
|
106 |
+
);
|
107 |
+
|
108 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Create the request's Tree structure
|
113 |
+
*
|
114 |
+
* @return void
|
115 |
+
*/
|
116 |
+
protected function populateStructure()
|
117 |
+
{
|
118 |
+
$treeStructure = array(
|
119 |
+
'payment_transaction' => array(
|
120 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::CAPTURE,
|
121 |
+
'transaction_id' => $this->transaction_id,
|
122 |
+
'usage' => $this->usage,
|
123 |
+
'remote_ip' => $this->remote_ip,
|
124 |
+
'reference_id' => $this->reference_id,
|
125 |
+
'amount' => $this->transform(
|
126 |
+
'amount',
|
127 |
+
array(
|
128 |
+
$this->amount,
|
129 |
+
$this->currency,
|
130 |
+
)
|
131 |
+
),
|
132 |
+
'currency' => $this->currency
|
133 |
+
)
|
134 |
+
);
|
135 |
+
|
136 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
137 |
+
}
|
138 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Authorize.php
ADDED
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Authorize
|
27 |
+
*
|
28 |
+
*
|
29 |
+
*
|
30 |
+
* @package Genesis
|
31 |
+
* @subpackage Request
|
32 |
+
*/
|
33 |
+
class Authorize extends \Genesis\API\Request
|
34 |
+
{
|
35 |
+
/**
|
36 |
+
* Unique transaction id defined by merchant
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
protected $transaction_id;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Description of the transaction for later use
|
44 |
+
*
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
protected $usage;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Signifies whether a gaming transaction is performed.
|
51 |
+
*
|
52 |
+
* Gaming transactions usually use MCC 7995, contact tech support for more details.
|
53 |
+
*
|
54 |
+
* @var bool
|
55 |
+
*/
|
56 |
+
protected $gaming;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Signifies whether a MOTO (mail order telephone order) transaction is performed.
|
60 |
+
*
|
61 |
+
* Contact tech support for more details.
|
62 |
+
*
|
63 |
+
* @var bool
|
64 |
+
*/
|
65 |
+
protected $moto;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* IPv4 address of customer
|
69 |
+
*
|
70 |
+
* @var string
|
71 |
+
*/
|
72 |
+
protected $remote_ip;
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Amount of transaction in minor currency unit
|
76 |
+
*
|
77 |
+
* @var int|float|double
|
78 |
+
*/
|
79 |
+
protected $amount;
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Currency code in ISO-4217
|
83 |
+
*
|
84 |
+
* @var string
|
85 |
+
*/
|
86 |
+
protected $currency;
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
90 |
+
*
|
91 |
+
* @var string
|
92 |
+
*/
|
93 |
+
protected $card_holder;
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Complete CC number of customer
|
97 |
+
*
|
98 |
+
* @var int
|
99 |
+
*/
|
100 |
+
protected $card_number;
|
101 |
+
|
102 |
+
/**
|
103 |
+
* CVV of CC, requirement is based on terminal configuration
|
104 |
+
*
|
105 |
+
* @var int
|
106 |
+
*/
|
107 |
+
protected $cvv;
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Expiration month as printed on credit card
|
111 |
+
*
|
112 |
+
* @var string (mm)
|
113 |
+
*/
|
114 |
+
protected $expiration_month;
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Expiration year as printed on credit card
|
118 |
+
*
|
119 |
+
* @var string (yyyy)
|
120 |
+
*/
|
121 |
+
protected $expiration_year;
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Email address of the Customer
|
125 |
+
*
|
126 |
+
* @var string
|
127 |
+
*/
|
128 |
+
protected $customer_email;
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Phone number of the customer
|
132 |
+
*
|
133 |
+
* @var string
|
134 |
+
*/
|
135 |
+
protected $customer_phone;
|
136 |
+
|
137 |
+
/**
|
138 |
+
*Customer's Billing Address: First name
|
139 |
+
*
|
140 |
+
* @var string
|
141 |
+
*/
|
142 |
+
protected $billing_first_name;
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Customer's Billing Address: Last name
|
146 |
+
*
|
147 |
+
* @var string
|
148 |
+
*/
|
149 |
+
protected $billing_last_name;
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Customer's Billing Address: Part 1
|
153 |
+
*
|
154 |
+
* @var string
|
155 |
+
*/
|
156 |
+
protected $billing_address1;
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Customer's Billing Address: Part 2
|
160 |
+
* @var string
|
161 |
+
*/
|
162 |
+
protected $billing_address2;
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Customer's Billing Address: ZIP
|
166 |
+
*
|
167 |
+
* @var string
|
168 |
+
*/
|
169 |
+
protected $billing_zip_code;
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Customer's Billing Address: City
|
173 |
+
*
|
174 |
+
* @var string
|
175 |
+
*/
|
176 |
+
protected $billing_city;
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Customer's Billing Address: State
|
180 |
+
*
|
181 |
+
* format: ISO-3166-2
|
182 |
+
*
|
183 |
+
* @var string
|
184 |
+
*/
|
185 |
+
protected $billing_state;
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Customer's Billing Address: Country
|
189 |
+
*
|
190 |
+
* format: ISO-3166
|
191 |
+
*
|
192 |
+
* @var string
|
193 |
+
*/
|
194 |
+
protected $billing_country;
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Customer's Shipping Address: First name
|
198 |
+
*
|
199 |
+
* @var string
|
200 |
+
*/
|
201 |
+
protected $shipping_first_name;
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Customer's Shipping Address: Last name
|
205 |
+
*
|
206 |
+
* @var string
|
207 |
+
*/
|
208 |
+
protected $shipping_last_name;
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Customer's Shipping Address: Part 1
|
212 |
+
*
|
213 |
+
* @var string
|
214 |
+
*/
|
215 |
+
protected $shipping_address1;
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Customer's Shipping Address: Part 2
|
219 |
+
*
|
220 |
+
* @var string
|
221 |
+
*/
|
222 |
+
protected $shipping_address2;
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Customer's Shipping Address: ZIP
|
226 |
+
*
|
227 |
+
* @var string
|
228 |
+
*/
|
229 |
+
protected $shipping_zip_code;
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Customer's Shipping Address: City
|
233 |
+
*
|
234 |
+
* @var string
|
235 |
+
*/
|
236 |
+
protected $shipping_city;
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Customer's Shipping Address: State
|
240 |
+
*
|
241 |
+
* format: ISO-3166-2
|
242 |
+
*
|
243 |
+
* @var string
|
244 |
+
*/
|
245 |
+
protected $shipping_state;
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Customer's Shipping Address
|
249 |
+
*
|
250 |
+
* format: ISO-3166
|
251 |
+
*
|
252 |
+
* @var string
|
253 |
+
*/
|
254 |
+
protected $shipping_country;
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Social Security number or equivalent value for non US customers.
|
258 |
+
*
|
259 |
+
* @var string
|
260 |
+
*/
|
261 |
+
protected $risk_ssn;
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Customer's MAC address
|
265 |
+
*
|
266 |
+
* @var string
|
267 |
+
*/
|
268 |
+
protected $risk_mac_address;
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Customer's Session Id
|
272 |
+
*
|
273 |
+
* @var string
|
274 |
+
*/
|
275 |
+
protected $risk_session_id;
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Customer's User Id
|
279 |
+
*
|
280 |
+
* @var string
|
281 |
+
*/
|
282 |
+
protected $risk_user_id;
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Customer's User Level
|
286 |
+
*
|
287 |
+
* @var string
|
288 |
+
*/
|
289 |
+
protected $risk_user_level;
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Customer's Email address
|
293 |
+
*
|
294 |
+
* @note Set here if different from
|
295 |
+
* shipping / billing
|
296 |
+
*
|
297 |
+
* @var string
|
298 |
+
*/
|
299 |
+
protected $risk_email;
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Customer's Phone number
|
303 |
+
*
|
304 |
+
* @note Set here if different from
|
305 |
+
* shipping / billing
|
306 |
+
*
|
307 |
+
* @var string
|
308 |
+
*/
|
309 |
+
protected $risk_phone;
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Customer's IP address
|
313 |
+
*
|
314 |
+
* @note Set here if different from remote_ip
|
315 |
+
*
|
316 |
+
* @var string
|
317 |
+
*/
|
318 |
+
protected $risk_remote_ip;
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Customer's Serial Number
|
322 |
+
*
|
323 |
+
* @var string
|
324 |
+
*/
|
325 |
+
protected $risk_serial_number;
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Allows to dynamically override the charge descriptor
|
329 |
+
*
|
330 |
+
* @var string
|
331 |
+
*/
|
332 |
+
protected $dynamic_merchant_name;
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Allows to dynamically override the mer- chant phone number
|
336 |
+
*
|
337 |
+
* @var string
|
338 |
+
*/
|
339 |
+
protected $dynamic_merchant_city;
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Set the per-request configuration
|
343 |
+
*
|
344 |
+
* @return void
|
345 |
+
*/
|
346 |
+
protected function initConfiguration()
|
347 |
+
{
|
348 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
349 |
+
array(
|
350 |
+
'protocol' => 'https',
|
351 |
+
'port' => 443,
|
352 |
+
'type' => 'POST',
|
353 |
+
'format' => 'xml',
|
354 |
+
)
|
355 |
+
);
|
356 |
+
|
357 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Set the required fields
|
362 |
+
*
|
363 |
+
* @return void
|
364 |
+
*/
|
365 |
+
protected function setRequiredFields()
|
366 |
+
{
|
367 |
+
$requiredFields = array(
|
368 |
+
'transaction_id',
|
369 |
+
'amount',
|
370 |
+
'currency',
|
371 |
+
'card_holder',
|
372 |
+
'expiration_month',
|
373 |
+
'expiration_year',
|
374 |
+
'card_number',
|
375 |
+
);
|
376 |
+
|
377 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Create the request's Tree structure
|
382 |
+
*
|
383 |
+
* @return void
|
384 |
+
*/
|
385 |
+
protected function populateStructure()
|
386 |
+
{
|
387 |
+
$treeStructure = array(
|
388 |
+
'payment_transaction' => array(
|
389 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::AUTHORIZE,
|
390 |
+
'transaction_id' => $this->transaction_id,
|
391 |
+
'usage' => $this->usage,
|
392 |
+
'gaming' => $this->gaming,
|
393 |
+
'moto' => $this->moto,
|
394 |
+
'remote_ip' => $this->remote_ip,
|
395 |
+
'amount' => $this->transform(
|
396 |
+
'amount',
|
397 |
+
array(
|
398 |
+
$this->amount,
|
399 |
+
$this->currency,
|
400 |
+
)
|
401 |
+
),
|
402 |
+
'currency' => $this->currency,
|
403 |
+
'card_holder' => $this->card_holder,
|
404 |
+
'card_number' => $this->card_number,
|
405 |
+
'cvv' => $this->cvv,
|
406 |
+
'expiration_month' => $this->expiration_month,
|
407 |
+
'expiration_year' => $this->expiration_year,
|
408 |
+
'customer_email' => $this->customer_email,
|
409 |
+
'customer_phone' => $this->customer_phone,
|
410 |
+
'billing_address' => array(
|
411 |
+
'first_name' => $this->billing_first_name,
|
412 |
+
'last_name' => $this->billing_last_name,
|
413 |
+
'address1' => $this->billing_address1,
|
414 |
+
'address2' => $this->billing_address2,
|
415 |
+
'zip_code' => $this->billing_zip_code,
|
416 |
+
'city' => $this->billing_city,
|
417 |
+
'state' => $this->billing_state,
|
418 |
+
'country' => $this->billing_country,
|
419 |
+
),
|
420 |
+
'shipping_address' => array(
|
421 |
+
'first_name' => $this->shipping_first_name,
|
422 |
+
'last_name' => $this->shipping_last_name,
|
423 |
+
'address1' => $this->shipping_address1,
|
424 |
+
'address2' => $this->shipping_address2,
|
425 |
+
'zip_code' => $this->shipping_zip_code,
|
426 |
+
'city' => $this->shipping_city,
|
427 |
+
'state' => $this->shipping_state,
|
428 |
+
'country' => $this->shipping_country,
|
429 |
+
),
|
430 |
+
'risk_params' => array(
|
431 |
+
'ssn' => $this->risk_ssn,
|
432 |
+
'mac_address' => $this->risk_mac_address,
|
433 |
+
'session_id' => $this->risk_session_id,
|
434 |
+
'user_id' => $this->risk_user_id,
|
435 |
+
'user_level' => $this->risk_user_level,
|
436 |
+
'email' => $this->risk_email,
|
437 |
+
'phone' => $this->risk_phone,
|
438 |
+
'remote_ip' => $this->risk_remote_ip,
|
439 |
+
'serial_number' => $this->risk_serial_number,
|
440 |
+
),
|
441 |
+
'dynamic_descriptor_params' => array(
|
442 |
+
'merchant_name' => $this->dynamic_merchant_name,
|
443 |
+
'merchant_city' => $this->dynamic_merchant_city,
|
444 |
+
)
|
445 |
+
)
|
446 |
+
);
|
447 |
+
|
448 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
449 |
+
}
|
450 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Authorize3D.php
ADDED
@@ -0,0 +1,514 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Authorize 3D Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Authorize3D extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Signifies whether a gaming transaction is performed.
|
49 |
+
*
|
50 |
+
* Gaming transactions usually use MCC 7995, contact tech support for more details.
|
51 |
+
*
|
52 |
+
* @var bool
|
53 |
+
*/
|
54 |
+
protected $gaming;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Signifies whether a MOTO (mail order telephone order) transaction is performed.
|
58 |
+
*
|
59 |
+
* Contact tech support for more details.
|
60 |
+
*
|
61 |
+
* @var bool
|
62 |
+
*/
|
63 |
+
protected $moto;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* IPv4 address of customer
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
protected $remote_ip;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* URL endpoint for Genesis Notifications
|
74 |
+
*
|
75 |
+
* @var string
|
76 |
+
*/
|
77 |
+
protected $notification_url;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* URL where customer is sent to after successful payment
|
81 |
+
*
|
82 |
+
* @var string
|
83 |
+
*/
|
84 |
+
protected $return_success_url;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* URL where customer is sent to after un-successful payment
|
88 |
+
*
|
89 |
+
* @var string
|
90 |
+
*/
|
91 |
+
protected $return_failure_url;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Amount of transaction in minor currency unit
|
95 |
+
*
|
96 |
+
* @var int|float|double
|
97 |
+
*/
|
98 |
+
protected $amount;
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Currency code in ISO-4217
|
102 |
+
*
|
103 |
+
* @var string
|
104 |
+
*/
|
105 |
+
protected $currency;
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
109 |
+
*
|
110 |
+
* @var string
|
111 |
+
*/
|
112 |
+
protected $card_holder;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Complete CC number of customer
|
116 |
+
*
|
117 |
+
* @var int
|
118 |
+
*/
|
119 |
+
protected $card_number;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* CVV of CC, requirement is based on terminal configuration
|
123 |
+
*
|
124 |
+
* @var int
|
125 |
+
*/
|
126 |
+
protected $cvv;
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Expiration month as printed on credit card
|
130 |
+
*
|
131 |
+
* @var string (mm)
|
132 |
+
*/
|
133 |
+
protected $expiration_month;
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Expiration year as printed on credit card
|
137 |
+
*
|
138 |
+
* @var string (yyyy)
|
139 |
+
*/
|
140 |
+
protected $expiration_year;
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Email address of the Customer
|
144 |
+
*
|
145 |
+
* @var string
|
146 |
+
*/
|
147 |
+
protected $customer_email;
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Phone number of the customer
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $customer_phone;
|
155 |
+
|
156 |
+
/**
|
157 |
+
*Customer's Billing Address: First name
|
158 |
+
*
|
159 |
+
* @var string
|
160 |
+
*/
|
161 |
+
protected $billing_first_name;
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Customer's Billing Address: Last name
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $billing_last_name;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Billing Address: Part 1
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $billing_address1;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Billing Address: Part 2
|
179 |
+
* @var string
|
180 |
+
*/
|
181 |
+
protected $billing_address2;
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Customer's Billing Address: ZIP
|
185 |
+
*
|
186 |
+
* @var string
|
187 |
+
*/
|
188 |
+
protected $billing_zip_code;
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Customer's Billing Address: City
|
192 |
+
*
|
193 |
+
* @var string
|
194 |
+
*/
|
195 |
+
protected $billing_city;
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Customer's Billing Address: State
|
199 |
+
*
|
200 |
+
* format: ISO-3166-2
|
201 |
+
*
|
202 |
+
* @var string
|
203 |
+
*/
|
204 |
+
protected $billing_state;
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Customer's Billing Address: Country
|
208 |
+
*
|
209 |
+
* format: ISO-3166
|
210 |
+
*
|
211 |
+
* @var string
|
212 |
+
*/
|
213 |
+
protected $billing_country;
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Customer's Shipping Address: First name
|
217 |
+
*
|
218 |
+
* @var string
|
219 |
+
*/
|
220 |
+
protected $shipping_first_name;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Customer's Shipping Address: Last name
|
224 |
+
*
|
225 |
+
* @var string
|
226 |
+
*/
|
227 |
+
protected $shipping_last_name;
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Customer's Shipping Address: Part 1
|
231 |
+
*
|
232 |
+
* @var string
|
233 |
+
*/
|
234 |
+
protected $shipping_address1;
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Customer's Shipping Address: Part 2
|
238 |
+
*
|
239 |
+
* @var string
|
240 |
+
*/
|
241 |
+
protected $shipping_address2;
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Customer's Shipping Address: ZIP
|
245 |
+
*
|
246 |
+
* @var string
|
247 |
+
*/
|
248 |
+
protected $shipping_zip_code;
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Customer's Shipping Address: City
|
252 |
+
*
|
253 |
+
* @var string
|
254 |
+
*/
|
255 |
+
protected $shipping_city;
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Customer's Shipping Address: State
|
259 |
+
*
|
260 |
+
* format: ISO-3166-2
|
261 |
+
*
|
262 |
+
* @var string
|
263 |
+
*/
|
264 |
+
protected $shipping_state;
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Customer's Shipping Address
|
268 |
+
*
|
269 |
+
* format: ISO-3166
|
270 |
+
*
|
271 |
+
* @var string
|
272 |
+
*/
|
273 |
+
protected $shipping_country;
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Social Security number or equivalent value for non US customers.
|
277 |
+
*
|
278 |
+
* @var string
|
279 |
+
*/
|
280 |
+
protected $risk_ssn;
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Customer's MAC address
|
284 |
+
*
|
285 |
+
* @var string
|
286 |
+
*/
|
287 |
+
protected $risk_mac_address;
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Customer's Session Id
|
291 |
+
*
|
292 |
+
* @var string
|
293 |
+
*/
|
294 |
+
protected $risk_session_id;
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Customer's User Id
|
298 |
+
*
|
299 |
+
* @var string
|
300 |
+
*/
|
301 |
+
protected $risk_user_id;
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Customer's User Level
|
305 |
+
*
|
306 |
+
* @var string
|
307 |
+
*/
|
308 |
+
protected $risk_user_level;
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Customer's Email address
|
312 |
+
*
|
313 |
+
* @note Set here if different from
|
314 |
+
* shipping / billing
|
315 |
+
*
|
316 |
+
* @var string
|
317 |
+
*/
|
318 |
+
protected $risk_email;
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Customer's Phone number
|
322 |
+
*
|
323 |
+
* @note Set here if different from
|
324 |
+
* shipping / billing
|
325 |
+
*
|
326 |
+
* @var string
|
327 |
+
*/
|
328 |
+
protected $risk_phone;
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Customer's IP address
|
332 |
+
*
|
333 |
+
* @note Set here if different from remote_ip
|
334 |
+
*
|
335 |
+
* @var string
|
336 |
+
*/
|
337 |
+
protected $risk_remote_ip;
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Customer's Serial Number
|
341 |
+
*
|
342 |
+
* @var string
|
343 |
+
*/
|
344 |
+
protected $risk_serial_number;
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Verification Id of the authentication.
|
348 |
+
*
|
349 |
+
* Please note this can be the CAVV for Visa Card or UCAF to identify MasterCard.
|
350 |
+
*
|
351 |
+
* @var string
|
352 |
+
*/
|
353 |
+
protected $mpi_cavv;
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Electric Commerce Indicator as returned from the MPI.
|
357 |
+
*
|
358 |
+
* @var string
|
359 |
+
*/
|
360 |
+
protected $mpi_eci;
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Transaction ID generated by the 3D Secure service
|
364 |
+
* that uniquely identifies a 3D Secure check request
|
365 |
+
*
|
366 |
+
* @var string
|
367 |
+
*/
|
368 |
+
protected $mpi_xid;
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Allows to dynamically override the charge descriptor
|
372 |
+
*
|
373 |
+
* @var string
|
374 |
+
*/
|
375 |
+
protected $dynamic_merchant_name;
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Allows to dynamically override the mer- chant phone number
|
379 |
+
*
|
380 |
+
* @var string
|
381 |
+
*/
|
382 |
+
protected $dynamic_merchant_city;
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Set the per-request configuration
|
386 |
+
*
|
387 |
+
* @return void
|
388 |
+
*/
|
389 |
+
protected function initConfiguration()
|
390 |
+
{
|
391 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(array(
|
392 |
+
'protocol' => 'https',
|
393 |
+
'port' => 443,
|
394 |
+
'type' => 'POST',
|
395 |
+
'format' => 'xml',
|
396 |
+
));
|
397 |
+
|
398 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Set the required fields
|
403 |
+
*
|
404 |
+
* @return void
|
405 |
+
*/
|
406 |
+
protected function setRequiredFields()
|
407 |
+
{
|
408 |
+
$requiredFields = array(
|
409 |
+
'transaction_id',
|
410 |
+
'amount',
|
411 |
+
'currency',
|
412 |
+
'card_holder',
|
413 |
+
'card_number',
|
414 |
+
'expiration_month',
|
415 |
+
'expiration_year',
|
416 |
+
);
|
417 |
+
|
418 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
419 |
+
|
420 |
+
$requiredFieldsConditional = array(
|
421 |
+
'notification_url' => array('return_success_url', 'return_failure_url'),
|
422 |
+
'return_success_url' => array('notification_url', 'return_failure_url'),
|
423 |
+
'return_failure_url' => array('notification_url', 'return_success_url'),
|
424 |
+
);
|
425 |
+
|
426 |
+
$this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
|
427 |
+
|
428 |
+
$requiredFieldsGroups = array(
|
429 |
+
'synchronous' => array('notification_url', 'return_success_url', 'return_failure_url'),
|
430 |
+
'asynchronous' => array( 'mpi_eci'),
|
431 |
+
);
|
432 |
+
|
433 |
+
$this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Create the request's Tree structure
|
438 |
+
*
|
439 |
+
* @return void
|
440 |
+
*/
|
441 |
+
protected function populateStructure()
|
442 |
+
{
|
443 |
+
$treeStructure = array(
|
444 |
+
'payment_transaction' => array(
|
445 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D,
|
446 |
+
'transaction_id' => $this->transaction_id,
|
447 |
+
'usage' => $this->usage,
|
448 |
+
'gaming' => $this->gaming,
|
449 |
+
'moto' => $this->moto,
|
450 |
+
'remote_ip' => $this->remote_ip,
|
451 |
+
'notification_url' => $this->notification_url,
|
452 |
+
'return_success_url' => $this->return_success_url,
|
453 |
+
'return_failure_url' => $this->return_failure_url,
|
454 |
+
'amount' => $this->transform(
|
455 |
+
'amount',
|
456 |
+
array(
|
457 |
+
$this->amount,
|
458 |
+
$this->currency,
|
459 |
+
)
|
460 |
+
),
|
461 |
+
'currency' => $this->currency,
|
462 |
+
'card_holder' => $this->card_holder,
|
463 |
+
'card_number' => $this->card_number,
|
464 |
+
'cvv' => $this->cvv,
|
465 |
+
'expiration_month' => $this->expiration_month,
|
466 |
+
'expiration_year' => $this->expiration_year,
|
467 |
+
'customer_email' => $this->customer_email,
|
468 |
+
'customer_phone' => $this->customer_phone,
|
469 |
+
'billing_address' => array(
|
470 |
+
'first_name' => $this->billing_first_name,
|
471 |
+
'last_name' => $this->billing_last_name,
|
472 |
+
'address1' => $this->billing_address1,
|
473 |
+
'address2' => $this->billing_address2,
|
474 |
+
'zip_code' => $this->billing_zip_code,
|
475 |
+
'city' => $this->billing_city,
|
476 |
+
'state' => $this->billing_state,
|
477 |
+
'country' => $this->billing_country,
|
478 |
+
),
|
479 |
+
'shipping_address' => array(
|
480 |
+
'first_name' => $this->shipping_first_name,
|
481 |
+
'last_name' => $this->shipping_last_name,
|
482 |
+
'address1' => $this->shipping_address1,
|
483 |
+
'address2' => $this->shipping_address2,
|
484 |
+
'zip_code' => $this->shipping_zip_code,
|
485 |
+
'city' => $this->shipping_city,
|
486 |
+
'state' => $this->shipping_state,
|
487 |
+
'country' => $this->shipping_country,
|
488 |
+
),
|
489 |
+
'mpi_params' => array(
|
490 |
+
'cavv' => $this->mpi_cavv,
|
491 |
+
'eci' => $this->mpi_eci,
|
492 |
+
'xid' => $this->mpi_xid,
|
493 |
+
),
|
494 |
+
'risk_params' => array(
|
495 |
+
'ssn' => $this->risk_ssn,
|
496 |
+
'mac_address' => $this->risk_mac_address,
|
497 |
+
'session_id' => $this->risk_session_id,
|
498 |
+
'user_id' => $this->risk_user_id,
|
499 |
+
'user_level' => $this->risk_user_level,
|
500 |
+
'email' => $this->risk_email,
|
501 |
+
'phone' => $this->risk_phone,
|
502 |
+
'remote_ip' => $this->risk_remote_ip,
|
503 |
+
'serial_number' => $this->risk_serial_number,
|
504 |
+
),
|
505 |
+
'dynamic_descriptor_params' => array(
|
506 |
+
'merchant_name' => $this->dynamic_merchant_name,
|
507 |
+
'merchant_city' => $this->dynamic_merchant_city,
|
508 |
+
)
|
509 |
+
)
|
510 |
+
);
|
511 |
+
|
512 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
513 |
+
}
|
514 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Credit.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Credit Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Credit extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* IPv4 address of customer
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
protected $remote_ip;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Amount of transaction in minor currency unit
|
56 |
+
*
|
57 |
+
* @var int|float|double
|
58 |
+
*/
|
59 |
+
protected $amount;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Currency code in ISO-4217
|
63 |
+
*
|
64 |
+
* @var string
|
65 |
+
*/
|
66 |
+
protected $currency;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Unique id of the existing (target) transaction
|
70 |
+
*
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
+
protected $reference_id;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Set the per-request configuration
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
protected function initConfiguration()
|
81 |
+
{
|
82 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
83 |
+
array(
|
84 |
+
'protocol' => 'https',
|
85 |
+
'port' => 443,
|
86 |
+
'type' => 'POST',
|
87 |
+
'format' => 'xml',
|
88 |
+
)
|
89 |
+
);
|
90 |
+
|
91 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Set the required fields
|
96 |
+
*
|
97 |
+
* @return void
|
98 |
+
*/
|
99 |
+
protected function setRequiredFields()
|
100 |
+
{
|
101 |
+
$requiredFields = array(
|
102 |
+
'transaction_id',
|
103 |
+
'reference_id',
|
104 |
+
'amount',
|
105 |
+
'currency'
|
106 |
+
);
|
107 |
+
|
108 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Create the request's Tree structure
|
113 |
+
*
|
114 |
+
* @return void
|
115 |
+
*/
|
116 |
+
protected function populateStructure()
|
117 |
+
{
|
118 |
+
$treeStructure = array(
|
119 |
+
'payment_transaction' => array(
|
120 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::CREDIT,
|
121 |
+
'transaction_id' => $this->transaction_id,
|
122 |
+
'usage' => $this->usage,
|
123 |
+
'remote_ip' => $this->remote_ip,
|
124 |
+
'reference_id' => $this->reference_id,
|
125 |
+
'amount' => $this->transform(
|
126 |
+
'amount',
|
127 |
+
array(
|
128 |
+
$this->amount,
|
129 |
+
$this->currency,
|
130 |
+
)
|
131 |
+
),
|
132 |
+
'currency' => $this->currency
|
133 |
+
)
|
134 |
+
);
|
135 |
+
|
136 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
137 |
+
}
|
138 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Payout.php
ADDED
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Payout Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Payout extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* IPv4 address of customer
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
protected $remote_ip;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Amount of transaction in minor currency unit
|
56 |
+
*
|
57 |
+
* @var int|float|double
|
58 |
+
*/
|
59 |
+
protected $amount;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Currency code in ISO-4217
|
63 |
+
*
|
64 |
+
* @var string
|
65 |
+
*/
|
66 |
+
protected $currency;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
70 |
+
*
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
+
protected $card_holder;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Complete CC number of customer
|
77 |
+
*
|
78 |
+
* @var int
|
79 |
+
*/
|
80 |
+
protected $card_number;
|
81 |
+
|
82 |
+
/**
|
83 |
+
* CVV of CC, requirement is based on terminal configuration
|
84 |
+
*
|
85 |
+
* @var int
|
86 |
+
*/
|
87 |
+
protected $cvv;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Expiration month as printed on credit card
|
91 |
+
*
|
92 |
+
* @var string (mm)
|
93 |
+
*/
|
94 |
+
protected $expiration_month;
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Expiration year as printed on credit card
|
98 |
+
*
|
99 |
+
* @var string (yyyy)
|
100 |
+
*/
|
101 |
+
protected $expiration_year;
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Email address of the Customer
|
105 |
+
*
|
106 |
+
* @var string
|
107 |
+
*/
|
108 |
+
protected $customer_email;
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Phone number of the customer
|
112 |
+
*
|
113 |
+
* @var string
|
114 |
+
*/
|
115 |
+
protected $customer_phone;
|
116 |
+
|
117 |
+
/**
|
118 |
+
*Customer's Billing Address: First name
|
119 |
+
*
|
120 |
+
* @var string
|
121 |
+
*/
|
122 |
+
protected $billing_first_name;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Customer's Billing Address: Last name
|
126 |
+
*
|
127 |
+
* @var string
|
128 |
+
*/
|
129 |
+
protected $billing_last_name;
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Customer's Billing Address: Part 1
|
133 |
+
*
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
protected $billing_address1;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Customer's Billing Address: Part 2
|
140 |
+
* @var string
|
141 |
+
*/
|
142 |
+
protected $billing_address2;
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Customer's Billing Address: ZIP
|
146 |
+
*
|
147 |
+
* @var string
|
148 |
+
*/
|
149 |
+
protected $billing_zip_code;
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Customer's Billing Address: City
|
153 |
+
*
|
154 |
+
* @var string
|
155 |
+
*/
|
156 |
+
protected $billing_city;
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Customer's Billing Address: State
|
160 |
+
*
|
161 |
+
* format: ISO-3166-2
|
162 |
+
*
|
163 |
+
* @var string
|
164 |
+
*/
|
165 |
+
protected $billing_state;
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Customer's Billing Address: Country
|
169 |
+
*
|
170 |
+
* format: ISO-3166
|
171 |
+
*
|
172 |
+
* @var string
|
173 |
+
*/
|
174 |
+
protected $billing_country;
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Customer's Shipping Address: First name
|
178 |
+
*
|
179 |
+
* @var string
|
180 |
+
*/
|
181 |
+
protected $shipping_first_name;
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Customer's Shipping Address: Last name
|
185 |
+
*
|
186 |
+
* @var string
|
187 |
+
*/
|
188 |
+
protected $shipping_last_name;
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Customer's Shipping Address: Part 1
|
192 |
+
*
|
193 |
+
* @var string
|
194 |
+
*/
|
195 |
+
protected $shipping_address1;
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Customer's Shipping Address: Part 2
|
199 |
+
*
|
200 |
+
* @var string
|
201 |
+
*/
|
202 |
+
protected $shipping_address2;
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Customer's Shipping Address: ZIP
|
206 |
+
*
|
207 |
+
* @var string
|
208 |
+
*/
|
209 |
+
protected $shipping_zip_code;
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Customer's Shipping Address: City
|
213 |
+
*
|
214 |
+
* @var string
|
215 |
+
*/
|
216 |
+
protected $shipping_city;
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Customer's Shipping Address: State
|
220 |
+
*
|
221 |
+
* format: ISO-3166-2
|
222 |
+
*
|
223 |
+
* @var string
|
224 |
+
*/
|
225 |
+
protected $shipping_state;
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Customer's Shipping Address
|
229 |
+
*
|
230 |
+
* format: ISO-3166
|
231 |
+
*
|
232 |
+
* @var string
|
233 |
+
*/
|
234 |
+
protected $shipping_country;
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Set the per-request configuration
|
238 |
+
*
|
239 |
+
* @return void
|
240 |
+
*/
|
241 |
+
protected function initConfiguration()
|
242 |
+
{
|
243 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
244 |
+
array(
|
245 |
+
'protocol' => 'https',
|
246 |
+
'port' => 443,
|
247 |
+
'type' => 'POST',
|
248 |
+
'format' => 'xml',
|
249 |
+
)
|
250 |
+
);
|
251 |
+
|
252 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Set the required fields
|
257 |
+
*
|
258 |
+
* @return void
|
259 |
+
*/
|
260 |
+
protected function setRequiredFields()
|
261 |
+
{
|
262 |
+
$requiredFields = array(
|
263 |
+
'transaction_id',
|
264 |
+
'amount',
|
265 |
+
'currency',
|
266 |
+
'card_holder',
|
267 |
+
'card_number',
|
268 |
+
'expiration_month',
|
269 |
+
'expiration_year',
|
270 |
+
);
|
271 |
+
|
272 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Create the request's Tree structure
|
277 |
+
*
|
278 |
+
* @return void
|
279 |
+
*/
|
280 |
+
protected function populateStructure()
|
281 |
+
{
|
282 |
+
$treeStructure = array(
|
283 |
+
'payment_transaction' => array(
|
284 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYOUT,
|
285 |
+
'transaction_id' => $this->transaction_id,
|
286 |
+
'usage' => $this->usage,
|
287 |
+
'amount' => $this->transform(
|
288 |
+
'amount',
|
289 |
+
array(
|
290 |
+
$this->amount,
|
291 |
+
$this->currency,
|
292 |
+
)
|
293 |
+
),
|
294 |
+
'currency' => $this->currency,
|
295 |
+
'remote_ip' => $this->remote_ip,
|
296 |
+
'card_holder' => $this->card_holder,
|
297 |
+
'card_number' => $this->card_number,
|
298 |
+
'cvv' => $this->cvv,
|
299 |
+
'expiration_month' => $this->expiration_month,
|
300 |
+
'expiration_year' => $this->expiration_year,
|
301 |
+
'customer_email' => $this->customer_email,
|
302 |
+
'customer_phone' => $this->customer_phone,
|
303 |
+
'billing_address' => array(
|
304 |
+
'first_name' => $this->billing_first_name,
|
305 |
+
'last_name' => $this->billing_last_name,
|
306 |
+
'address1' => $this->billing_address1,
|
307 |
+
'address2' => $this->billing_address2,
|
308 |
+
'zip_code' => $this->billing_zip_code,
|
309 |
+
'city' => $this->billing_city,
|
310 |
+
'state' => $this->billing_state,
|
311 |
+
'country' => $this->billing_country,
|
312 |
+
),
|
313 |
+
'shipping_address' => array(
|
314 |
+
'first_name' => $this->shipping_first_name,
|
315 |
+
'last_name' => $this->shipping_last_name,
|
316 |
+
'address1' => $this->shipping_address1,
|
317 |
+
'address2' => $this->shipping_address2,
|
318 |
+
'zip_code' => $this->shipping_zip_code,
|
319 |
+
'city' => $this->shipping_city,
|
320 |
+
'state' => $this->shipping_state,
|
321 |
+
'country' => $this->shipping_country,
|
322 |
+
)
|
323 |
+
)
|
324 |
+
);
|
325 |
+
|
326 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
327 |
+
}
|
328 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/InitRecurringSale.php
ADDED
@@ -0,0 +1,448 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards\Recurring;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* InitRecurringSale Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class InitRecurringSale extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Signifies whether a gaming transaction is performed.
|
49 |
+
*
|
50 |
+
* Gaming transactions usually use MCC 7995, contact tech support for more details.
|
51 |
+
*
|
52 |
+
* @var bool
|
53 |
+
*/
|
54 |
+
protected $gaming;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Signifies whether a MOTO (mail order telephone order) transaction is performed.
|
58 |
+
*
|
59 |
+
* Contact tech support for more details.
|
60 |
+
*
|
61 |
+
* @var bool
|
62 |
+
*/
|
63 |
+
protected $moto;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* IPv4 address of customer
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
protected $remote_ip;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Amount of transaction in minor currency unit
|
74 |
+
*
|
75 |
+
* @var int|float|double
|
76 |
+
*/
|
77 |
+
protected $amount;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Currency code in ISO-4217
|
81 |
+
*
|
82 |
+
* @var string
|
83 |
+
*/
|
84 |
+
protected $currency;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
88 |
+
*
|
89 |
+
* @var string
|
90 |
+
*/
|
91 |
+
protected $card_holder;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Complete CC number of customer
|
95 |
+
*
|
96 |
+
* @var int
|
97 |
+
*/
|
98 |
+
protected $card_number;
|
99 |
+
|
100 |
+
/**
|
101 |
+
* CVV of CC, requirement is based on terminal configuration
|
102 |
+
*
|
103 |
+
* @var int
|
104 |
+
*/
|
105 |
+
protected $cvv;
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Expiration month as printed on credit card
|
109 |
+
*
|
110 |
+
* @var string (mm)
|
111 |
+
*/
|
112 |
+
protected $expiration_month;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Expiration year as printed on credit card
|
116 |
+
*
|
117 |
+
* @var string (yyyy)
|
118 |
+
*/
|
119 |
+
protected $expiration_year;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Email address of the Customer
|
123 |
+
*
|
124 |
+
* @var string
|
125 |
+
*/
|
126 |
+
protected $customer_email;
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Phone number of the customer
|
130 |
+
*
|
131 |
+
* @var string
|
132 |
+
*/
|
133 |
+
protected $customer_phone;
|
134 |
+
|
135 |
+
/**
|
136 |
+
*Customer's Billing Address: First name
|
137 |
+
*
|
138 |
+
* @var string
|
139 |
+
*/
|
140 |
+
protected $billing_first_name;
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Customer's Billing Address: Last name
|
144 |
+
*
|
145 |
+
* @var string
|
146 |
+
*/
|
147 |
+
protected $billing_last_name;
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Customer's Billing Address: Part 1
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $billing_address1;
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Customer's Billing Address: Part 2
|
158 |
+
* @var string
|
159 |
+
*/
|
160 |
+
protected $billing_address2;
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Customer's Billing Address: ZIP
|
164 |
+
*
|
165 |
+
* @var string
|
166 |
+
*/
|
167 |
+
protected $billing_zip_code;
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Customer's Billing Address: City
|
171 |
+
*
|
172 |
+
* @var string
|
173 |
+
*/
|
174 |
+
protected $billing_city;
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Customer's Billing Address: State
|
178 |
+
*
|
179 |
+
* format: ISO-3166-2
|
180 |
+
*
|
181 |
+
* @var string
|
182 |
+
*/
|
183 |
+
protected $billing_state;
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Customer's Billing Address: Country
|
187 |
+
*
|
188 |
+
* format: ISO-3166
|
189 |
+
*
|
190 |
+
* @var string
|
191 |
+
*/
|
192 |
+
protected $billing_country;
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Customer's Shipping Address: First name
|
196 |
+
*
|
197 |
+
* @var string
|
198 |
+
*/
|
199 |
+
protected $shipping_first_name;
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Customer's Shipping Address: Last name
|
203 |
+
*
|
204 |
+
* @var string
|
205 |
+
*/
|
206 |
+
protected $shipping_last_name;
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Customer's Shipping Address: Part 1
|
210 |
+
*
|
211 |
+
* @var string
|
212 |
+
*/
|
213 |
+
protected $shipping_address1;
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Customer's Shipping Address: Part 2
|
217 |
+
*
|
218 |
+
* @var string
|
219 |
+
*/
|
220 |
+
protected $shipping_address2;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Customer's Shipping Address: ZIP
|
224 |
+
*
|
225 |
+
* @var string
|
226 |
+
*/
|
227 |
+
protected $shipping_zip_code;
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Customer's Shipping Address: City
|
231 |
+
*
|
232 |
+
* @var string
|
233 |
+
*/
|
234 |
+
protected $shipping_city;
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Customer's Shipping Address: State
|
238 |
+
*
|
239 |
+
* format: ISO-3166-2
|
240 |
+
*
|
241 |
+
* @var string
|
242 |
+
*/
|
243 |
+
protected $shipping_state;
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Customer's Shipping Address
|
247 |
+
*
|
248 |
+
* format: ISO-3166
|
249 |
+
*
|
250 |
+
* @var string
|
251 |
+
*/
|
252 |
+
protected $shipping_country;
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Social Security number or equivalent value for non US customers.
|
256 |
+
*
|
257 |
+
* @var string
|
258 |
+
*/
|
259 |
+
protected $risk_ssn;
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Customer's MAC address
|
263 |
+
*
|
264 |
+
* @var string
|
265 |
+
*/
|
266 |
+
protected $risk_mac_address;
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Customer's Session Id
|
270 |
+
*
|
271 |
+
* @var string
|
272 |
+
*/
|
273 |
+
protected $risk_session_id;
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Customer's User Id
|
277 |
+
*
|
278 |
+
* @var string
|
279 |
+
*/
|
280 |
+
protected $risk_user_id;
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Customer's User Level
|
284 |
+
*
|
285 |
+
* @var string
|
286 |
+
*/
|
287 |
+
protected $risk_user_level;
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Customer's Email address
|
291 |
+
*
|
292 |
+
* @note Set here if different from
|
293 |
+
* shipping / billing
|
294 |
+
*
|
295 |
+
* @var string
|
296 |
+
*/
|
297 |
+
protected $risk_email;
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Customer's Phone number
|
301 |
+
*
|
302 |
+
* @note Set here if different from
|
303 |
+
* shipping / billing
|
304 |
+
*
|
305 |
+
* @var string
|
306 |
+
*/
|
307 |
+
protected $risk_phone;
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Customer's IP address
|
311 |
+
*
|
312 |
+
* @note Set here if different from remote_ip
|
313 |
+
*
|
314 |
+
* @var string
|
315 |
+
*/
|
316 |
+
protected $risk_remote_ip;
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Customer's Serial Number
|
320 |
+
*
|
321 |
+
* @var string
|
322 |
+
*/
|
323 |
+
protected $risk_serial_number;
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Allows to dynamically override the charge descriptor
|
327 |
+
*
|
328 |
+
* @var string
|
329 |
+
*/
|
330 |
+
protected $dynamic_merchant_name;
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Allows to dynamically override the mer- chant phone number
|
334 |
+
*
|
335 |
+
* @var string
|
336 |
+
*/
|
337 |
+
protected $dynamic_merchant_city;
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Set the per-request configuration
|
341 |
+
*
|
342 |
+
* @return void
|
343 |
+
*/
|
344 |
+
protected function initConfiguration()
|
345 |
+
{
|
346 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
347 |
+
array(
|
348 |
+
'protocol' => 'https',
|
349 |
+
'port' => 443,
|
350 |
+
'type' => 'POST',
|
351 |
+
'format' => 'xml',
|
352 |
+
)
|
353 |
+
);
|
354 |
+
|
355 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Set the required fields
|
360 |
+
*
|
361 |
+
* @return void
|
362 |
+
*/
|
363 |
+
protected function setRequiredFields()
|
364 |
+
{
|
365 |
+
$requiredFields = array(
|
366 |
+
'transaction_id',
|
367 |
+
'amount',
|
368 |
+
'currency',
|
369 |
+
'card_holder',
|
370 |
+
'card_number',
|
371 |
+
'expiration_month',
|
372 |
+
'expiration_year',
|
373 |
+
);
|
374 |
+
|
375 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Create the request's Tree structure
|
380 |
+
*
|
381 |
+
* @return void
|
382 |
+
*/
|
383 |
+
protected function populateStructure()
|
384 |
+
{
|
385 |
+
$treeStructure = array(
|
386 |
+
'payment_transaction' => array(
|
387 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE,
|
388 |
+
'transaction_id' => $this->transaction_id,
|
389 |
+
'usage' => $this->usage,
|
390 |
+
'gaming' => $this->gaming,
|
391 |
+
'moto' => $this->moto,
|
392 |
+
'remote_ip' => $this->remote_ip,
|
393 |
+
'amount' => $this->transform(
|
394 |
+
'amount',
|
395 |
+
array(
|
396 |
+
$this->amount,
|
397 |
+
$this->currency,
|
398 |
+
)
|
399 |
+
),
|
400 |
+
'currency' => $this->currency,
|
401 |
+
'card_holder' => $this->card_holder,
|
402 |
+
'card_number' => $this->card_number,
|
403 |
+
'cvv' => $this->cvv,
|
404 |
+
'expiration_month' => $this->expiration_month,
|
405 |
+
'expiration_year' => $this->expiration_year,
|
406 |
+
'customer_email' => $this->customer_email,
|
407 |
+
'customer_phone' => $this->customer_phone,
|
408 |
+
'billing_address' => array(
|
409 |
+
'first_name' => $this->billing_first_name,
|
410 |
+
'last_name' => $this->billing_last_name,
|
411 |
+
'address1' => $this->billing_address1,
|
412 |
+
'address2' => $this->billing_address2,
|
413 |
+
'zip_code' => $this->billing_zip_code,
|
414 |
+
'city' => $this->billing_city,
|
415 |
+
'state' => $this->billing_state,
|
416 |
+
'country' => $this->billing_country,
|
417 |
+
),
|
418 |
+
'shipping_address' => array(
|
419 |
+
'first_name' => $this->shipping_first_name,
|
420 |
+
'last_name' => $this->shipping_last_name,
|
421 |
+
'address1' => $this->shipping_address1,
|
422 |
+
'address2' => $this->shipping_address2,
|
423 |
+
'zip_code' => $this->shipping_zip_code,
|
424 |
+
'city' => $this->shipping_city,
|
425 |
+
'state' => $this->shipping_state,
|
426 |
+
'country' => $this->shipping_country,
|
427 |
+
),
|
428 |
+
'risk_params' => array(
|
429 |
+
'ssn' => $this->risk_ssn,
|
430 |
+
'mac_address' => $this->risk_mac_address,
|
431 |
+
'session_id' => $this->risk_session_id,
|
432 |
+
'user_id' => $this->risk_user_id,
|
433 |
+
'user_level' => $this->risk_user_level,
|
434 |
+
'email' => $this->risk_email,
|
435 |
+
'phone' => $this->risk_phone,
|
436 |
+
'remote_ip' => $this->risk_remote_ip,
|
437 |
+
'serial_number' => $this->risk_serial_number,
|
438 |
+
),
|
439 |
+
'dynamic_descriptor_params' => array(
|
440 |
+
'merchant_name' => $this->dynamic_merchant_name,
|
441 |
+
'merchant_city' => $this->dynamic_merchant_city,
|
442 |
+
)
|
443 |
+
)
|
444 |
+
);
|
445 |
+
|
446 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
447 |
+
}
|
448 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/InitRecurringSale3D.php
ADDED
@@ -0,0 +1,514 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards\Recurring;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* InitRecurringSale 3D Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class InitRecurringSale3D extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Signifies whether a gaming transaction is performed.
|
49 |
+
*
|
50 |
+
* Gaming transactions usually use MCC 7995, contact tech support for more details.
|
51 |
+
*
|
52 |
+
* @var bool
|
53 |
+
*/
|
54 |
+
protected $gaming;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Signifies whether a MOTO (mail order telephone order) transaction is performed.
|
58 |
+
*
|
59 |
+
* Contact tech support for more details.
|
60 |
+
*
|
61 |
+
* @var bool
|
62 |
+
*/
|
63 |
+
protected $moto;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* IPv4 address of customer
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
protected $remote_ip;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* URL endpoint for Genesis Notifications
|
74 |
+
*
|
75 |
+
* @var string
|
76 |
+
*/
|
77 |
+
protected $notification_url;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* URL where customer is sent to after successful payment
|
81 |
+
*
|
82 |
+
* @var string
|
83 |
+
*/
|
84 |
+
protected $return_success_url;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* URL where customer is sent to after un-successful payment
|
88 |
+
*
|
89 |
+
* @var string
|
90 |
+
*/
|
91 |
+
protected $return_failure_url;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Amount of transaction in minor currency unit
|
95 |
+
*
|
96 |
+
* @var int|float|double
|
97 |
+
*/
|
98 |
+
protected $amount;
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Currency code in ISO-4217
|
102 |
+
*
|
103 |
+
* @var string
|
104 |
+
*/
|
105 |
+
protected $currency;
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
109 |
+
*
|
110 |
+
* @var string
|
111 |
+
*/
|
112 |
+
protected $card_holder;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Complete CC number of customer
|
116 |
+
*
|
117 |
+
* @var int
|
118 |
+
*/
|
119 |
+
protected $card_number;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* CVV of CC, requirement is based on terminal configuration
|
123 |
+
*
|
124 |
+
* @var int
|
125 |
+
*/
|
126 |
+
protected $cvv;
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Expiration month as printed on credit card
|
130 |
+
*
|
131 |
+
* @var string (mm)
|
132 |
+
*/
|
133 |
+
protected $expiration_month;
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Expiration year as printed on credit card
|
137 |
+
*
|
138 |
+
* @var string (yyyy)
|
139 |
+
*/
|
140 |
+
protected $expiration_year;
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Email address of the Customer
|
144 |
+
*
|
145 |
+
* @var string
|
146 |
+
*/
|
147 |
+
protected $customer_email;
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Phone number of the customer
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $customer_phone;
|
155 |
+
|
156 |
+
/**
|
157 |
+
*Customer's Billing Address: First name
|
158 |
+
*
|
159 |
+
* @var string
|
160 |
+
*/
|
161 |
+
protected $billing_first_name;
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Customer's Billing Address: Last name
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $billing_last_name;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Billing Address: Part 1
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $billing_address1;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Billing Address: Part 2
|
179 |
+
* @var string
|
180 |
+
*/
|
181 |
+
protected $billing_address2;
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Customer's Billing Address: ZIP
|
185 |
+
*
|
186 |
+
* @var string
|
187 |
+
*/
|
188 |
+
protected $billing_zip_code;
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Customer's Billing Address: City
|
192 |
+
*
|
193 |
+
* @var string
|
194 |
+
*/
|
195 |
+
protected $billing_city;
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Customer's Billing Address: State
|
199 |
+
*
|
200 |
+
* format: ISO-3166-2
|
201 |
+
*
|
202 |
+
* @var string
|
203 |
+
*/
|
204 |
+
protected $billing_state;
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Customer's Billing Address: Country
|
208 |
+
*
|
209 |
+
* format: ISO-3166
|
210 |
+
*
|
211 |
+
* @var string
|
212 |
+
*/
|
213 |
+
protected $billing_country;
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Customer's Shipping Address: First name
|
217 |
+
*
|
218 |
+
* @var string
|
219 |
+
*/
|
220 |
+
protected $shipping_first_name;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Customer's Shipping Address: Last name
|
224 |
+
*
|
225 |
+
* @var string
|
226 |
+
*/
|
227 |
+
protected $shipping_last_name;
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Customer's Shipping Address: Part 1
|
231 |
+
*
|
232 |
+
* @var string
|
233 |
+
*/
|
234 |
+
protected $shipping_address1;
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Customer's Shipping Address: Part 2
|
238 |
+
*
|
239 |
+
* @var string
|
240 |
+
*/
|
241 |
+
protected $shipping_address2;
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Customer's Shipping Address: ZIP
|
245 |
+
*
|
246 |
+
* @var string
|
247 |
+
*/
|
248 |
+
protected $shipping_zip_code;
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Customer's Shipping Address: City
|
252 |
+
*
|
253 |
+
* @var string
|
254 |
+
*/
|
255 |
+
protected $shipping_city;
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Customer's Shipping Address: State
|
259 |
+
*
|
260 |
+
* format: ISO-3166-2
|
261 |
+
*
|
262 |
+
* @var string
|
263 |
+
*/
|
264 |
+
protected $shipping_state;
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Customer's Shipping Address
|
268 |
+
*
|
269 |
+
* format: ISO-3166
|
270 |
+
*
|
271 |
+
* @var string
|
272 |
+
*/
|
273 |
+
protected $shipping_country;
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Social Security number or equivalent value for non US customers.
|
277 |
+
*
|
278 |
+
* @var string
|
279 |
+
*/
|
280 |
+
protected $risk_ssn;
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Customer's MAC address
|
284 |
+
*
|
285 |
+
* @var string
|
286 |
+
*/
|
287 |
+
protected $risk_mac_address;
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Customer's Session Id
|
291 |
+
*
|
292 |
+
* @var string
|
293 |
+
*/
|
294 |
+
protected $risk_session_id;
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Customer's User Id
|
298 |
+
*
|
299 |
+
* @var string
|
300 |
+
*/
|
301 |
+
protected $risk_user_id;
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Customer's User Level
|
305 |
+
*
|
306 |
+
* @var string
|
307 |
+
*/
|
308 |
+
protected $risk_user_level;
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Customer's Email address
|
312 |
+
*
|
313 |
+
* @note Set here if different from
|
314 |
+
* shipping / billing
|
315 |
+
*
|
316 |
+
* @var string
|
317 |
+
*/
|
318 |
+
protected $risk_email;
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Customer's Phone number
|
322 |
+
*
|
323 |
+
* @note Set here if different from
|
324 |
+
* shipping / billing
|
325 |
+
*
|
326 |
+
* @var string
|
327 |
+
*/
|
328 |
+
protected $risk_phone;
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Customer's IP address
|
332 |
+
*
|
333 |
+
* @note Set here if different from remote_ip
|
334 |
+
*
|
335 |
+
* @var string
|
336 |
+
*/
|
337 |
+
protected $risk_remote_ip;
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Customer's Serial Number
|
341 |
+
*
|
342 |
+
* @var string
|
343 |
+
*/
|
344 |
+
protected $risk_serial_number;
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Verification Id of the authentication.
|
348 |
+
*
|
349 |
+
* Please note this can be the CAVV for Visa Card or UCAF to identify MasterCard.
|
350 |
+
*
|
351 |
+
* @var string
|
352 |
+
*/
|
353 |
+
protected $mpi_cavv;
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Electric Commerce Indicator as returned from the MPI.
|
357 |
+
*
|
358 |
+
* @var string
|
359 |
+
*/
|
360 |
+
protected $mpi_eci;
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Transaction ID generated by the 3D Secure service
|
364 |
+
* that uniquely identifies a 3D Secure check request
|
365 |
+
*
|
366 |
+
* @var string
|
367 |
+
*/
|
368 |
+
protected $mpi_xid;
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Allows to dynamically override the charge descriptor
|
372 |
+
*
|
373 |
+
* @var string
|
374 |
+
*/
|
375 |
+
protected $dynamic_merchant_name;
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Allows to dynamically override the mer- chant phone number
|
379 |
+
*
|
380 |
+
* @var string
|
381 |
+
*/
|
382 |
+
protected $dynamic_merchant_city;
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Set the per-request configuration
|
386 |
+
*
|
387 |
+
* @return void
|
388 |
+
*/
|
389 |
+
protected function initConfiguration()
|
390 |
+
{
|
391 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(array(
|
392 |
+
'protocol' => 'https',
|
393 |
+
'port' => 443,
|
394 |
+
'type' => 'POST',
|
395 |
+
'format' => 'xml',
|
396 |
+
));
|
397 |
+
|
398 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Set the required fields
|
403 |
+
*
|
404 |
+
* @return void
|
405 |
+
*/
|
406 |
+
protected function setRequiredFields()
|
407 |
+
{
|
408 |
+
$requiredFields = array(
|
409 |
+
'transaction_id',
|
410 |
+
'amount',
|
411 |
+
'currency',
|
412 |
+
'card_holder',
|
413 |
+
'card_number',
|
414 |
+
'expiration_month',
|
415 |
+
'expiration_year',
|
416 |
+
);
|
417 |
+
|
418 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
419 |
+
|
420 |
+
$requiredFieldsConditional = array(
|
421 |
+
'notification_url' => array('return_success_url', 'return_failure_url'),
|
422 |
+
'return_success_url' => array('notification_url', 'return_failure_url'),
|
423 |
+
'return_failure_url' => array('notification_url', 'return_success_url'),
|
424 |
+
);
|
425 |
+
|
426 |
+
$this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
|
427 |
+
|
428 |
+
$requiredFieldsGroups = array(
|
429 |
+
'synchronous' => array('notification_url', 'return_success_url', 'return_failure_url'),
|
430 |
+
'asynchronous' => array('mpi_eci'),
|
431 |
+
);
|
432 |
+
|
433 |
+
$this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Create the request's Tree structure
|
438 |
+
*
|
439 |
+
* @return void
|
440 |
+
*/
|
441 |
+
protected function populateStructure()
|
442 |
+
{
|
443 |
+
$treeStructure = array(
|
444 |
+
'payment_transaction' => array(
|
445 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D,
|
446 |
+
'transaction_id' => $this->transaction_id,
|
447 |
+
'usage' => $this->usage,
|
448 |
+
'gaming' => $this->gaming,
|
449 |
+
'moto' => $this->moto,
|
450 |
+
'remote_ip' => $this->remote_ip,
|
451 |
+
'notification_url' => $this->notification_url,
|
452 |
+
'return_success_url' => $this->return_success_url,
|
453 |
+
'return_failure_url' => $this->return_failure_url,
|
454 |
+
'amount' => $this->transform(
|
455 |
+
'amount',
|
456 |
+
array(
|
457 |
+
$this->amount,
|
458 |
+
$this->currency,
|
459 |
+
)
|
460 |
+
),
|
461 |
+
'currency' => $this->currency,
|
462 |
+
'card_holder' => $this->card_holder,
|
463 |
+
'card_number' => $this->card_number,
|
464 |
+
'cvv' => $this->cvv,
|
465 |
+
'expiration_month' => $this->expiration_month,
|
466 |
+
'expiration_year' => $this->expiration_year,
|
467 |
+
'customer_email' => $this->customer_email,
|
468 |
+
'customer_phone' => $this->customer_phone,
|
469 |
+
'billing_address' => array(
|
470 |
+
'first_name' => $this->billing_first_name,
|
471 |
+
'last_name' => $this->billing_last_name,
|
472 |
+
'address1' => $this->billing_address1,
|
473 |
+
'address2' => $this->billing_address2,
|
474 |
+
'zip_code' => $this->billing_zip_code,
|
475 |
+
'city' => $this->billing_city,
|
476 |
+
'state' => $this->billing_state,
|
477 |
+
'country' => $this->billing_country,
|
478 |
+
),
|
479 |
+
'shipping_address' => array(
|
480 |
+
'first_name' => $this->shipping_first_name,
|
481 |
+
'last_name' => $this->shipping_last_name,
|
482 |
+
'address1' => $this->shipping_address1,
|
483 |
+
'address2' => $this->shipping_address2,
|
484 |
+
'zip_code' => $this->shipping_zip_code,
|
485 |
+
'city' => $this->shipping_city,
|
486 |
+
'state' => $this->shipping_state,
|
487 |
+
'country' => $this->shipping_country,
|
488 |
+
),
|
489 |
+
'mpi_params' => array(
|
490 |
+
'cavv' => $this->mpi_cavv,
|
491 |
+
'eci' => $this->mpi_eci,
|
492 |
+
'xid' => $this->mpi_xid,
|
493 |
+
),
|
494 |
+
'risk_params' => array(
|
495 |
+
'ssn' => $this->risk_ssn,
|
496 |
+
'mac_address' => $this->risk_mac_address,
|
497 |
+
'session_id' => $this->risk_session_id,
|
498 |
+
'user_id' => $this->risk_user_id,
|
499 |
+
'user_level' => $this->risk_user_level,
|
500 |
+
'email' => $this->risk_email,
|
501 |
+
'phone' => $this->risk_phone,
|
502 |
+
'remote_ip' => $this->risk_remote_ip,
|
503 |
+
'serial_number' => $this->risk_serial_number,
|
504 |
+
),
|
505 |
+
'dynamic_descriptor_params' => array(
|
506 |
+
'merchant_name' => $this->dynamic_merchant_name,
|
507 |
+
'merchant_city' => $this->dynamic_merchant_city,
|
508 |
+
)
|
509 |
+
)
|
510 |
+
);
|
511 |
+
|
512 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
513 |
+
}
|
514 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/RecurringSale.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards\Recurring;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Recurring Sale Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class RecurringSale extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* IPv4 address of customer
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
protected $remote_ip;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Amount of transaction in minor currency unit
|
56 |
+
*
|
57 |
+
* @var int|float|double
|
58 |
+
*/
|
59 |
+
protected $amount;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Currency code in ISO-4217
|
63 |
+
*
|
64 |
+
* @var string
|
65 |
+
*/
|
66 |
+
protected $currency;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Unique id of the existing (target) transaction
|
70 |
+
*
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
+
protected $reference_id;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Set the per-request configuration
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
protected function initConfiguration()
|
81 |
+
{
|
82 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
83 |
+
array(
|
84 |
+
'protocol' => 'https',
|
85 |
+
'port' => 443,
|
86 |
+
'type' => 'POST',
|
87 |
+
'format' => 'xml',
|
88 |
+
)
|
89 |
+
);
|
90 |
+
|
91 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Set the required fields
|
96 |
+
*
|
97 |
+
* @return void
|
98 |
+
*/
|
99 |
+
protected function setRequiredFields()
|
100 |
+
{
|
101 |
+
$requiredFields = array(
|
102 |
+
'transaction_id',
|
103 |
+
'reference_id',
|
104 |
+
'amount',
|
105 |
+
'currency'
|
106 |
+
);
|
107 |
+
|
108 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Create the request's Tree structure
|
113 |
+
*
|
114 |
+
* @return void
|
115 |
+
*/
|
116 |
+
protected function populateStructure()
|
117 |
+
{
|
118 |
+
$treeStructure = array(
|
119 |
+
'payment_transaction' => array(
|
120 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::RECURRING_SALE,
|
121 |
+
'transaction_id' => $this->transaction_id,
|
122 |
+
'usage' => $this->usage,
|
123 |
+
'remote_ip' => $this->remote_ip,
|
124 |
+
'reference_id' => $this->reference_id,
|
125 |
+
'amount' => $this->transform(
|
126 |
+
'amount',
|
127 |
+
array(
|
128 |
+
$this->amount,
|
129 |
+
$this->currency,
|
130 |
+
)
|
131 |
+
),
|
132 |
+
'currency' => $this->currency
|
133 |
+
)
|
134 |
+
);
|
135 |
+
|
136 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
137 |
+
}
|
138 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Sale.php
ADDED
@@ -0,0 +1,448 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Sale Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Sale extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Signifies whether a gaming transaction is performed.
|
49 |
+
*
|
50 |
+
* Gaming transactions usually use MCC 7995, contact tech support for more details.
|
51 |
+
*
|
52 |
+
* @var bool
|
53 |
+
*/
|
54 |
+
protected $gaming;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Signifies whether a MOTO (mail order telephone order) transaction is performed.
|
58 |
+
*
|
59 |
+
* Contact tech support for more details.
|
60 |
+
*
|
61 |
+
* @var bool
|
62 |
+
*/
|
63 |
+
protected $moto;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* IPv4 address of customer
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
protected $remote_ip;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Amount of transaction in minor currency unit
|
74 |
+
*
|
75 |
+
* @var int|float|double
|
76 |
+
*/
|
77 |
+
protected $amount;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Currency code in ISO-4217
|
81 |
+
*
|
82 |
+
* @var string
|
83 |
+
*/
|
84 |
+
protected $currency;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
88 |
+
*
|
89 |
+
* @var string
|
90 |
+
*/
|
91 |
+
protected $card_holder;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Complete CC number of customer
|
95 |
+
*
|
96 |
+
* @var int
|
97 |
+
*/
|
98 |
+
protected $card_number;
|
99 |
+
|
100 |
+
/**
|
101 |
+
* CVV of CC, requirement is based on terminal configuration
|
102 |
+
*
|
103 |
+
* @var int
|
104 |
+
*/
|
105 |
+
protected $cvv;
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Expiration month as printed on credit card
|
109 |
+
*
|
110 |
+
* @var string (mm)
|
111 |
+
*/
|
112 |
+
protected $expiration_month;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Expiration year as printed on credit card
|
116 |
+
*
|
117 |
+
* @var string (yyyy)
|
118 |
+
*/
|
119 |
+
protected $expiration_year;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Email address of the Customer
|
123 |
+
*
|
124 |
+
* @var string
|
125 |
+
*/
|
126 |
+
protected $customer_email;
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Phone number of the customer
|
130 |
+
*
|
131 |
+
* @var string
|
132 |
+
*/
|
133 |
+
protected $customer_phone;
|
134 |
+
|
135 |
+
/**
|
136 |
+
*Customer's Billing Address: First name
|
137 |
+
*
|
138 |
+
* @var string
|
139 |
+
*/
|
140 |
+
protected $billing_first_name;
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Customer's Billing Address: Last name
|
144 |
+
*
|
145 |
+
* @var string
|
146 |
+
*/
|
147 |
+
protected $billing_last_name;
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Customer's Billing Address: Part 1
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $billing_address1;
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Customer's Billing Address: Part 2
|
158 |
+
* @var string
|
159 |
+
*/
|
160 |
+
protected $billing_address2;
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Customer's Billing Address: ZIP
|
164 |
+
*
|
165 |
+
* @var string
|
166 |
+
*/
|
167 |
+
protected $billing_zip_code;
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Customer's Billing Address: City
|
171 |
+
*
|
172 |
+
* @var string
|
173 |
+
*/
|
174 |
+
protected $billing_city;
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Customer's Billing Address: State
|
178 |
+
*
|
179 |
+
* format: ISO-3166-2
|
180 |
+
*
|
181 |
+
* @var string
|
182 |
+
*/
|
183 |
+
protected $billing_state;
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Customer's Billing Address: Country
|
187 |
+
*
|
188 |
+
* format: ISO-3166
|
189 |
+
*
|
190 |
+
* @var string
|
191 |
+
*/
|
192 |
+
protected $billing_country;
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Customer's Shipping Address: First name
|
196 |
+
*
|
197 |
+
* @var string
|
198 |
+
*/
|
199 |
+
protected $shipping_first_name;
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Customer's Shipping Address: Last name
|
203 |
+
*
|
204 |
+
* @var string
|
205 |
+
*/
|
206 |
+
protected $shipping_last_name;
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Customer's Shipping Address: Part 1
|
210 |
+
*
|
211 |
+
* @var string
|
212 |
+
*/
|
213 |
+
protected $shipping_address1;
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Customer's Shipping Address: Part 2
|
217 |
+
*
|
218 |
+
* @var string
|
219 |
+
*/
|
220 |
+
protected $shipping_address2;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Customer's Shipping Address: ZIP
|
224 |
+
*
|
225 |
+
* @var string
|
226 |
+
*/
|
227 |
+
protected $shipping_zip_code;
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Customer's Shipping Address: City
|
231 |
+
*
|
232 |
+
* @var string
|
233 |
+
*/
|
234 |
+
protected $shipping_city;
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Customer's Shipping Address: State
|
238 |
+
*
|
239 |
+
* format: ISO-3166-2
|
240 |
+
*
|
241 |
+
* @var string
|
242 |
+
*/
|
243 |
+
protected $shipping_state;
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Customer's Shipping Address
|
247 |
+
*
|
248 |
+
* format: ISO-3166
|
249 |
+
*
|
250 |
+
* @var string
|
251 |
+
*/
|
252 |
+
protected $shipping_country;
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Social Security number or equivalent value for non US customers.
|
256 |
+
*
|
257 |
+
* @var string
|
258 |
+
*/
|
259 |
+
protected $risk_ssn;
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Customer's MAC address
|
263 |
+
*
|
264 |
+
* @var string
|
265 |
+
*/
|
266 |
+
protected $risk_mac_address;
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Customer's Session Id
|
270 |
+
*
|
271 |
+
* @var string
|
272 |
+
*/
|
273 |
+
protected $risk_session_id;
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Customer's User Id
|
277 |
+
*
|
278 |
+
* @var string
|
279 |
+
*/
|
280 |
+
protected $risk_user_id;
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Customer's User Level
|
284 |
+
*
|
285 |
+
* @var string
|
286 |
+
*/
|
287 |
+
protected $risk_user_level;
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Customer's Email address
|
291 |
+
*
|
292 |
+
* @note Set here if different from
|
293 |
+
* shipping / billing
|
294 |
+
*
|
295 |
+
* @var string
|
296 |
+
*/
|
297 |
+
protected $risk_email;
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Customer's Phone number
|
301 |
+
*
|
302 |
+
* @note Set here if different from
|
303 |
+
* shipping / billing
|
304 |
+
*
|
305 |
+
* @var string
|
306 |
+
*/
|
307 |
+
protected $risk_phone;
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Customer's IP address
|
311 |
+
*
|
312 |
+
* @note Set here if different from remote_ip
|
313 |
+
*
|
314 |
+
* @var string
|
315 |
+
*/
|
316 |
+
protected $risk_remote_ip;
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Customer's Serial Number
|
320 |
+
*
|
321 |
+
* @var string
|
322 |
+
*/
|
323 |
+
protected $risk_serial_number;
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Allows to dynamically override the charge descriptor
|
327 |
+
*
|
328 |
+
* @var string
|
329 |
+
*/
|
330 |
+
protected $dynamic_merchant_name;
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Allows to dynamically override the mer- chant phone number
|
334 |
+
*
|
335 |
+
* @var string
|
336 |
+
*/
|
337 |
+
protected $dynamic_merchant_city;
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Set the per-request configuration
|
341 |
+
*
|
342 |
+
* @return void
|
343 |
+
*/
|
344 |
+
protected function initConfiguration()
|
345 |
+
{
|
346 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
347 |
+
array(
|
348 |
+
'protocol' => 'https',
|
349 |
+
'port' => 443,
|
350 |
+
'type' => 'POST',
|
351 |
+
'format' => 'xml',
|
352 |
+
)
|
353 |
+
);
|
354 |
+
|
355 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Set the required fields
|
360 |
+
*
|
361 |
+
* @return void
|
362 |
+
*/
|
363 |
+
protected function setRequiredFields()
|
364 |
+
{
|
365 |
+
$requiredFields = array(
|
366 |
+
'transaction_id',
|
367 |
+
'amount',
|
368 |
+
'currency',
|
369 |
+
'card_holder',
|
370 |
+
'card_number',
|
371 |
+
'expiration_month',
|
372 |
+
'expiration_year',
|
373 |
+
);
|
374 |
+
|
375 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Create the request's Tree structure
|
380 |
+
*
|
381 |
+
* @return void
|
382 |
+
*/
|
383 |
+
protected function populateStructure()
|
384 |
+
{
|
385 |
+
$treeStructure = array(
|
386 |
+
'payment_transaction' => array(
|
387 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::SALE,
|
388 |
+
'transaction_id' => $this->transaction_id,
|
389 |
+
'usage' => $this->usage,
|
390 |
+
'gaming' => $this->gaming,
|
391 |
+
'moto' => $this->moto,
|
392 |
+
'remote_ip' => $this->remote_ip,
|
393 |
+
'amount' => $this->transform(
|
394 |
+
'amount',
|
395 |
+
array(
|
396 |
+
$this->amount,
|
397 |
+
$this->currency,
|
398 |
+
)
|
399 |
+
),
|
400 |
+
'currency' => $this->currency,
|
401 |
+
'card_holder' => $this->card_holder,
|
402 |
+
'card_number' => $this->card_number,
|
403 |
+
'cvv' => $this->cvv,
|
404 |
+
'expiration_month' => $this->expiration_month,
|
405 |
+
'expiration_year' => $this->expiration_year,
|
406 |
+
'customer_email' => $this->customer_email,
|
407 |
+
'customer_phone' => $this->customer_phone,
|
408 |
+
'billing_address' => array(
|
409 |
+
'first_name' => $this->billing_first_name,
|
410 |
+
'last_name' => $this->billing_last_name,
|
411 |
+
'address1' => $this->billing_address1,
|
412 |
+
'address2' => $this->billing_address2,
|
413 |
+
'zip_code' => $this->billing_zip_code,
|
414 |
+
'city' => $this->billing_city,
|
415 |
+
'state' => $this->billing_state,
|
416 |
+
'country' => $this->billing_country,
|
417 |
+
),
|
418 |
+
'shipping_address' => array(
|
419 |
+
'first_name' => $this->shipping_first_name,
|
420 |
+
'last_name' => $this->shipping_last_name,
|
421 |
+
'address1' => $this->shipping_address1,
|
422 |
+
'address2' => $this->shipping_address2,
|
423 |
+
'zip_code' => $this->shipping_zip_code,
|
424 |
+
'city' => $this->shipping_city,
|
425 |
+
'state' => $this->shipping_state,
|
426 |
+
'country' => $this->shipping_country,
|
427 |
+
),
|
428 |
+
'risk_params' => array(
|
429 |
+
'ssn' => $this->risk_ssn,
|
430 |
+
'mac_address' => $this->risk_mac_address,
|
431 |
+
'session_id' => $this->risk_session_id,
|
432 |
+
'user_id' => $this->risk_user_id,
|
433 |
+
'user_level' => $this->risk_user_level,
|
434 |
+
'email' => $this->risk_email,
|
435 |
+
'phone' => $this->risk_phone,
|
436 |
+
'remote_ip' => $this->risk_remote_ip,
|
437 |
+
'serial_number' => $this->risk_serial_number,
|
438 |
+
),
|
439 |
+
'dynamic_descriptor_params' => array(
|
440 |
+
'merchant_name' => $this->dynamic_merchant_name,
|
441 |
+
'merchant_city' => $this->dynamic_merchant_city,
|
442 |
+
)
|
443 |
+
)
|
444 |
+
);
|
445 |
+
|
446 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
447 |
+
}
|
448 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Sale3D.php
ADDED
@@ -0,0 +1,514 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Cards;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Sale 3D Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Sale3D extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Signifies whether a gaming transaction is performed.
|
49 |
+
*
|
50 |
+
* Gaming transactions usually use MCC 7995, contact tech support for more details.
|
51 |
+
*
|
52 |
+
* @var bool
|
53 |
+
*/
|
54 |
+
protected $gaming;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Signifies whether a MOTO (mail order telephone order) transaction is performed.
|
58 |
+
*
|
59 |
+
* Contact tech support for more details.
|
60 |
+
*
|
61 |
+
* @var bool
|
62 |
+
*/
|
63 |
+
protected $moto;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* IPv4 address of customer
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
protected $remote_ip;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* URL endpoint for Genesis Notifications
|
74 |
+
*
|
75 |
+
* @var string
|
76 |
+
*/
|
77 |
+
protected $notification_url;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* URL where customer is sent to after successful payment
|
81 |
+
*
|
82 |
+
* @var string
|
83 |
+
*/
|
84 |
+
protected $return_success_url;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* URL where customer is sent to after un-successful payment
|
88 |
+
*
|
89 |
+
* @var string
|
90 |
+
*/
|
91 |
+
protected $return_failure_url;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Amount of transaction in minor currency unit
|
95 |
+
*
|
96 |
+
* @var int|float|double
|
97 |
+
*/
|
98 |
+
protected $amount;
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Currency code in ISO-4217
|
102 |
+
*
|
103 |
+
* @var string
|
104 |
+
*/
|
105 |
+
protected $currency;
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
109 |
+
*
|
110 |
+
* @var string
|
111 |
+
*/
|
112 |
+
protected $card_holder;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Complete CC number of customer
|
116 |
+
*
|
117 |
+
* @var int
|
118 |
+
*/
|
119 |
+
protected $card_number;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* CVV of CC, requirement is based on terminal configuration
|
123 |
+
*
|
124 |
+
* @var int
|
125 |
+
*/
|
126 |
+
protected $cvv;
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Expiration month as printed on credit card
|
130 |
+
*
|
131 |
+
* @var string (mm)
|
132 |
+
*/
|
133 |
+
protected $expiration_month;
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Expiration year as printed on credit card
|
137 |
+
*
|
138 |
+
* @var string (yyyy)
|
139 |
+
*/
|
140 |
+
protected $expiration_year;
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Email address of the Customer
|
144 |
+
*
|
145 |
+
* @var string
|
146 |
+
*/
|
147 |
+
protected $customer_email;
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Phone number of the customer
|
151 |
+
*
|
152 |
+
* @var string
|
153 |
+
*/
|
154 |
+
protected $customer_phone;
|
155 |
+
|
156 |
+
/**
|
157 |
+
*Customer's Billing Address: First name
|
158 |
+
*
|
159 |
+
* @var string
|
160 |
+
*/
|
161 |
+
protected $billing_first_name;
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Customer's Billing Address: Last name
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $billing_last_name;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Billing Address: Part 1
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $billing_address1;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Billing Address: Part 2
|
179 |
+
* @var string
|
180 |
+
*/
|
181 |
+
protected $billing_address2;
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Customer's Billing Address: ZIP
|
185 |
+
*
|
186 |
+
* @var string
|
187 |
+
*/
|
188 |
+
protected $billing_zip_code;
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Customer's Billing Address: City
|
192 |
+
*
|
193 |
+
* @var string
|
194 |
+
*/
|
195 |
+
protected $billing_city;
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Customer's Billing Address: State
|
199 |
+
*
|
200 |
+
* format: ISO-3166-2
|
201 |
+
*
|
202 |
+
* @var string
|
203 |
+
*/
|
204 |
+
protected $billing_state;
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Customer's Billing Address: Country
|
208 |
+
*
|
209 |
+
* format: ISO-3166
|
210 |
+
*
|
211 |
+
* @var string
|
212 |
+
*/
|
213 |
+
protected $billing_country;
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Customer's Shipping Address: First name
|
217 |
+
*
|
218 |
+
* @var string
|
219 |
+
*/
|
220 |
+
protected $shipping_first_name;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Customer's Shipping Address: Last name
|
224 |
+
*
|
225 |
+
* @var string
|
226 |
+
*/
|
227 |
+
protected $shipping_last_name;
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Customer's Shipping Address: Part 1
|
231 |
+
*
|
232 |
+
* @var string
|
233 |
+
*/
|
234 |
+
protected $shipping_address1;
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Customer's Shipping Address: Part 2
|
238 |
+
*
|
239 |
+
* @var string
|
240 |
+
*/
|
241 |
+
protected $shipping_address2;
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Customer's Shipping Address: ZIP
|
245 |
+
*
|
246 |
+
* @var string
|
247 |
+
*/
|
248 |
+
protected $shipping_zip_code;
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Customer's Shipping Address: City
|
252 |
+
*
|
253 |
+
* @var string
|
254 |
+
*/
|
255 |
+
protected $shipping_city;
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Customer's Shipping Address: State
|
259 |
+
*
|
260 |
+
* format: ISO-3166-2
|
261 |
+
*
|
262 |
+
* @var string
|
263 |
+
*/
|
264 |
+
protected $shipping_state;
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Customer's Shipping Address
|
268 |
+
*
|
269 |
+
* format: ISO-3166
|
270 |
+
*
|
271 |
+
* @var string
|
272 |
+
*/
|
273 |
+
protected $shipping_country;
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Social Security number or equivalent value for non US customers.
|
277 |
+
*
|
278 |
+
* @var string
|
279 |
+
*/
|
280 |
+
protected $risk_ssn;
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Customer's MAC address
|
284 |
+
*
|
285 |
+
* @var string
|
286 |
+
*/
|
287 |
+
protected $risk_mac_address;
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Customer's Session Id
|
291 |
+
*
|
292 |
+
* @var string
|
293 |
+
*/
|
294 |
+
protected $risk_session_id;
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Customer's User Id
|
298 |
+
*
|
299 |
+
* @var string
|
300 |
+
*/
|
301 |
+
protected $risk_user_id;
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Customer's User Level
|
305 |
+
*
|
306 |
+
* @var string
|
307 |
+
*/
|
308 |
+
protected $risk_user_level;
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Customer's Email address
|
312 |
+
*
|
313 |
+
* @note Set here if different from
|
314 |
+
* shipping / billing
|
315 |
+
*
|
316 |
+
* @var string
|
317 |
+
*/
|
318 |
+
protected $risk_email;
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Customer's Phone number
|
322 |
+
*
|
323 |
+
* @note Set here if different from
|
324 |
+
* shipping / billing
|
325 |
+
*
|
326 |
+
* @var string
|
327 |
+
*/
|
328 |
+
protected $risk_phone;
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Customer's IP address
|
332 |
+
*
|
333 |
+
* @note Set here if different from remote_ip
|
334 |
+
*
|
335 |
+
* @var string
|
336 |
+
*/
|
337 |
+
protected $risk_remote_ip;
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Customer's Serial Number
|
341 |
+
*
|
342 |
+
* @var string
|
343 |
+
*/
|
344 |
+
protected $risk_serial_number;
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Verification Id of the authentication.
|
348 |
+
*
|
349 |
+
* Please note this can be the CAVV for Visa Card or UCAF to identify MasterCard.
|
350 |
+
*
|
351 |
+
* @var string
|
352 |
+
*/
|
353 |
+
protected $mpi_cavv;
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Electric Commerce Indicator as returned from the MPI.
|
357 |
+
*
|
358 |
+
* @var string
|
359 |
+
*/
|
360 |
+
protected $mpi_eci;
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Transaction ID generated by the 3D Secure service
|
364 |
+
* that uniquely identifies a 3D Secure check request
|
365 |
+
*
|
366 |
+
* @var string
|
367 |
+
*/
|
368 |
+
protected $mpi_xid;
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Allows to dynamically override the charge descriptor
|
372 |
+
*
|
373 |
+
* @var string
|
374 |
+
*/
|
375 |
+
protected $dynamic_merchant_name;
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Allows to dynamically override the mer- chant phone number
|
379 |
+
*
|
380 |
+
* @var string
|
381 |
+
*/
|
382 |
+
protected $dynamic_merchant_city;
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Set the per-request configuration
|
386 |
+
*
|
387 |
+
* @return void
|
388 |
+
*/
|
389 |
+
protected function initConfiguration()
|
390 |
+
{
|
391 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(array(
|
392 |
+
'protocol' => 'https',
|
393 |
+
'port' => 443,
|
394 |
+
'type' => 'POST',
|
395 |
+
'format' => 'xml',
|
396 |
+
));
|
397 |
+
|
398 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Set the required fields
|
403 |
+
*
|
404 |
+
* @return void
|
405 |
+
*/
|
406 |
+
protected function setRequiredFields()
|
407 |
+
{
|
408 |
+
$requiredFields = array(
|
409 |
+
'transaction_id',
|
410 |
+
'amount',
|
411 |
+
'currency',
|
412 |
+
'card_holder',
|
413 |
+
'card_number',
|
414 |
+
'expiration_month',
|
415 |
+
'expiration_year',
|
416 |
+
);
|
417 |
+
|
418 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
419 |
+
|
420 |
+
$requiredFieldsConditional = array(
|
421 |
+
'notification_url' => array('return_success_url', 'return_failure_url'),
|
422 |
+
'return_success_url' => array('notification_url', 'return_failure_url'),
|
423 |
+
'return_failure_url' => array('notification_url', 'return_success_url'),
|
424 |
+
);
|
425 |
+
|
426 |
+
$this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
|
427 |
+
|
428 |
+
$requiredFieldsGroups = array(
|
429 |
+
'synchronous' => array('notification_url', 'return_success_url', 'return_failure_url'),
|
430 |
+
'asynchronous' => array('mpi_eci'),
|
431 |
+
);
|
432 |
+
|
433 |
+
$this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Create the request's Tree structure
|
438 |
+
*
|
439 |
+
* @return void
|
440 |
+
*/
|
441 |
+
protected function populateStructure()
|
442 |
+
{
|
443 |
+
$treeStructure = array(
|
444 |
+
'payment_transaction' => array(
|
445 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::SALE_3D,
|
446 |
+
'transaction_id' => $this->transaction_id,
|
447 |
+
'usage' => $this->usage,
|
448 |
+
'gaming' => $this->gaming,
|
449 |
+
'moto' => $this->moto,
|
450 |
+
'remote_ip' => $this->remote_ip,
|
451 |
+
'notification_url' => $this->notification_url,
|
452 |
+
'return_success_url' => $this->return_success_url,
|
453 |
+
'return_failure_url' => $this->return_failure_url,
|
454 |
+
'amount' => $this->transform(
|
455 |
+
'amount',
|
456 |
+
array(
|
457 |
+
$this->amount,
|
458 |
+
$this->currency,
|
459 |
+
)
|
460 |
+
),
|
461 |
+
'currency' => $this->currency,
|
462 |
+
'card_holder' => $this->card_holder,
|
463 |
+
'card_number' => $this->card_number,
|
464 |
+
'cvv' => $this->cvv,
|
465 |
+
'expiration_month' => $this->expiration_month,
|
466 |
+
'expiration_year' => $this->expiration_year,
|
467 |
+
'customer_email' => $this->customer_email,
|
468 |
+
'customer_phone' => $this->customer_phone,
|
469 |
+
'billing_address' => array(
|
470 |
+
'first_name' => $this->billing_first_name,
|
471 |
+
'last_name' => $this->billing_last_name,
|
472 |
+
'address1' => $this->billing_address1,
|
473 |
+
'address2' => $this->billing_address2,
|
474 |
+
'zip_code' => $this->billing_zip_code,
|
475 |
+
'city' => $this->billing_city,
|
476 |
+
'state' => $this->billing_state,
|
477 |
+
'country' => $this->billing_country,
|
478 |
+
),
|
479 |
+
'shipping_address' => array(
|
480 |
+
'first_name' => $this->shipping_first_name,
|
481 |
+
'last_name' => $this->shipping_last_name,
|
482 |
+
'address1' => $this->shipping_address1,
|
483 |
+
'address2' => $this->shipping_address2,
|
484 |
+
'zip_code' => $this->shipping_zip_code,
|
485 |
+
'city' => $this->shipping_city,
|
486 |
+
'state' => $this->shipping_state,
|
487 |
+
'country' => $this->shipping_country,
|
488 |
+
),
|
489 |
+
'mpi_params' => array(
|
490 |
+
'cavv' => $this->mpi_cavv,
|
491 |
+
'eci' => $this->mpi_eci,
|
492 |
+
'xid' => $this->mpi_xid,
|
493 |
+
),
|
494 |
+
'risk_params' => array(
|
495 |
+
'ssn' => $this->risk_ssn,
|
496 |
+
'mac_address' => $this->risk_mac_address,
|
497 |
+
'session_id' => $this->risk_session_id,
|
498 |
+
'user_id' => $this->risk_user_id,
|
499 |
+
'user_level' => $this->risk_user_level,
|
500 |
+
'email' => $this->risk_email,
|
501 |
+
'phone' => $this->risk_phone,
|
502 |
+
'remote_ip' => $this->risk_remote_ip,
|
503 |
+
'serial_number' => $this->risk_serial_number,
|
504 |
+
),
|
505 |
+
'dynamic_descriptor_params' => array(
|
506 |
+
'merchant_name' => $this->dynamic_merchant_name,
|
507 |
+
'merchant_city' => $this->dynamic_merchant_city,
|
508 |
+
)
|
509 |
+
)
|
510 |
+
);
|
511 |
+
|
512 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
513 |
+
}
|
514 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/Sale.php
ADDED
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\PayByVouchers;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Sale
|
27 |
+
*
|
28 |
+
* PayByVoucher purchase via Debit/Credit Sale
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\PayByVouchers
|
31 |
+
*/
|
32 |
+
class Sale extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by merchant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Description of the transaction for later use
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $usage;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* IPv4 address of customer
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $remote_ip;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Amount of transaction in minor currency unit
|
57 |
+
*
|
58 |
+
* @var int|float|double
|
59 |
+
*/
|
60 |
+
protected $amount;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Currency code in ISO-4217
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $currency;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
71 |
+
*
|
72 |
+
* @var string
|
73 |
+
*/
|
74 |
+
protected $card_holder;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Complete CC number of customer
|
78 |
+
*
|
79 |
+
* @var int
|
80 |
+
*/
|
81 |
+
protected $card_number;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* CVV of CC, requirement is based on terminal configuration
|
85 |
+
*
|
86 |
+
* @var int
|
87 |
+
*/
|
88 |
+
protected $cvv;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Expiration month as printed on credit card
|
92 |
+
*
|
93 |
+
* @var string (mm)
|
94 |
+
*/
|
95 |
+
protected $expiration_month;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Expiration year as printed on credit card
|
99 |
+
*
|
100 |
+
* @var string (yyyy)
|
101 |
+
*/
|
102 |
+
protected $expiration_year;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Email address of the Customer
|
106 |
+
*
|
107 |
+
* @var string
|
108 |
+
*/
|
109 |
+
protected $customer_email;
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Phone number of the customer
|
113 |
+
*
|
114 |
+
* @var string
|
115 |
+
*/
|
116 |
+
protected $customer_phone;
|
117 |
+
|
118 |
+
/**
|
119 |
+
*Customer's Billing Address: First name
|
120 |
+
*
|
121 |
+
* @var string
|
122 |
+
*/
|
123 |
+
protected $billing_first_name;
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Customer's Billing Address: Last name
|
127 |
+
*
|
128 |
+
* @var string
|
129 |
+
*/
|
130 |
+
protected $billing_last_name;
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Customer's Billing Address: Part 1
|
134 |
+
*
|
135 |
+
* @var string
|
136 |
+
*/
|
137 |
+
protected $billing_address1;
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Customer's Billing Address: Part 2
|
141 |
+
* @var string
|
142 |
+
*/
|
143 |
+
protected $billing_address2;
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Customer's Billing Address: ZIP
|
147 |
+
*
|
148 |
+
* @var string
|
149 |
+
*/
|
150 |
+
protected $billing_zip_code;
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Customer's Billing Address: City
|
154 |
+
*
|
155 |
+
* @var string
|
156 |
+
*/
|
157 |
+
protected $billing_city;
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Customer's Billing Address: State
|
161 |
+
*
|
162 |
+
* format: ISO-3166-2
|
163 |
+
*
|
164 |
+
* @var string
|
165 |
+
*/
|
166 |
+
protected $billing_state;
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Customer's Billing Address: Country
|
170 |
+
*
|
171 |
+
* format: ISO-3166
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $billing_country;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Shipping Address: First name
|
179 |
+
*
|
180 |
+
* @var string
|
181 |
+
*/
|
182 |
+
protected $shipping_first_name;
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Customer's Shipping Address: Last name
|
186 |
+
*
|
187 |
+
* @var string
|
188 |
+
*/
|
189 |
+
protected $shipping_last_name;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Customer's Shipping Address: Part 1
|
193 |
+
*
|
194 |
+
* @var string
|
195 |
+
*/
|
196 |
+
protected $shipping_address1;
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Customer's Shipping Address: Part 2
|
200 |
+
*
|
201 |
+
* @var string
|
202 |
+
*/
|
203 |
+
protected $shipping_address2;
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Customer's Shipping Address: ZIP
|
207 |
+
*
|
208 |
+
* @var string
|
209 |
+
*/
|
210 |
+
protected $shipping_zip_code;
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Customer's Shipping Address: City
|
214 |
+
*
|
215 |
+
* @var string
|
216 |
+
*/
|
217 |
+
protected $shipping_city;
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Customer's Shipping Address: State
|
221 |
+
*
|
222 |
+
* format: ISO-3166-2
|
223 |
+
*
|
224 |
+
* @var string
|
225 |
+
*/
|
226 |
+
protected $shipping_state;
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Customer's Shipping Address
|
230 |
+
*
|
231 |
+
* format: ISO-3166
|
232 |
+
*
|
233 |
+
* @var string
|
234 |
+
*/
|
235 |
+
protected $shipping_country;
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Social Security number or equivalent value for non US customers.
|
239 |
+
*
|
240 |
+
* @var string
|
241 |
+
*/
|
242 |
+
protected $risk_ssn;
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Customer's MAC address
|
246 |
+
*
|
247 |
+
* @var string
|
248 |
+
*/
|
249 |
+
protected $risk_mac_address;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Customer's Session Id
|
253 |
+
*
|
254 |
+
* @var string
|
255 |
+
*/
|
256 |
+
protected $risk_session_id;
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Customer's User Id
|
260 |
+
*
|
261 |
+
* @var string
|
262 |
+
*/
|
263 |
+
protected $risk_user_id;
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Customer's User Level
|
267 |
+
*
|
268 |
+
* @var string
|
269 |
+
*/
|
270 |
+
protected $risk_user_level;
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Customer's Email address
|
274 |
+
*
|
275 |
+
* @note Set here if different from
|
276 |
+
* shipping / billing
|
277 |
+
*
|
278 |
+
* @var string
|
279 |
+
*/
|
280 |
+
protected $risk_email;
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Customer's Phone number
|
284 |
+
*
|
285 |
+
* @note Set here if different from
|
286 |
+
* shipping / billing
|
287 |
+
*
|
288 |
+
* @var string
|
289 |
+
*/
|
290 |
+
protected $risk_phone;
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Customer's IP address
|
294 |
+
*
|
295 |
+
* @note Set here if different from remote_ip
|
296 |
+
*
|
297 |
+
* @var string
|
298 |
+
*/
|
299 |
+
protected $risk_remote_ip;
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Customer's Serial Number
|
303 |
+
*
|
304 |
+
* @var string
|
305 |
+
*/
|
306 |
+
protected $risk_serial_number;
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Allows to dynamically override the charge descriptor
|
310 |
+
*
|
311 |
+
* @var string
|
312 |
+
*/
|
313 |
+
protected $dynamic_merchant_name;
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Allows to dynamically override the mer- chant phone number
|
317 |
+
*
|
318 |
+
* @var string
|
319 |
+
*/
|
320 |
+
protected $dynamic_merchant_city;
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Set the per-request configuration
|
324 |
+
*
|
325 |
+
* @return void
|
326 |
+
*/
|
327 |
+
protected function initConfiguration()
|
328 |
+
{
|
329 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
330 |
+
array(
|
331 |
+
'protocol' => 'https',
|
332 |
+
'port' => 443,
|
333 |
+
'type' => 'POST',
|
334 |
+
'format' => 'xml',
|
335 |
+
)
|
336 |
+
);
|
337 |
+
|
338 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Set the required fields
|
343 |
+
*
|
344 |
+
* @return void
|
345 |
+
*/
|
346 |
+
protected function setRequiredFields()
|
347 |
+
{
|
348 |
+
$requiredFields = array(
|
349 |
+
'transaction_id',
|
350 |
+
'amount',
|
351 |
+
'currency',
|
352 |
+
'card_holder',
|
353 |
+
'card_number',
|
354 |
+
'expiration_month',
|
355 |
+
'expiration_year',
|
356 |
+
);
|
357 |
+
|
358 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Create the request's Tree structure
|
363 |
+
*
|
364 |
+
* @return void
|
365 |
+
*/
|
366 |
+
protected function populateStructure()
|
367 |
+
{
|
368 |
+
$treeStructure = array(
|
369 |
+
'payment_transaction' => array(
|
370 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE,
|
371 |
+
'transaction_id' => $this->transaction_id,
|
372 |
+
'usage' => $this->usage,
|
373 |
+
'remote_ip' => $this->remote_ip,
|
374 |
+
'amount' => $this->transform(
|
375 |
+
'amount',
|
376 |
+
array(
|
377 |
+
$this->amount,
|
378 |
+
$this->currency,
|
379 |
+
)
|
380 |
+
),
|
381 |
+
'currency' => $this->currency,
|
382 |
+
'card_holder' => $this->card_holder,
|
383 |
+
'card_number' => $this->card_number,
|
384 |
+
'cvv' => $this->cvv,
|
385 |
+
'expiration_month' => $this->expiration_month,
|
386 |
+
'expiration_year' => $this->expiration_year,
|
387 |
+
'customer_email' => $this->customer_email,
|
388 |
+
'customer_phone' => $this->customer_phone,
|
389 |
+
'billing_address' => array(
|
390 |
+
'first_name' => $this->billing_first_name,
|
391 |
+
'last_name' => $this->billing_last_name,
|
392 |
+
'address1' => $this->billing_address1,
|
393 |
+
'address2' => $this->billing_address2,
|
394 |
+
'zip_code' => $this->billing_zip_code,
|
395 |
+
'city' => $this->billing_city,
|
396 |
+
'state' => $this->billing_state,
|
397 |
+
'country' => $this->billing_country,
|
398 |
+
),
|
399 |
+
'shipping_address' => array(
|
400 |
+
'first_name' => $this->shipping_first_name,
|
401 |
+
'last_name' => $this->shipping_last_name,
|
402 |
+
'address1' => $this->shipping_address1,
|
403 |
+
'address2' => $this->shipping_address2,
|
404 |
+
'zip_code' => $this->shipping_zip_code,
|
405 |
+
'city' => $this->shipping_city,
|
406 |
+
'state' => $this->shipping_state,
|
407 |
+
'country' => $this->shipping_country,
|
408 |
+
),
|
409 |
+
'risk_params' => array(
|
410 |
+
'ssn' => $this->risk_ssn,
|
411 |
+
'mac_address' => $this->risk_mac_address,
|
412 |
+
'session_id' => $this->risk_session_id,
|
413 |
+
'user_id' => $this->risk_user_id,
|
414 |
+
'user_level' => $this->risk_user_level,
|
415 |
+
'email' => $this->risk_email,
|
416 |
+
'phone' => $this->risk_phone,
|
417 |
+
'remote_ip' => $this->risk_remote_ip,
|
418 |
+
'serial_number' => $this->risk_serial_number,
|
419 |
+
),
|
420 |
+
'dynamic_descriptor_params' => array(
|
421 |
+
'merchant_name' => $this->dynamic_merchant_name,
|
422 |
+
'merchant_city' => $this->dynamic_merchant_city,
|
423 |
+
)
|
424 |
+
)
|
425 |
+
);
|
426 |
+
|
427 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
428 |
+
}
|
429 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/oBeP.php
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\PayByVouchers;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class oBeP
|
27 |
+
*
|
28 |
+
* PayByVoucher oBeP transaction via YeePay
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\PayByVouchers
|
31 |
+
*/
|
32 |
+
class oBeP extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by mer-chant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* IPv4 address of customer
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $remote_ip;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Apply to order product information in the process of payment
|
50 |
+
* and the product description of purchase
|
51 |
+
*
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
+
protected $product_name;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Type of commodity, includes:
|
58 |
+
* - 3C digits,
|
59 |
+
* - clothing and shoes,
|
60 |
+
* - bag and accessories,
|
61 |
+
* - books and DVDS,
|
62 |
+
* - tuition,
|
63 |
+
* - register exam tuition,
|
64 |
+
* - member fee,
|
65 |
+
* - participation fee,
|
66 |
+
* - logistic service,
|
67 |
+
* - airline tickets,
|
68 |
+
* - hotel catering,
|
69 |
+
* - etc...
|
70 |
+
*
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
+
protected $product_category;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Amount of transaction in minor currency unit
|
77 |
+
*
|
78 |
+
* @var int
|
79 |
+
*/
|
80 |
+
protected $amount;
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Currency code in ISO-4217
|
84 |
+
*
|
85 |
+
* @var string
|
86 |
+
*/
|
87 |
+
protected $currency;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Email address of the Customer
|
91 |
+
*
|
92 |
+
* @var string
|
93 |
+
*/
|
94 |
+
protected $customer_email;
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Full of customer in Chinese
|
98 |
+
*
|
99 |
+
* @var string
|
100 |
+
*/
|
101 |
+
protected $customer_name;
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Phone number of the customer
|
105 |
+
*
|
106 |
+
* @var string
|
107 |
+
*/
|
108 |
+
protected $customer_phone;
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Customer ID number.
|
112 |
+
*
|
113 |
+
* Must be a 18 digits valid IDCard number
|
114 |
+
*
|
115 |
+
* @var string
|
116 |
+
*/
|
117 |
+
protected $customer_id_number;
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Bank ID, see the table with bank id codes
|
121 |
+
*
|
122 |
+
* @var string
|
123 |
+
*/
|
124 |
+
protected $customer_bank_id;
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Bank identification number of customer.
|
128 |
+
*
|
129 |
+
* Must be a 16 or 19 digits valid bank account number
|
130 |
+
*
|
131 |
+
* @var string
|
132 |
+
*/
|
133 |
+
protected $bank_account_number;
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Set the per-request configuration
|
137 |
+
*
|
138 |
+
* @return void
|
139 |
+
*/
|
140 |
+
protected function initConfiguration()
|
141 |
+
{
|
142 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
143 |
+
array(
|
144 |
+
'protocol' => 'https',
|
145 |
+
'port' => 443,
|
146 |
+
'type' => 'POST',
|
147 |
+
'format' => 'xml',
|
148 |
+
)
|
149 |
+
);
|
150 |
+
|
151 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Set the required fields
|
156 |
+
*
|
157 |
+
* @return void
|
158 |
+
*/
|
159 |
+
protected function setRequiredFields()
|
160 |
+
{
|
161 |
+
$requiredFields = array(
|
162 |
+
'transaction_id',
|
163 |
+
'amount',
|
164 |
+
'currency',
|
165 |
+
'product_name',
|
166 |
+
'product_category',
|
167 |
+
'customer_name',
|
168 |
+
'customer_email',
|
169 |
+
'customer_phone',
|
170 |
+
'customer_id_number',
|
171 |
+
'customer_bank_id',
|
172 |
+
'bank_account_number'
|
173 |
+
);
|
174 |
+
|
175 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Create the request's Tree structure
|
180 |
+
*
|
181 |
+
* @return void
|
182 |
+
*/
|
183 |
+
protected function populateStructure()
|
184 |
+
{
|
185 |
+
$treeStructure = array(
|
186 |
+
'payment_transaction' => array(
|
187 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY,
|
188 |
+
'transaction_id' => $this->transaction_id,
|
189 |
+
'remote_ip' => $this->remote_ip,
|
190 |
+
'amount' => $this->transform(
|
191 |
+
'amount',
|
192 |
+
array(
|
193 |
+
$this->amount,
|
194 |
+
$this->currency,
|
195 |
+
)
|
196 |
+
),
|
197 |
+
'currency' => $this->currency,
|
198 |
+
'product_name' => $this->product_name,
|
199 |
+
'product_category' => $this->product_category,
|
200 |
+
'customer_name' => $this->customer_name,
|
201 |
+
'customer_email' => $this->customer_email,
|
202 |
+
'customer_phone' => $this->customer_phone,
|
203 |
+
'customer_id_number' => $this->customer_id_number,
|
204 |
+
'customer_bank_id' => $this->customer_bank_id,
|
205 |
+
'bank_account_number' => $this->bank_account_number,
|
206 |
+
)
|
207 |
+
);
|
208 |
+
|
209 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
210 |
+
}
|
211 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Refund.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Refund request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Refund extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* IPv4 address of customer
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
protected $remote_ip;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Amount of transaction in minor currency unit
|
56 |
+
*
|
57 |
+
* @var int
|
58 |
+
*/
|
59 |
+
protected $amount;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Currency code in ISO-4217
|
63 |
+
*
|
64 |
+
* @var string
|
65 |
+
*/
|
66 |
+
protected $currency;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Unique id of the existing (target) transaction
|
70 |
+
*
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
+
protected $reference_id;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Set the per-request configuration
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
protected function initConfiguration()
|
81 |
+
{
|
82 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
83 |
+
array(
|
84 |
+
'protocol' => 'https',
|
85 |
+
'port' => 443,
|
86 |
+
'type' => 'POST',
|
87 |
+
'format' => 'xml',
|
88 |
+
)
|
89 |
+
);
|
90 |
+
|
91 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Set the required fields
|
96 |
+
*
|
97 |
+
* @return void
|
98 |
+
*/
|
99 |
+
protected function setRequiredFields()
|
100 |
+
{
|
101 |
+
$requiredFields = array(
|
102 |
+
'transaction_id',
|
103 |
+
'reference_id',
|
104 |
+
'amount',
|
105 |
+
'currency'
|
106 |
+
);
|
107 |
+
|
108 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Create the request's Tree structure
|
113 |
+
*
|
114 |
+
* @return void
|
115 |
+
*/
|
116 |
+
protected function populateStructure()
|
117 |
+
{
|
118 |
+
$treeStructure = array(
|
119 |
+
'payment_transaction' => array(
|
120 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::REFUND,
|
121 |
+
'transaction_id' => $this->transaction_id,
|
122 |
+
'usage' => $this->usage,
|
123 |
+
'remote_ip' => $this->remote_ip,
|
124 |
+
'reference_id' => $this->reference_id,
|
125 |
+
'amount' => $this->transform(
|
126 |
+
'amount',
|
127 |
+
array(
|
128 |
+
$this->amount,
|
129 |
+
$this->currency,
|
130 |
+
)
|
131 |
+
),
|
132 |
+
'currency' => $this->currency
|
133 |
+
)
|
134 |
+
);
|
135 |
+
|
136 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
137 |
+
}
|
138 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Void.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Void Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Void extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* IPv4 address of customer
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
protected $remote_ip;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Unique id of the existing (target) transaction
|
56 |
+
*
|
57 |
+
* @var string
|
58 |
+
*/
|
59 |
+
protected $reference_id;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Set the per-request configuration
|
63 |
+
*
|
64 |
+
* @return void
|
65 |
+
*/
|
66 |
+
protected function initConfiguration()
|
67 |
+
{
|
68 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
69 |
+
array(
|
70 |
+
'protocol' => 'https',
|
71 |
+
'port' => 443,
|
72 |
+
'type' => 'POST',
|
73 |
+
'format' => 'xml',
|
74 |
+
)
|
75 |
+
);
|
76 |
+
|
77 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Set the required fields
|
82 |
+
*
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
protected function setRequiredFields()
|
86 |
+
{
|
87 |
+
$requiredFields = array(
|
88 |
+
'transaction_id',
|
89 |
+
'reference_id',
|
90 |
+
);
|
91 |
+
|
92 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Create the request's Tree structure
|
97 |
+
*
|
98 |
+
* @return void
|
99 |
+
*/
|
100 |
+
protected function populateStructure()
|
101 |
+
{
|
102 |
+
$treeStructure = array(
|
103 |
+
'payment_transaction' => array(
|
104 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::VOID,
|
105 |
+
'transaction_id' => $this->transaction_id,
|
106 |
+
'usage' => $this->usage,
|
107 |
+
'remote_ip' => $this->remote_ip,
|
108 |
+
'reference_id' => $this->reference_id,
|
109 |
+
)
|
110 |
+
);
|
111 |
+
|
112 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
113 |
+
}
|
114 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Wallets/Neteller.php
ADDED
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Wallets;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Neteller
|
27 |
+
*
|
28 |
+
* Electronic Wallet
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Wallets
|
31 |
+
*/
|
32 |
+
class Neteller extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by mer-chant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Description of the transaction for later use
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $usage;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* IPv4 address of customer
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $remote_ip;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* URL where customer is sent to after successful payment
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $return_success_url;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* URL where customer is sent to after un-successful payment
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $return_failure_url;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Amount of transaction in minor currency unit
|
71 |
+
*
|
72 |
+
* @var int
|
73 |
+
*/
|
74 |
+
protected $amount;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Currency code in ISO-4217
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $currency;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Email address of the Customer
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
*/
|
88 |
+
protected $customer_email;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Phone number of the customer
|
92 |
+
*
|
93 |
+
* @var string
|
94 |
+
*/
|
95 |
+
protected $customer_phone;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Neteller Account Id
|
99 |
+
*
|
100 |
+
* @var string
|
101 |
+
*/
|
102 |
+
protected $customer_account;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Neteller Account Password
|
106 |
+
*
|
107 |
+
* @var string
|
108 |
+
*/
|
109 |
+
protected $account_password;
|
110 |
+
|
111 |
+
/**
|
112 |
+
*Customer's Billing Address: First name
|
113 |
+
*
|
114 |
+
* @var string
|
115 |
+
*/
|
116 |
+
protected $billing_first_name;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Customer's Billing Address: Last name
|
120 |
+
*
|
121 |
+
* @var string
|
122 |
+
*/
|
123 |
+
protected $billing_last_name;
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Customer's Billing Address: Part 1
|
127 |
+
*
|
128 |
+
* @var string
|
129 |
+
*/
|
130 |
+
protected $billing_address1;
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Customer's Billing Address: Part 2
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
protected $billing_address2;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Customer's Billing Address: ZIP
|
140 |
+
*
|
141 |
+
* @var string
|
142 |
+
*/
|
143 |
+
protected $billing_zip_code;
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Customer's Billing Address: City
|
147 |
+
*
|
148 |
+
* @var string
|
149 |
+
*/
|
150 |
+
protected $billing_city;
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Customer's Billing Address: State
|
154 |
+
*
|
155 |
+
* format: ISO-3166-2
|
156 |
+
*
|
157 |
+
* @var string
|
158 |
+
*/
|
159 |
+
protected $billing_state;
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Customer's Billing Address: Country
|
163 |
+
*
|
164 |
+
* format: ISO-3166
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $billing_country;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Shipping Address: First name
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $shipping_first_name;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Shipping Address: Last name
|
179 |
+
*
|
180 |
+
* @var string
|
181 |
+
*/
|
182 |
+
protected $shipping_last_name;
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Customer's Shipping Address: Part 1
|
186 |
+
*
|
187 |
+
* @var string
|
188 |
+
*/
|
189 |
+
protected $shipping_address1;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Customer's Shipping Address: Part 2
|
193 |
+
*
|
194 |
+
* @var string
|
195 |
+
*/
|
196 |
+
protected $shipping_address2;
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Customer's Shipping Address: ZIP
|
200 |
+
*
|
201 |
+
* @var string
|
202 |
+
*/
|
203 |
+
protected $shipping_zip_code;
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Customer's Shipping Address: City
|
207 |
+
*
|
208 |
+
* @var string
|
209 |
+
*/
|
210 |
+
protected $shipping_city;
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Customer's Shipping Address: State
|
214 |
+
*
|
215 |
+
* format: ISO-3166-2
|
216 |
+
*
|
217 |
+
* @var string
|
218 |
+
*/
|
219 |
+
protected $shipping_state;
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Customer's Shipping Address
|
223 |
+
*
|
224 |
+
* format: ISO-3166
|
225 |
+
*
|
226 |
+
* @var string
|
227 |
+
*/
|
228 |
+
protected $shipping_country;
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Social Security number or equivalent value for non US customers.
|
232 |
+
*
|
233 |
+
* @var string
|
234 |
+
*/
|
235 |
+
protected $risk_ssn;
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Customer's MAC address
|
239 |
+
*
|
240 |
+
* @var string
|
241 |
+
*/
|
242 |
+
protected $risk_mac_address;
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Customer's Session Id
|
246 |
+
*
|
247 |
+
* @var string
|
248 |
+
*/
|
249 |
+
protected $risk_session_id;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Customer's User Id
|
253 |
+
*
|
254 |
+
* @var string
|
255 |
+
*/
|
256 |
+
protected $risk_user_id;
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Customer's User Level
|
260 |
+
*
|
261 |
+
* @var string
|
262 |
+
*/
|
263 |
+
protected $risk_user_level;
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Customer's Email address
|
267 |
+
*
|
268 |
+
* @note Set here if different from
|
269 |
+
* shipping / billing
|
270 |
+
*
|
271 |
+
* @var string
|
272 |
+
*/
|
273 |
+
protected $risk_email;
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Customer's Phone number
|
277 |
+
*
|
278 |
+
* @note Set here if different from
|
279 |
+
* shipping / billing
|
280 |
+
*
|
281 |
+
* @var string
|
282 |
+
*/
|
283 |
+
protected $risk_phone;
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Customer's IP address
|
287 |
+
*
|
288 |
+
* @note Set here if different from remote_ip
|
289 |
+
*
|
290 |
+
* @var string
|
291 |
+
*/
|
292 |
+
protected $risk_remote_ip;
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Customer's Serial Number
|
296 |
+
*
|
297 |
+
* @var string
|
298 |
+
*/
|
299 |
+
protected $risk_serial_number;
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Set the per-request configuration
|
303 |
+
*
|
304 |
+
* @return void
|
305 |
+
*/
|
306 |
+
protected function initConfiguration()
|
307 |
+
{
|
308 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(array(
|
309 |
+
'protocol' => 'https',
|
310 |
+
'port' => 443,
|
311 |
+
'type' => 'POST',
|
312 |
+
'format' => 'xml',
|
313 |
+
));
|
314 |
+
|
315 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Set the required fields
|
320 |
+
*
|
321 |
+
* @return void
|
322 |
+
*/
|
323 |
+
protected function setRequiredFields()
|
324 |
+
{
|
325 |
+
$requiredFields = array(
|
326 |
+
'transaction_id',
|
327 |
+
'remote_ip',
|
328 |
+
'amount',
|
329 |
+
'currency',
|
330 |
+
'return_success_url',
|
331 |
+
'return_failure_url',
|
332 |
+
'customer_email',
|
333 |
+
'customer_account',
|
334 |
+
'account_password',
|
335 |
+
);
|
336 |
+
|
337 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Create the request's Tree structure
|
342 |
+
*
|
343 |
+
* @return void
|
344 |
+
*/
|
345 |
+
protected function populateStructure()
|
346 |
+
{
|
347 |
+
$treeStructure = array(
|
348 |
+
'payment_transaction' => array(
|
349 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::NETELLER,
|
350 |
+
'transaction_id' => $this->transaction_id,
|
351 |
+
'usage' => $this->usage,
|
352 |
+
'remote_ip' => $this->remote_ip,
|
353 |
+
'return_success_url' => $this->return_success_url,
|
354 |
+
'return_failure_url' => $this->return_failure_url,
|
355 |
+
'amount' => $this->transform(
|
356 |
+
'amount',
|
357 |
+
array(
|
358 |
+
$this->amount,
|
359 |
+
$this->currency,
|
360 |
+
)
|
361 |
+
),
|
362 |
+
'currency' => $this->currency,
|
363 |
+
'customer_email' => $this->customer_email,
|
364 |
+
'customer_phone' => $this->customer_phone,
|
365 |
+
'customer_account' => $this->customer_account,
|
366 |
+
'account_password' => $this->account_password,
|
367 |
+
'billing_address' => array(
|
368 |
+
'first_name' => $this->billing_first_name,
|
369 |
+
'last_name' => $this->billing_last_name,
|
370 |
+
'address1' => $this->billing_address1,
|
371 |
+
'address2' => $this->billing_address2,
|
372 |
+
'zip_code' => $this->billing_zip_code,
|
373 |
+
'city' => $this->billing_city,
|
374 |
+
'state' => $this->billing_state,
|
375 |
+
'country' => $this->billing_country,
|
376 |
+
),
|
377 |
+
'shipping_address' => array(
|
378 |
+
'first_name' => $this->shipping_first_name,
|
379 |
+
'last_name' => $this->shipping_last_name,
|
380 |
+
'address1' => $this->shipping_address1,
|
381 |
+
'address2' => $this->shipping_address2,
|
382 |
+
'zip_code' => $this->shipping_zip_code,
|
383 |
+
'city' => $this->shipping_city,
|
384 |
+
'state' => $this->shipping_state,
|
385 |
+
'country' => $this->shipping_country,
|
386 |
+
),
|
387 |
+
'risk_params' => array(
|
388 |
+
'ssn' => $this->risk_ssn,
|
389 |
+
'mac_address' => $this->risk_mac_address,
|
390 |
+
'session_id' => $this->risk_session_id,
|
391 |
+
'user_id' => $this->risk_user_id,
|
392 |
+
'user_level' => $this->risk_user_level,
|
393 |
+
'email' => $this->risk_email,
|
394 |
+
'phone' => $this->risk_phone,
|
395 |
+
'remote_ip' => $this->risk_remote_ip,
|
396 |
+
'serial_number' => $this->risk_serial_number,
|
397 |
+
),
|
398 |
+
)
|
399 |
+
);
|
400 |
+
|
401 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
402 |
+
}
|
403 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Wallets/WebMoney.php
ADDED
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Wallets;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class WebMoney
|
27 |
+
*
|
28 |
+
* Electronic Wallet
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Wallets
|
31 |
+
*/
|
32 |
+
class WebMoney extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Unique transaction id defined by merchant
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $transaction_id;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Description of the transaction for later use
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $usage;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* IPv4 address of customer
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $remote_ip;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* URL where customer is sent to after successful payment
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $return_success_url;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* URL where customer is sent to after un-successful payment
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $return_failure_url;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Amount of transaction in minor currency unit
|
71 |
+
*
|
72 |
+
* @var int
|
73 |
+
*/
|
74 |
+
protected $amount;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Currency code in ISO-4217
|
78 |
+
*
|
79 |
+
* @var string
|
80 |
+
*/
|
81 |
+
protected $currency;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Flag for payout transaction
|
85 |
+
*
|
86 |
+
* @var bool
|
87 |
+
*/
|
88 |
+
protected $is_payout;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Email address of the Customer
|
92 |
+
*
|
93 |
+
* @var string
|
94 |
+
*/
|
95 |
+
protected $customer_email;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Phone number of the customer
|
99 |
+
*
|
100 |
+
* @var string
|
101 |
+
*/
|
102 |
+
protected $customer_phone;
|
103 |
+
|
104 |
+
/**
|
105 |
+
*Customer's Billing Address: First name
|
106 |
+
*
|
107 |
+
* @var string
|
108 |
+
*/
|
109 |
+
protected $billing_first_name;
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Customer's Billing Address: Last name
|
113 |
+
*
|
114 |
+
* @var string
|
115 |
+
*/
|
116 |
+
protected $billing_last_name;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Customer's Billing Address: Part 1
|
120 |
+
*
|
121 |
+
* @var string
|
122 |
+
*/
|
123 |
+
protected $billing_address1;
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Customer's Billing Address: Part 2
|
127 |
+
* @var string
|
128 |
+
*/
|
129 |
+
protected $billing_address2;
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Customer's Billing Address: ZIP
|
133 |
+
*
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
protected $billing_zip_code;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Customer's Billing Address: City
|
140 |
+
*
|
141 |
+
* @var string
|
142 |
+
*/
|
143 |
+
protected $billing_city;
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Customer's Billing Address: State
|
147 |
+
*
|
148 |
+
* format: ISO-3166-2
|
149 |
+
*
|
150 |
+
* @var string
|
151 |
+
*/
|
152 |
+
protected $billing_state;
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Customer's Billing Address: Country
|
156 |
+
*
|
157 |
+
* format: ISO-3166
|
158 |
+
*
|
159 |
+
* @var string
|
160 |
+
*/
|
161 |
+
protected $billing_country;
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Customer's Shipping Address: First name
|
165 |
+
*
|
166 |
+
* @var string
|
167 |
+
*/
|
168 |
+
protected $shipping_first_name;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Customer's Shipping Address: Last name
|
172 |
+
*
|
173 |
+
* @var string
|
174 |
+
*/
|
175 |
+
protected $shipping_last_name;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Customer's Shipping Address: Part 1
|
179 |
+
*
|
180 |
+
* @var string
|
181 |
+
*/
|
182 |
+
protected $shipping_address1;
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Customer's Shipping Address: Part 2
|
186 |
+
*
|
187 |
+
* @var string
|
188 |
+
*/
|
189 |
+
protected $shipping_address2;
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Customer's Shipping Address: ZIP
|
193 |
+
*
|
194 |
+
* @var string
|
195 |
+
*/
|
196 |
+
protected $shipping_zip_code;
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Customer's Shipping Address: City
|
200 |
+
*
|
201 |
+
* @var string
|
202 |
+
*/
|
203 |
+
protected $shipping_city;
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Customer's Shipping Address: State
|
207 |
+
*
|
208 |
+
* format: ISO-3166-2
|
209 |
+
*
|
210 |
+
* @var string
|
211 |
+
*/
|
212 |
+
protected $shipping_state;
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Customer's Shipping Address
|
216 |
+
*
|
217 |
+
* format: ISO-3166
|
218 |
+
*
|
219 |
+
* @var string
|
220 |
+
*/
|
221 |
+
protected $shipping_country;
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Social Security number or equivalent value for non US customers.
|
225 |
+
*
|
226 |
+
* @var string
|
227 |
+
*/
|
228 |
+
protected $risk_ssn;
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Customer's MAC address
|
232 |
+
*
|
233 |
+
* @var string
|
234 |
+
*/
|
235 |
+
protected $risk_mac_address;
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Customer's Session Id
|
239 |
+
*
|
240 |
+
* @var string
|
241 |
+
*/
|
242 |
+
protected $risk_session_id;
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Customer's User Id
|
246 |
+
*
|
247 |
+
* @var string
|
248 |
+
*/
|
249 |
+
protected $risk_user_id;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Customer's User Level
|
253 |
+
*
|
254 |
+
* @var string
|
255 |
+
*/
|
256 |
+
protected $risk_user_level;
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Customer's Email address
|
260 |
+
*
|
261 |
+
* @note Set here if different from
|
262 |
+
* shipping / billing
|
263 |
+
*
|
264 |
+
* @var string
|
265 |
+
*/
|
266 |
+
protected $risk_email;
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Customer's Phone number
|
270 |
+
*
|
271 |
+
* @note Set here if different from
|
272 |
+
* shipping / billing
|
273 |
+
*
|
274 |
+
* @var string
|
275 |
+
*/
|
276 |
+
protected $risk_phone;
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Customer's IP address
|
280 |
+
*
|
281 |
+
* @note Set here if different from remote_ip
|
282 |
+
*
|
283 |
+
* @var string
|
284 |
+
*/
|
285 |
+
protected $risk_remote_ip;
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Customer's Serial Number
|
289 |
+
*
|
290 |
+
* @var string
|
291 |
+
*/
|
292 |
+
protected $risk_serial_number;
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Set the per-request configuration
|
296 |
+
*
|
297 |
+
* @return void
|
298 |
+
*/
|
299 |
+
protected function initConfiguration()
|
300 |
+
{
|
301 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(array(
|
302 |
+
'protocol' => 'https',
|
303 |
+
'port' => 443,
|
304 |
+
'type' => 'POST',
|
305 |
+
'format' => 'xml',
|
306 |
+
));
|
307 |
+
|
308 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Set the required fields
|
313 |
+
*
|
314 |
+
* @return void
|
315 |
+
*/
|
316 |
+
protected function setRequiredFields()
|
317 |
+
{
|
318 |
+
$requiredFields = array(
|
319 |
+
'transaction_id',
|
320 |
+
'remote_ip',
|
321 |
+
'amount',
|
322 |
+
'currency',
|
323 |
+
'return_success_url',
|
324 |
+
'return_failure_url',
|
325 |
+
'customer_email',
|
326 |
+
);
|
327 |
+
|
328 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Create the request's Tree structure
|
333 |
+
*
|
334 |
+
* @return void
|
335 |
+
*/
|
336 |
+
protected function populateStructure()
|
337 |
+
{
|
338 |
+
$treeStructure = array(
|
339 |
+
'payment_transaction' => array(
|
340 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::WEBMONEY,
|
341 |
+
'transaction_id' => $this->transaction_id,
|
342 |
+
'usage' => $this->usage,
|
343 |
+
'remote_ip' => $this->remote_ip,
|
344 |
+
'return_success_url' => $this->return_success_url,
|
345 |
+
'return_failure_url' => $this->return_failure_url,
|
346 |
+
'amount' => $this->transform(
|
347 |
+
'amount',
|
348 |
+
array(
|
349 |
+
$this->amount,
|
350 |
+
$this->currency,
|
351 |
+
)
|
352 |
+
),
|
353 |
+
'currency' => $this->currency,
|
354 |
+
'is_payout' => $this->is_payout,
|
355 |
+
'customer_email' => $this->customer_email,
|
356 |
+
'customer_phone' => $this->customer_phone,
|
357 |
+
'billing_address' => array(
|
358 |
+
'first_name' => $this->billing_first_name,
|
359 |
+
'last_name' => $this->billing_last_name,
|
360 |
+
'address1' => $this->billing_address1,
|
361 |
+
'address2' => $this->billing_address2,
|
362 |
+
'zip_code' => $this->billing_zip_code,
|
363 |
+
'city' => $this->billing_city,
|
364 |
+
'state' => $this->billing_state,
|
365 |
+
'country' => $this->billing_country,
|
366 |
+
),
|
367 |
+
'shipping_address' => array(
|
368 |
+
'first_name' => $this->shipping_first_name,
|
369 |
+
'last_name' => $this->shipping_last_name,
|
370 |
+
'address1' => $this->shipping_address1,
|
371 |
+
'address2' => $this->shipping_address2,
|
372 |
+
'zip_code' => $this->shipping_zip_code,
|
373 |
+
'city' => $this->shipping_city,
|
374 |
+
'state' => $this->shipping_state,
|
375 |
+
'country' => $this->shipping_country,
|
376 |
+
),
|
377 |
+
'risk_params' => array(
|
378 |
+
'ssn' => $this->risk_ssn,
|
379 |
+
'mac_address' => $this->risk_mac_address,
|
380 |
+
'session_id' => $this->risk_session_id,
|
381 |
+
'user_id' => $this->risk_user_id,
|
382 |
+
'user_level' => $this->risk_user_level,
|
383 |
+
'email' => $this->risk_email,
|
384 |
+
'phone' => $this->risk_phone,
|
385 |
+
'remote_ip' => $this->risk_remote_ip,
|
386 |
+
'serial_number' => $this->risk_serial_number,
|
387 |
+
),
|
388 |
+
)
|
389 |
+
);
|
390 |
+
|
391 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
392 |
+
}
|
393 |
+
}
|
lib/Genesis/src/Genesis/API/Request/Financial/Wallets/eZeeWallet.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\Financial\Wallets;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class eZeeWallet
|
27 |
+
*
|
28 |
+
* Electronic Wallet
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\Financial\Wallets
|
31 |
+
*/
|
32 |
+
// @codingStandardsIgnoreStart
|
33 |
+
class eZeeWallet extends \Genesis\API\Request
|
34 |
+
// @codingStandardsIgnoreEnd
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Unique transaction id defined by mer-chant
|
38 |
+
*
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
protected $transaction_id;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Description of the transaction for later use
|
45 |
+
*
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
protected $usage;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* IPv4 address of customer
|
52 |
+
*
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
protected $remote_ip;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Amount of transaction in minor currency unit
|
59 |
+
*
|
60 |
+
* @var int
|
61 |
+
*/
|
62 |
+
protected $amount;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Currency code in ISO-4217
|
66 |
+
*
|
67 |
+
* @var string
|
68 |
+
*/
|
69 |
+
protected $currency;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* URL where customer is sent to after successful payment
|
73 |
+
*
|
74 |
+
* @var string
|
75 |
+
*/
|
76 |
+
protected $return_success_url;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* URL where customer is sent to after unsuccessful payment
|
80 |
+
*
|
81 |
+
* @var string
|
82 |
+
*/
|
83 |
+
protected $return_failure_url;
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Email address of consumer who owns the source wallet
|
87 |
+
*
|
88 |
+
* @var string
|
89 |
+
*/
|
90 |
+
protected $source_wallet_id;
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Password of consumer who owns the source wallet, in Base64 encoded form
|
94 |
+
*
|
95 |
+
* @var string
|
96 |
+
*/
|
97 |
+
protected $source_wallet_pwd;
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Set the per-request configuration
|
101 |
+
*
|
102 |
+
* @return void
|
103 |
+
*/
|
104 |
+
protected function initConfiguration()
|
105 |
+
{
|
106 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(array(
|
107 |
+
'protocol' => 'https',
|
108 |
+
'port' => 443,
|
109 |
+
'type' => 'POST',
|
110 |
+
'format' => 'xml',
|
111 |
+
));
|
112 |
+
|
113 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Set the required fields
|
118 |
+
*
|
119 |
+
* @return void
|
120 |
+
*/
|
121 |
+
protected function setRequiredFields()
|
122 |
+
{
|
123 |
+
$requiredFields = array(
|
124 |
+
'transaction_id',
|
125 |
+
'amount',
|
126 |
+
'currency',
|
127 |
+
'return_success_url',
|
128 |
+
'return_failure_url',
|
129 |
+
'source_wallet_id',
|
130 |
+
'source_wallet_pwd',
|
131 |
+
);
|
132 |
+
|
133 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Create the request's Tree structure
|
138 |
+
*
|
139 |
+
* @return void
|
140 |
+
*/
|
141 |
+
protected function populateStructure()
|
142 |
+
{
|
143 |
+
$treeStructure = array(
|
144 |
+
'payment_transaction' => array(
|
145 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::EZEEWALLET,
|
146 |
+
'transaction_id' => $this->transaction_id,
|
147 |
+
'usage' => $this->usage,
|
148 |
+
'remote_ip' => $this->remote_ip,
|
149 |
+
'amount' => $this->transform(
|
150 |
+
'amount',
|
151 |
+
array(
|
152 |
+
$this->amount,
|
153 |
+
$this->currency,
|
154 |
+
)
|
155 |
+
),
|
156 |
+
'currency' => $this->currency,
|
157 |
+
'return_success_url' => $this->return_success_url,
|
158 |
+
'return_failure_url' => $this->return_failure_url,
|
159 |
+
'source_wallet_id' => $this->source_wallet_id,
|
160 |
+
'source_wallet_pwd' => $this->transform(
|
161 |
+
'wallet_password',
|
162 |
+
array(
|
163 |
+
$this->source_wallet_pwd
|
164 |
+
)
|
165 |
+
),
|
166 |
+
)
|
167 |
+
);
|
168 |
+
|
169 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Apply transformation:
|
174 |
+
*
|
175 |
+
* Encode a string in base64 or return
|
176 |
+
* the input if already in base64
|
177 |
+
*
|
178 |
+
* @param string $input
|
179 |
+
*
|
180 |
+
* @return mixed
|
181 |
+
*/
|
182 |
+
protected function transformWalletPassword($input = '')
|
183 |
+
{
|
184 |
+
if (!\Genesis\Utils\Common::isBase64Encoded($input)) {
|
185 |
+
return base64_encode($input);
|
186 |
+
}
|
187 |
+
|
188 |
+
return $input;
|
189 |
+
}
|
190 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/AVS.php
ADDED
@@ -0,0 +1,399 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Address Verification System Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class AVS extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Signifies whether a MOTO (mail order telephone order) transaction is performed.
|
49 |
+
*
|
50 |
+
* Contact tech support for more details.
|
51 |
+
*
|
52 |
+
* @var bool
|
53 |
+
*/
|
54 |
+
protected $moto;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* IPv4 address of customer
|
58 |
+
*
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
protected $remote_ip;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
65 |
+
*
|
66 |
+
* @var string
|
67 |
+
*/
|
68 |
+
protected $card_holder;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Complete CC number of customer
|
72 |
+
*
|
73 |
+
* @var int
|
74 |
+
*/
|
75 |
+
protected $card_number;
|
76 |
+
|
77 |
+
/**
|
78 |
+
* CVV of CC, requirement is based on terminal configuration
|
79 |
+
*
|
80 |
+
* @var int
|
81 |
+
*/
|
82 |
+
protected $cvv;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Expiration month as printed on credit card
|
86 |
+
*
|
87 |
+
* @var string (mm)
|
88 |
+
*/
|
89 |
+
protected $expiration_month;
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Expiration year as printed on credit card
|
93 |
+
*
|
94 |
+
* @var string (yyyy)
|
95 |
+
*/
|
96 |
+
protected $expiration_year;
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Email address of the Customer
|
100 |
+
*
|
101 |
+
* @var string
|
102 |
+
*/
|
103 |
+
protected $customer_email;
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Phone number of the customer
|
107 |
+
*
|
108 |
+
* @var string
|
109 |
+
*/
|
110 |
+
protected $customer_phone;
|
111 |
+
|
112 |
+
/**
|
113 |
+
*Customer's Billing Address: First name
|
114 |
+
*
|
115 |
+
* @var string
|
116 |
+
*/
|
117 |
+
protected $billing_first_name;
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Customer's Billing Address: Last name
|
121 |
+
*
|
122 |
+
* @var string
|
123 |
+
*/
|
124 |
+
protected $billing_last_name;
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Customer's Billing Address: Part 1
|
128 |
+
*
|
129 |
+
* @var string
|
130 |
+
*/
|
131 |
+
protected $billing_address1;
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Customer's Billing Address: Part 2
|
135 |
+
* @var string
|
136 |
+
*/
|
137 |
+
protected $billing_address2;
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Customer's Billing Address: ZIP
|
141 |
+
*
|
142 |
+
* @var string
|
143 |
+
*/
|
144 |
+
protected $billing_zip_code;
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Customer's Billing Address: City
|
148 |
+
*
|
149 |
+
* @var string
|
150 |
+
*/
|
151 |
+
protected $billing_city;
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Customer's Billing Address: State
|
155 |
+
*
|
156 |
+
* format: ISO-3166-2
|
157 |
+
*
|
158 |
+
* @var string
|
159 |
+
*/
|
160 |
+
protected $billing_state;
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Customer's Billing Address: Country
|
164 |
+
*
|
165 |
+
* format: ISO-3166
|
166 |
+
*
|
167 |
+
* @var string
|
168 |
+
*/
|
169 |
+
protected $billing_country;
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Customer's Shipping Address: First name
|
173 |
+
*
|
174 |
+
* @var string
|
175 |
+
*/
|
176 |
+
protected $shipping_first_name;
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Customer's Shipping Address: Last name
|
180 |
+
*
|
181 |
+
* @var string
|
182 |
+
*/
|
183 |
+
protected $shipping_last_name;
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Customer's Shipping Address: Part 1
|
187 |
+
*
|
188 |
+
* @var string
|
189 |
+
*/
|
190 |
+
protected $shipping_address1;
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Customer's Shipping Address: Part 2
|
194 |
+
*
|
195 |
+
* @var string
|
196 |
+
*/
|
197 |
+
protected $shipping_address2;
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Customer's Shipping Address: ZIP
|
201 |
+
*
|
202 |
+
* @var string
|
203 |
+
*/
|
204 |
+
protected $shipping_zip_code;
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Customer's Shipping Address: City
|
208 |
+
*
|
209 |
+
* @var string
|
210 |
+
*/
|
211 |
+
protected $shipping_city;
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Customer's Shipping Address: State
|
215 |
+
*
|
216 |
+
* format: ISO-3166-2
|
217 |
+
*
|
218 |
+
* @var string
|
219 |
+
*/
|
220 |
+
protected $shipping_state;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Customer's Shipping Address
|
224 |
+
*
|
225 |
+
* format: ISO-3166
|
226 |
+
*
|
227 |
+
* @var string
|
228 |
+
*/
|
229 |
+
protected $shipping_country;
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Social Security number or equivalent value for non US customers.
|
233 |
+
*
|
234 |
+
* @var string
|
235 |
+
*/
|
236 |
+
protected $risk_ssn;
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Customer's MAC address
|
240 |
+
*
|
241 |
+
* @var string
|
242 |
+
*/
|
243 |
+
protected $risk_mac_address;
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Customer's Session Id
|
247 |
+
*
|
248 |
+
* @var string
|
249 |
+
*/
|
250 |
+
protected $risk_session_id;
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Customer's User Id
|
254 |
+
*
|
255 |
+
* @var string
|
256 |
+
*/
|
257 |
+
protected $risk_user_id;
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Customer's User Level
|
261 |
+
*
|
262 |
+
* @var string
|
263 |
+
*/
|
264 |
+
protected $risk_user_level;
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Customer's Email address
|
268 |
+
*
|
269 |
+
* @note Set here if different from
|
270 |
+
* shipping / billing
|
271 |
+
*
|
272 |
+
* @var string
|
273 |
+
*/
|
274 |
+
protected $risk_email;
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Customer's Phone number
|
278 |
+
*
|
279 |
+
* @note Set here if different from
|
280 |
+
* shipping / billing
|
281 |
+
*
|
282 |
+
* @var string
|
283 |
+
*/
|
284 |
+
protected $risk_phone;
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Customer's IP address
|
288 |
+
*
|
289 |
+
* @note Set here if different from remote_ip
|
290 |
+
*
|
291 |
+
* @var string
|
292 |
+
*/
|
293 |
+
protected $risk_remote_ip;
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Customer's Serial Number
|
297 |
+
*
|
298 |
+
* @var string
|
299 |
+
*/
|
300 |
+
protected $risk_serial_number;
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Set the per-request configuration
|
304 |
+
*
|
305 |
+
* @return void
|
306 |
+
*/
|
307 |
+
protected function initConfiguration()
|
308 |
+
{
|
309 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
310 |
+
array(
|
311 |
+
'protocol' => 'https',
|
312 |
+
'port' => 443,
|
313 |
+
'type' => 'POST',
|
314 |
+
'format' => 'xml',
|
315 |
+
)
|
316 |
+
);
|
317 |
+
|
318 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Set the required fields
|
323 |
+
*
|
324 |
+
* @return void
|
325 |
+
*/
|
326 |
+
protected function setRequiredFields()
|
327 |
+
{
|
328 |
+
$requiredFields = array(
|
329 |
+
'transaction_id',
|
330 |
+
'card_holder',
|
331 |
+
'card_number',
|
332 |
+
'expiration_month',
|
333 |
+
'expiration_year',
|
334 |
+
'billing_address1',
|
335 |
+
'billing_zip_code',
|
336 |
+
'billing_city',
|
337 |
+
);
|
338 |
+
|
339 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Create the request's Tree structure
|
344 |
+
*
|
345 |
+
* @return void
|
346 |
+
*/
|
347 |
+
protected function populateStructure()
|
348 |
+
{
|
349 |
+
$treeStructure = array(
|
350 |
+
'payment_transaction' => array(
|
351 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::AVS,
|
352 |
+
'transaction_id' => $this->transaction_id,
|
353 |
+
'usage' => $this->usage,
|
354 |
+
'moto' => $this->moto,
|
355 |
+
'remote_ip' => $this->remote_ip,
|
356 |
+
'card_holder' => $this->card_holder,
|
357 |
+
'card_number' => $this->card_number,
|
358 |
+
'cvv' => $this->cvv,
|
359 |
+
'expiration_month' => $this->expiration_month,
|
360 |
+
'expiration_year' => $this->expiration_year,
|
361 |
+
'customer_email' => $this->customer_email,
|
362 |
+
'customer_phone' => $this->customer_phone,
|
363 |
+
'billing_address' => array(
|
364 |
+
'first_name' => $this->billing_first_name,
|
365 |
+
'last_name' => $this->billing_last_name,
|
366 |
+
'address1' => $this->billing_address1,
|
367 |
+
'address2' => $this->billing_address2,
|
368 |
+
'zip_code' => $this->billing_zip_code,
|
369 |
+
'city' => $this->billing_city,
|
370 |
+
'state' => $this->billing_state,
|
371 |
+
'country' => $this->billing_country,
|
372 |
+
),
|
373 |
+
'shipping_address' => array(
|
374 |
+
'first_name' => $this->shipping_first_name,
|
375 |
+
'last_name' => $this->shipping_last_name,
|
376 |
+
'address1' => $this->shipping_address1,
|
377 |
+
'address2' => $this->shipping_address2,
|
378 |
+
'zip_code' => $this->shipping_zip_code,
|
379 |
+
'city' => $this->shipping_city,
|
380 |
+
'state' => $this->shipping_state,
|
381 |
+
'country' => $this->shipping_country,
|
382 |
+
),
|
383 |
+
'risk_params' => array(
|
384 |
+
'ssn' => $this->risk_ssn,
|
385 |
+
'mac_address' => $this->risk_mac_address,
|
386 |
+
'session_id' => $this->risk_session_id,
|
387 |
+
'user_id' => $this->risk_user_id,
|
388 |
+
'user_level' => $this->risk_user_level,
|
389 |
+
'email' => $this->risk_email,
|
390 |
+
'phone' => $this->risk_phone,
|
391 |
+
'remote_ip' => $this->risk_remote_ip,
|
392 |
+
'serial_number' => $this->risk_serial_number,
|
393 |
+
)
|
394 |
+
)
|
395 |
+
);
|
396 |
+
|
397 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
398 |
+
}
|
399 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/AccountVerification.php
ADDED
@@ -0,0 +1,399 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Account Verification Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class AccountVerification extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Description of the transaction for later use
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $usage;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Signifies whether a MOTO (mail order telephone order) transaction is performed.
|
49 |
+
*
|
50 |
+
* Contact tech support for more details.
|
51 |
+
*
|
52 |
+
* @var bool
|
53 |
+
*/
|
54 |
+
protected $moto;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* IPv4 address of customer
|
58 |
+
*
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
protected $remote_ip;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Full name of customer as printed on credit card (first name and last name at least)
|
65 |
+
*
|
66 |
+
* @var string
|
67 |
+
*/
|
68 |
+
protected $card_holder;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Complete CC number of customer
|
72 |
+
*
|
73 |
+
* @var int
|
74 |
+
*/
|
75 |
+
protected $card_number;
|
76 |
+
|
77 |
+
/**
|
78 |
+
* CVV of CC, requirement is based on terminal configuration
|
79 |
+
*
|
80 |
+
* @var int
|
81 |
+
*/
|
82 |
+
protected $cvv;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Expiration month as printed on credit card
|
86 |
+
*
|
87 |
+
* @var string (mm)
|
88 |
+
*/
|
89 |
+
protected $expiration_month;
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Expiration year as printed on credit card
|
93 |
+
*
|
94 |
+
* @var string (yyyy)
|
95 |
+
*/
|
96 |
+
protected $expiration_year;
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Email address of the Customer
|
100 |
+
*
|
101 |
+
* @var string
|
102 |
+
*/
|
103 |
+
protected $customer_email;
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Phone number of the customer
|
107 |
+
*
|
108 |
+
* @var string
|
109 |
+
*/
|
110 |
+
protected $customer_phone;
|
111 |
+
|
112 |
+
/**
|
113 |
+
*Customer's Billing Address: First name
|
114 |
+
*
|
115 |
+
* @var string
|
116 |
+
*/
|
117 |
+
protected $billing_first_name;
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Customer's Billing Address: Last name
|
121 |
+
*
|
122 |
+
* @var string
|
123 |
+
*/
|
124 |
+
protected $billing_last_name;
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Customer's Billing Address: Part 1
|
128 |
+
*
|
129 |
+
* @var string
|
130 |
+
*/
|
131 |
+
protected $billing_address1;
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Customer's Billing Address: Part 2
|
135 |
+
* @var string
|
136 |
+
*/
|
137 |
+
protected $billing_address2;
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Customer's Billing Address: ZIP
|
141 |
+
*
|
142 |
+
* @var string
|
143 |
+
*/
|
144 |
+
protected $billing_zip_code;
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Customer's Billing Address: City
|
148 |
+
*
|
149 |
+
* @var string
|
150 |
+
*/
|
151 |
+
protected $billing_city;
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Customer's Billing Address: State
|
155 |
+
*
|
156 |
+
* format: ISO-3166-2
|
157 |
+
*
|
158 |
+
* @var string
|
159 |
+
*/
|
160 |
+
protected $billing_state;
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Customer's Billing Address: Country
|
164 |
+
*
|
165 |
+
* format: ISO-3166
|
166 |
+
*
|
167 |
+
* @var string
|
168 |
+
*/
|
169 |
+
protected $billing_country;
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Customer's Shipping Address: First name
|
173 |
+
*
|
174 |
+
* @var string
|
175 |
+
*/
|
176 |
+
protected $shipping_first_name;
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Customer's Shipping Address: Last name
|
180 |
+
*
|
181 |
+
* @var string
|
182 |
+
*/
|
183 |
+
protected $shipping_last_name;
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Customer's Shipping Address: Part 1
|
187 |
+
*
|
188 |
+
* @var string
|
189 |
+
*/
|
190 |
+
protected $shipping_address1;
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Customer's Shipping Address: Part 2
|
194 |
+
*
|
195 |
+
* @var string
|
196 |
+
*/
|
197 |
+
protected $shipping_address2;
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Customer's Shipping Address: ZIP
|
201 |
+
*
|
202 |
+
* @var string
|
203 |
+
*/
|
204 |
+
protected $shipping_zip_code;
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Customer's Shipping Address: City
|
208 |
+
*
|
209 |
+
* @var string
|
210 |
+
*/
|
211 |
+
protected $shipping_city;
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Customer's Shipping Address: State
|
215 |
+
*
|
216 |
+
* format: ISO-3166-2
|
217 |
+
*
|
218 |
+
* @var string
|
219 |
+
*/
|
220 |
+
protected $shipping_state;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Customer's Shipping Address
|
224 |
+
*
|
225 |
+
* format: ISO-3166
|
226 |
+
*
|
227 |
+
* @var string
|
228 |
+
*/
|
229 |
+
protected $shipping_country;
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Social Security number or equivalent value for non US customers.
|
233 |
+
*
|
234 |
+
* @var string
|
235 |
+
*/
|
236 |
+
protected $risk_ssn;
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Customer's MAC address
|
240 |
+
*
|
241 |
+
* @var string
|
242 |
+
*/
|
243 |
+
protected $risk_mac_address;
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Customer's Session Id
|
247 |
+
*
|
248 |
+
* @var string
|
249 |
+
*/
|
250 |
+
protected $risk_session_id;
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Customer's User Id
|
254 |
+
*
|
255 |
+
* @var string
|
256 |
+
*/
|
257 |
+
protected $risk_user_id;
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Customer's User Level
|
261 |
+
*
|
262 |
+
* @var string
|
263 |
+
*/
|
264 |
+
protected $risk_user_level;
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Customer's Email address
|
268 |
+
*
|
269 |
+
* @note Set here if different from
|
270 |
+
* shipping / billing
|
271 |
+
*
|
272 |
+
* @var string
|
273 |
+
*/
|
274 |
+
protected $risk_email;
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Customer's Phone number
|
278 |
+
*
|
279 |
+
* @note Set here if different from
|
280 |
+
* shipping / billing
|
281 |
+
*
|
282 |
+
* @var string
|
283 |
+
*/
|
284 |
+
protected $risk_phone;
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Customer's IP address
|
288 |
+
*
|
289 |
+
* @note Set here if different from remote_ip
|
290 |
+
*
|
291 |
+
* @var string
|
292 |
+
*/
|
293 |
+
protected $risk_remote_ip;
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Customer's Serial Number
|
297 |
+
*
|
298 |
+
* @var string
|
299 |
+
*/
|
300 |
+
protected $risk_serial_number;
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Set the per-request configuration
|
304 |
+
*
|
305 |
+
* @return void
|
306 |
+
*/
|
307 |
+
protected function initConfiguration()
|
308 |
+
{
|
309 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
310 |
+
array(
|
311 |
+
'protocol' => 'https',
|
312 |
+
'port' => 443,
|
313 |
+
'type' => 'POST',
|
314 |
+
'format' => 'xml',
|
315 |
+
)
|
316 |
+
);
|
317 |
+
|
318 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Set the required fields
|
323 |
+
*
|
324 |
+
* @return void
|
325 |
+
*/
|
326 |
+
protected function setRequiredFields()
|
327 |
+
{
|
328 |
+
$requiredFields = array(
|
329 |
+
'transaction_id',
|
330 |
+
'card_holder',
|
331 |
+
'card_number',
|
332 |
+
'expiration_month',
|
333 |
+
'expiration_year',
|
334 |
+
'billing_address1',
|
335 |
+
'billing_zip_code',
|
336 |
+
'billing_city',
|
337 |
+
);
|
338 |
+
|
339 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Create the request's Tree structure
|
344 |
+
*
|
345 |
+
* @return void
|
346 |
+
*/
|
347 |
+
protected function populateStructure()
|
348 |
+
{
|
349 |
+
$treeStructure = array(
|
350 |
+
'payment_transaction' => array(
|
351 |
+
'transaction_type' => \Genesis\API\Constants\Transaction\Types::ACCOUNT_VERIFICATION,
|
352 |
+
'transaction_id' => $this->transaction_id,
|
353 |
+
'usage' => $this->usage,
|
354 |
+
'moto' => $this->moto,
|
355 |
+
'remote_ip' => $this->remote_ip,
|
356 |
+
'card_holder' => $this->card_holder,
|
357 |
+
'card_number' => $this->card_number,
|
358 |
+
'cvv' => $this->cvv,
|
359 |
+
'expiration_month' => $this->expiration_month,
|
360 |
+
'expiration_year' => $this->expiration_year,
|
361 |
+
'customer_email' => $this->customer_email,
|
362 |
+
'customer_phone' => $this->customer_phone,
|
363 |
+
'billing_address' => array(
|
364 |
+
'first_name' => $this->billing_first_name,
|
365 |
+
'last_name' => $this->billing_last_name,
|
366 |
+
'address1' => $this->billing_address1,
|
367 |
+
'address2' => $this->billing_address2,
|
368 |
+
'zip_code' => $this->billing_zip_code,
|
369 |
+
'city' => $this->billing_city,
|
370 |
+
'state' => $this->billing_state,
|
371 |
+
'country' => $this->billing_country,
|
372 |
+
),
|
373 |
+
'shipping_address' => array(
|
374 |
+
'first_name' => $this->shipping_first_name,
|
375 |
+
'last_name' => $this->shipping_last_name,
|
376 |
+
'address1' => $this->shipping_address1,
|
377 |
+
'address2' => $this->shipping_address2,
|
378 |
+
'zip_code' => $this->shipping_zip_code,
|
379 |
+
'city' => $this->shipping_city,
|
380 |
+
'state' => $this->shipping_state,
|
381 |
+
'country' => $this->shipping_country,
|
382 |
+
),
|
383 |
+
'risk_params' => array(
|
384 |
+
'ssn' => $this->risk_ssn,
|
385 |
+
'mac_address' => $this->risk_mac_address,
|
386 |
+
'session_id' => $this->risk_session_id,
|
387 |
+
'user_id' => $this->risk_user_id,
|
388 |
+
'user_level' => $this->risk_user_level,
|
389 |
+
'email' => $this->risk_email,
|
390 |
+
'phone' => $this->risk_phone,
|
391 |
+
'remote_ip' => $this->risk_remote_ip,
|
392 |
+
'serial_number' => $this->risk_serial_number,
|
393 |
+
)
|
394 |
+
)
|
395 |
+
);
|
396 |
+
|
397 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
398 |
+
}
|
399 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Blacklist.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Blacklist Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Blacklist extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* the credit card number to be checked
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $card_number;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* terminal token (if you wish to use a different, than the one set in the Config)
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $terminal_token;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Set the per-request configuration
|
49 |
+
*
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
protected function initConfiguration()
|
53 |
+
{
|
54 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
55 |
+
array(
|
56 |
+
'protocol' => 'https',
|
57 |
+
'port' => 443,
|
58 |
+
'type' => 'POST',
|
59 |
+
'format' => 'xml',
|
60 |
+
)
|
61 |
+
);
|
62 |
+
|
63 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'blacklists', \Genesis\Config::getToken()));
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Set the required fields
|
68 |
+
*
|
69 |
+
* @return void
|
70 |
+
*/
|
71 |
+
protected function setRequiredFields()
|
72 |
+
{
|
73 |
+
$requiredFields = array(
|
74 |
+
'card_number',
|
75 |
+
);
|
76 |
+
|
77 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Create the request's Tree structure
|
82 |
+
*
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
protected function populateStructure()
|
86 |
+
{
|
87 |
+
$treeStructure = array(
|
88 |
+
'blacklist_request' => array(
|
89 |
+
'card_number' => $this->card_number,
|
90 |
+
'terminal_token' => $this->terminal_token,
|
91 |
+
)
|
92 |
+
);
|
93 |
+
|
94 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
95 |
+
}
|
96 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Chargeback/DateRange.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Fraud\Chargeback;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Chargeback request by Date Range
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class DateRange extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* start of the requested date range
|
35 |
+
*
|
36 |
+
* @var string (yyyy-mm-dd)
|
37 |
+
*/
|
38 |
+
protected $start_date;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* end of the requested date range
|
42 |
+
*
|
43 |
+
* @var string (yyyy-mm-dd)
|
44 |
+
*/
|
45 |
+
protected $end_date;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* the page within the paginated result
|
49 |
+
*
|
50 |
+
* default: 1
|
51 |
+
*
|
52 |
+
* @var int
|
53 |
+
*/
|
54 |
+
protected $page;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Set the per-request configuration
|
58 |
+
*
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
+
protected function initConfiguration()
|
62 |
+
{
|
63 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
64 |
+
array(
|
65 |
+
'protocol' => 'https',
|
66 |
+
'port' => 443,
|
67 |
+
'type' => 'POST',
|
68 |
+
'format' => 'xml',
|
69 |
+
)
|
70 |
+
);
|
71 |
+
|
72 |
+
$this->setApiConfig(
|
73 |
+
'url',
|
74 |
+
$this->buildRequestURL(
|
75 |
+
'gateway',
|
76 |
+
'chargebacks/by_date',
|
77 |
+
false
|
78 |
+
)
|
79 |
+
);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Set the required fields
|
84 |
+
*
|
85 |
+
* @return void
|
86 |
+
*/
|
87 |
+
protected function setRequiredFields()
|
88 |
+
{
|
89 |
+
$requiredFields = array(
|
90 |
+
'start_date',
|
91 |
+
);
|
92 |
+
|
93 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Create the request's Tree structure
|
98 |
+
*
|
99 |
+
* @return void
|
100 |
+
*/
|
101 |
+
protected function populateStructure()
|
102 |
+
{
|
103 |
+
$treeStructure = array(
|
104 |
+
'chargeback_request' => array(
|
105 |
+
'start_date' => $this->start_date,
|
106 |
+
'end_date' => $this->end_date,
|
107 |
+
'page' => $this->page,
|
108 |
+
)
|
109 |
+
);
|
110 |
+
|
111 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
112 |
+
}
|
113 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Chargeback/Transaction.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Fraud\Chargeback;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Chargeback request by ARN/Unique Transaction Id
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Transaction extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Acquirer's Reference Number
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $arn;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Unique ID of the original (reference) transaction
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $original_transaction_unique_id;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Set the per-request configuration
|
49 |
+
*
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
protected function initConfiguration()
|
53 |
+
{
|
54 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
55 |
+
array(
|
56 |
+
'protocol' => 'https',
|
57 |
+
'port' => 443,
|
58 |
+
'type' => 'POST',
|
59 |
+
'format' => 'xml',
|
60 |
+
)
|
61 |
+
);
|
62 |
+
|
63 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'chargebacks', false));
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Set the required fields
|
68 |
+
*
|
69 |
+
* @return void
|
70 |
+
*/
|
71 |
+
protected function setRequiredFields()
|
72 |
+
{
|
73 |
+
$requiredFieldsOR = array(
|
74 |
+
'arn',
|
75 |
+
'original_transaction_unique_id'
|
76 |
+
);
|
77 |
+
|
78 |
+
$this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Create the request's Tree structure
|
83 |
+
*
|
84 |
+
* @return void
|
85 |
+
*/
|
86 |
+
protected function populateStructure()
|
87 |
+
{
|
88 |
+
$treeStructure = array(
|
89 |
+
'chargeback_request' => array(
|
90 |
+
'arn' => $this->arn,
|
91 |
+
'original_transaction_unique_id' => $this->original_transaction_unique_id,
|
92 |
+
)
|
93 |
+
);
|
94 |
+
|
95 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
96 |
+
}
|
97 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Reports/DateRange.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Fraud\Reports;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Fraud (SAFE/TC40) reports by Date Range
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
|
32 |
+
class DateRange extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* start of the requested date range
|
36 |
+
*
|
37 |
+
* @var string (yyyy-mm-dd)
|
38 |
+
*/
|
39 |
+
protected $start_date;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* end of the requested date range
|
43 |
+
*
|
44 |
+
* @var string (yyyy-mm-dd)
|
45 |
+
*/
|
46 |
+
protected $end_date;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* the page within the paginated result
|
50 |
+
*
|
51 |
+
* default: 1
|
52 |
+
*
|
53 |
+
* @var int
|
54 |
+
*/
|
55 |
+
protected $page;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Set the per-request configuration
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
protected function initConfiguration()
|
63 |
+
{
|
64 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
65 |
+
array(
|
66 |
+
'protocol' => 'https',
|
67 |
+
'port' => 443,
|
68 |
+
'type' => 'POST',
|
69 |
+
'format' => 'xml',
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
$this->setApiConfig(
|
74 |
+
'url',
|
75 |
+
$this->buildRequestURL(
|
76 |
+
'gateway',
|
77 |
+
'fraud_reports/by_date',
|
78 |
+
false
|
79 |
+
)
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Set the required fields
|
85 |
+
*
|
86 |
+
* @return void
|
87 |
+
*/
|
88 |
+
protected function setRequiredFields()
|
89 |
+
{
|
90 |
+
$requiredFields = array(
|
91 |
+
'start_date',
|
92 |
+
);
|
93 |
+
|
94 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Create the request's Tree structure
|
99 |
+
*
|
100 |
+
* @return void
|
101 |
+
*/
|
102 |
+
protected function populateStructure()
|
103 |
+
{
|
104 |
+
$treeStructure = array(
|
105 |
+
'fraud_report_request' => array(
|
106 |
+
'start_date' => $this->start_date,
|
107 |
+
'end_date' => $this->end_date,
|
108 |
+
'page' => $this->page,
|
109 |
+
)
|
110 |
+
);
|
111 |
+
|
112 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
113 |
+
}
|
114 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Reports/Transaction.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Fraud\Reports;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Fraud (SAFE/TC40) Report by arn/original_transaction_unique_id
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Transaction extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Acquirer's Reference Number
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $arn;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Unique ID of the original (reference) transaction
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $original_transaction_unique_id;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Set the per-request configuration
|
49 |
+
*
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
protected function initConfiguration()
|
53 |
+
{
|
54 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
55 |
+
array(
|
56 |
+
'protocol' => 'https',
|
57 |
+
'port' => 443,
|
58 |
+
'type' => 'POST',
|
59 |
+
'format' => 'xml',
|
60 |
+
)
|
61 |
+
);
|
62 |
+
|
63 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'fraud_reports', false));
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Set the required fields
|
68 |
+
*
|
69 |
+
* @return void
|
70 |
+
*/
|
71 |
+
protected function setRequiredFields()
|
72 |
+
{
|
73 |
+
$requiredFieldsOR = array(
|
74 |
+
'arn',
|
75 |
+
'original_transaction_unique_id'
|
76 |
+
);
|
77 |
+
|
78 |
+
$this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Create the request's Tree structure
|
83 |
+
*
|
84 |
+
* @return void
|
85 |
+
*/
|
86 |
+
protected function populateStructure()
|
87 |
+
{
|
88 |
+
$treeStructure = array(
|
89 |
+
'fraud_report_request' => array(
|
90 |
+
'arn' => $this->arn,
|
91 |
+
'original_transaction_unique_id' => $this->original_transaction_unique_id,
|
92 |
+
)
|
93 |
+
);
|
94 |
+
|
95 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
96 |
+
}
|
97 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Retrieval/DateRange.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Fraud\Retrieval;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Retrieval request by Date Range
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
|
32 |
+
class DateRange extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* start of the requested date range
|
36 |
+
*
|
37 |
+
* @var string (yyyy-mm-dd)
|
38 |
+
*/
|
39 |
+
protected $start_date;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* end of the requested date range
|
43 |
+
*
|
44 |
+
* @var string (yyyy-mm-dd)
|
45 |
+
*/
|
46 |
+
protected $end_date;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* the page within the paginated result
|
50 |
+
*
|
51 |
+
* default: 1
|
52 |
+
*
|
53 |
+
* @var int
|
54 |
+
*/
|
55 |
+
protected $page;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Set the per-request configuration
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
protected function initConfiguration()
|
63 |
+
{
|
64 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
65 |
+
array(
|
66 |
+
'protocol' => 'https',
|
67 |
+
'port' => 443,
|
68 |
+
'type' => 'POST',
|
69 |
+
'format' => 'xml',
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
$this->setApiConfig(
|
74 |
+
'url',
|
75 |
+
$this->buildRequestURL(
|
76 |
+
'gateway',
|
77 |
+
'retrieval_requests/by_date',
|
78 |
+
false
|
79 |
+
)
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Set the required fields
|
85 |
+
*
|
86 |
+
* @return void
|
87 |
+
*/
|
88 |
+
protected function setRequiredFields()
|
89 |
+
{
|
90 |
+
$requiredFields = array(
|
91 |
+
'start_date',
|
92 |
+
);
|
93 |
+
|
94 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Create the request's Tree structure
|
99 |
+
*
|
100 |
+
* @return void
|
101 |
+
*/
|
102 |
+
protected function populateStructure()
|
103 |
+
{
|
104 |
+
$treeStructure = array(
|
105 |
+
'retrieval_request_request' => array(
|
106 |
+
'start_date' => $this->start_date,
|
107 |
+
'end_date' => $this->end_date,
|
108 |
+
'page' => $this->page,
|
109 |
+
)
|
110 |
+
);
|
111 |
+
|
112 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
113 |
+
}
|
114 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Retrieval/Transaction.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Fraud\Retrieval;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Retrieval request by ARN/Unique Transaction Id
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Transaction extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Acquirer's Reference Number
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $arn;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Unique ID of the original (reference) transaction
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $original_transaction_unique_id;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Set the per-request configuration
|
49 |
+
*
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
protected function initConfiguration()
|
53 |
+
{
|
54 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
55 |
+
array(
|
56 |
+
'protocol' => 'https',
|
57 |
+
'port' => 443,
|
58 |
+
'type' => 'POST',
|
59 |
+
'format' => 'xml',
|
60 |
+
)
|
61 |
+
);
|
62 |
+
|
63 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'retrieval_requests', false));
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Set the required fields
|
68 |
+
*
|
69 |
+
* @return void
|
70 |
+
*/
|
71 |
+
protected function setRequiredFields()
|
72 |
+
{
|
73 |
+
$requiredFieldsOR = array(
|
74 |
+
'arn',
|
75 |
+
'original_transaction_unique_id'
|
76 |
+
);
|
77 |
+
|
78 |
+
$this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Create the request's Tree structure
|
83 |
+
*
|
84 |
+
* @return void
|
85 |
+
*/
|
86 |
+
protected function populateStructure()
|
87 |
+
{
|
88 |
+
$treeStructure = array(
|
89 |
+
'retrieval_request_request' => array(
|
90 |
+
'arn' => $this->arn,
|
91 |
+
'original_transaction_unique_id' => $this->original_transaction_unique_id,
|
92 |
+
)
|
93 |
+
);
|
94 |
+
|
95 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
96 |
+
}
|
97 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Reconcile/DateRange.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Reconcile;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Reconcile request by Date Range
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class DateRange extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* start of the requested date range
|
35 |
+
*
|
36 |
+
* @var string (yyyy-mm-dd)
|
37 |
+
*/
|
38 |
+
protected $start_date;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* end of the requested date range
|
42 |
+
*
|
43 |
+
* @var string (yyyy-mm-dd)
|
44 |
+
*/
|
45 |
+
protected $end_date;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* the page within the paginated result
|
49 |
+
*
|
50 |
+
* default: 1
|
51 |
+
*
|
52 |
+
* @var int
|
53 |
+
*/
|
54 |
+
protected $page;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Set the per-request configuration
|
58 |
+
*
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
+
protected function initConfiguration()
|
62 |
+
{
|
63 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
64 |
+
array(
|
65 |
+
'protocol' => 'https',
|
66 |
+
'port' => 443,
|
67 |
+
'type' => 'POST',
|
68 |
+
'format' => 'xml',
|
69 |
+
)
|
70 |
+
);
|
71 |
+
|
72 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'reconcile/by_date', \Genesis\Config::getToken()));
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Set the required fields
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
protected function setRequiredFields()
|
81 |
+
{
|
82 |
+
$requiredFields = array(
|
83 |
+
'start_date',
|
84 |
+
);
|
85 |
+
|
86 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Create the request's Tree structure
|
91 |
+
*
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
protected function populateStructure()
|
95 |
+
{
|
96 |
+
$treeStructure = array(
|
97 |
+
'reconcile' => array(
|
98 |
+
'start_date' => $this->start_date,
|
99 |
+
'end_date' => $this->end_date,
|
100 |
+
'page' => $this->page,
|
101 |
+
)
|
102 |
+
);
|
103 |
+
|
104 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
105 |
+
}
|
106 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Reconcile/Transaction.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Reconcile;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Reconcile request by arn, transaction_id or unique_id
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Transaction extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Acquirer's Reference Number
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $arn;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Transaction id of an existing transaction
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $transaction_id;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Unique id of an existing transaction
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
protected $unique_id;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Set the per-request configuration
|
56 |
+
*
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
protected function initConfiguration()
|
60 |
+
{
|
61 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
62 |
+
array(
|
63 |
+
'protocol' => 'https',
|
64 |
+
'port' => 443,
|
65 |
+
'type' => 'POST',
|
66 |
+
'format' => 'xml',
|
67 |
+
)
|
68 |
+
);
|
69 |
+
|
70 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'reconcile', \Genesis\Config::getToken()));
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Set the required fields
|
75 |
+
*
|
76 |
+
* @return void
|
77 |
+
*/
|
78 |
+
protected function setRequiredFields()
|
79 |
+
{
|
80 |
+
$requiredFieldsGroups = array(
|
81 |
+
'id' => array('arn', 'transaction_id', 'unique_id'),
|
82 |
+
);
|
83 |
+
|
84 |
+
$this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Create the request's Tree structure
|
89 |
+
*
|
90 |
+
* @return void
|
91 |
+
*/
|
92 |
+
protected function populateStructure()
|
93 |
+
{
|
94 |
+
$treeStructure = array(
|
95 |
+
'reconcile' => array(
|
96 |
+
'arn' => $this->arn,
|
97 |
+
'transaction_id' => $this->transaction_id,
|
98 |
+
'unique_id' => $this->unique_id,
|
99 |
+
)
|
100 |
+
);
|
101 |
+
|
102 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
103 |
+
}
|
104 |
+
}
|
lib/Genesis/src/Genesis/API/Request/NonFinancial/Retrieve/AbniDealBanks.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\NonFinancial\Retrieve;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class AbniDealBanks
|
27 |
+
*
|
28 |
+
* Retrieve the available Banks for iDEAL payment via ABN
|
29 |
+
*
|
30 |
+
* @package Genesis\API\Request\NonFinancial\Retrieve
|
31 |
+
*/
|
32 |
+
class AbniDealBanks extends \Genesis\API\Request
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Set the per-request configuration
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
protected function initConfiguration()
|
40 |
+
{
|
41 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
42 |
+
array(
|
43 |
+
'protocol' => 'https',
|
44 |
+
'port' => 443,
|
45 |
+
'type' => 'GET',
|
46 |
+
'format' => 'plain',
|
47 |
+
)
|
48 |
+
);
|
49 |
+
|
50 |
+
$this->setApiConfig('url', $this->buildRequestURL('gateway', 'retrieve_abn_ideal_banks', false));
|
51 |
+
}
|
52 |
+
}
|
lib/Genesis/src/Genesis/API/Request/WPF/Create.php
ADDED
@@ -0,0 +1,470 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\WPF;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Web-Payment-Form Request
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Create extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* unique transaction id defined by merchant
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $transaction_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Amount of transaction in minor currency unit
|
42 |
+
*
|
43 |
+
* @var int
|
44 |
+
*/
|
45 |
+
protected $amount;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Currency code in ISO-4217
|
49 |
+
*
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
protected $currency;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Statement, as it appears in the customer’s bank statement
|
56 |
+
*
|
57 |
+
* @var string
|
58 |
+
*/
|
59 |
+
protected $usage;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* a text describing the reason of the payment
|
63 |
+
*
|
64 |
+
* e.g. "you’re buying concert tickets"
|
65 |
+
*
|
66 |
+
* @var string
|
67 |
+
*/
|
68 |
+
protected $description;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Email address of the Customer
|
72 |
+
*
|
73 |
+
* @var string
|
74 |
+
*/
|
75 |
+
protected $customer_email;
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Phone number of the customer
|
79 |
+
*
|
80 |
+
* @var string
|
81 |
+
*/
|
82 |
+
protected $customer_phone;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* URL endpoint for Genesis Notifications
|
86 |
+
*
|
87 |
+
* @var string
|
88 |
+
*/
|
89 |
+
protected $notification_url;
|
90 |
+
|
91 |
+
/**
|
92 |
+
* URL where customer is sent to after successful payment
|
93 |
+
*
|
94 |
+
* @var string
|
95 |
+
*/
|
96 |
+
protected $return_success_url;
|
97 |
+
|
98 |
+
/**
|
99 |
+
* URL where customer is sent to after un-successful payment
|
100 |
+
*
|
101 |
+
* @var string
|
102 |
+
*/
|
103 |
+
protected $return_failure_url;
|
104 |
+
|
105 |
+
/**
|
106 |
+
* URL where the customer is sent to after they cancel the payment
|
107 |
+
*
|
108 |
+
* @var string
|
109 |
+
*/
|
110 |
+
protected $return_cancel_url;
|
111 |
+
|
112 |
+
/**
|
113 |
+
*Customer's Billing Address: First name
|
114 |
+
*
|
115 |
+
* @var string
|
116 |
+
*/
|
117 |
+
protected $billing_first_name;
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Customer's Billing Address: Last name
|
121 |
+
*
|
122 |
+
* @var string
|
123 |
+
*/
|
124 |
+
protected $billing_last_name;
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Customer's Billing Address: Part 1
|
128 |
+
*
|
129 |
+
* @var string
|
130 |
+
*/
|
131 |
+
protected $billing_address1;
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Customer's Billing Address: Part 2
|
135 |
+
* @var string
|
136 |
+
*/
|
137 |
+
protected $billing_address2;
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Customer's Billing Address: ZIP
|
141 |
+
*
|
142 |
+
* @var string
|
143 |
+
*/
|
144 |
+
protected $billing_zip_code;
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Customer's Billing Address: City
|
148 |
+
*
|
149 |
+
* @var string
|
150 |
+
*/
|
151 |
+
protected $billing_city;
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Customer's Billing Address: State
|
155 |
+
*
|
156 |
+
* format: ISO-3166-2
|
157 |
+
*
|
158 |
+
* @var string
|
159 |
+
*/
|
160 |
+
protected $billing_state;
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Customer's Billing Address: Country
|
164 |
+
*
|
165 |
+
* format: ISO-3166
|
166 |
+
*
|
167 |
+
* @var string
|
168 |
+
*/
|
169 |
+
protected $billing_country;
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Customer's Shipping Address: First name
|
173 |
+
*
|
174 |
+
* @var string
|
175 |
+
*/
|
176 |
+
protected $shipping_first_name;
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Customer's Shipping Address: Last name
|
180 |
+
*
|
181 |
+
* @var string
|
182 |
+
*/
|
183 |
+
protected $shipping_last_name;
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Customer's Shipping Address: Part 1
|
187 |
+
*
|
188 |
+
* @var string
|
189 |
+
*/
|
190 |
+
protected $shipping_address1;
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Customer's Shipping Address: Part 2
|
194 |
+
*
|
195 |
+
* @var string
|
196 |
+
*/
|
197 |
+
protected $shipping_address2;
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Customer's Shipping Address: ZIP
|
201 |
+
*
|
202 |
+
* @var string
|
203 |
+
*/
|
204 |
+
protected $shipping_zip_code;
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Customer's Shipping Address: City
|
208 |
+
*
|
209 |
+
* @var string
|
210 |
+
*/
|
211 |
+
protected $shipping_city;
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Customer's Shipping Address: State
|
215 |
+
*
|
216 |
+
* format: ISO-3166-2
|
217 |
+
*
|
218 |
+
* @var string
|
219 |
+
*/
|
220 |
+
protected $shipping_state;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Customer's Shipping Address
|
224 |
+
*
|
225 |
+
* format: ISO-3166
|
226 |
+
*
|
227 |
+
* @var string
|
228 |
+
*/
|
229 |
+
protected $shipping_country;
|
230 |
+
|
231 |
+
/**
|
232 |
+
* The transaction types that the merchant is willing to accept payments for
|
233 |
+
*
|
234 |
+
* @var array
|
235 |
+
*/
|
236 |
+
protected $transaction_types = array();
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Social Security number or equivalent value for non US customers.
|
240 |
+
*
|
241 |
+
* @var string
|
242 |
+
*/
|
243 |
+
protected $risk_ssn;
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Customer's MAC address
|
247 |
+
*
|
248 |
+
* @var string
|
249 |
+
*/
|
250 |
+
protected $risk_mac_address;
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Customer's Session Id
|
254 |
+
*
|
255 |
+
* @var string
|
256 |
+
*/
|
257 |
+
protected $risk_session_id;
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Customer's User Id
|
261 |
+
*
|
262 |
+
* @var string
|
263 |
+
*/
|
264 |
+
protected $risk_user_id;
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Customer's User Level
|
268 |
+
*
|
269 |
+
* @var string
|
270 |
+
*/
|
271 |
+
protected $risk_user_level;
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Customer's Email address
|
275 |
+
*
|
276 |
+
* @note Set here if different from
|
277 |
+
* shipping / billing
|
278 |
+
*
|
279 |
+
* @var string
|
280 |
+
*/
|
281 |
+
protected $risk_email;
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Customer's Phone number
|
285 |
+
*
|
286 |
+
* @note Set here if different from
|
287 |
+
* shipping / billing
|
288 |
+
*
|
289 |
+
* @var string
|
290 |
+
*/
|
291 |
+
protected $risk_phone;
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Customer's IP address
|
295 |
+
*
|
296 |
+
* @note Set here if different from remote_ip
|
297 |
+
*
|
298 |
+
* @var string
|
299 |
+
*/
|
300 |
+
protected $risk_remote_ip;
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Customer's Serial Number
|
304 |
+
*
|
305 |
+
* @var string
|
306 |
+
*/
|
307 |
+
protected $risk_serial_number;
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Add transaction type to the list of available types
|
311 |
+
*
|
312 |
+
* @param string $name
|
313 |
+
*
|
314 |
+
* @param array $parameters
|
315 |
+
*
|
316 |
+
* @return $this
|
317 |
+
*/
|
318 |
+
public function addTransactionType($name, $parameters = array())
|
319 |
+
{
|
320 |
+
$structure = array(
|
321 |
+
'transaction_type' => array(
|
322 |
+
'@attributes' => array(
|
323 |
+
'name' => $name
|
324 |
+
),
|
325 |
+
$parameters
|
326 |
+
)
|
327 |
+
);
|
328 |
+
|
329 |
+
array_push($this->transaction_types, $structure);
|
330 |
+
|
331 |
+
return $this;
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Add ISO 639-1 language code to the URL
|
336 |
+
*
|
337 |
+
* @param string $language iso code of the language
|
338 |
+
*
|
339 |
+
* @return $this
|
340 |
+
*
|
341 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
342 |
+
*/
|
343 |
+
public function setLanguage($language = \Genesis\API\Constants\i18n::EN)
|
344 |
+
{
|
345 |
+
// Strip the input down to two letters
|
346 |
+
$language = substr(strtolower($language), 0, 2);
|
347 |
+
|
348 |
+
if (!\Genesis\API\Constants\i18n::isValidLanguageCode($language)) {
|
349 |
+
throw new \Genesis\Exceptions\InvalidArgument(
|
350 |
+
'The provided argument is not a valid ISO-639-1 language code!'
|
351 |
+
);
|
352 |
+
}
|
353 |
+
|
354 |
+
$this->setApiConfig(
|
355 |
+
'url',
|
356 |
+
$this->buildRequestURL(
|
357 |
+
'wpf',
|
358 |
+
sprintf('%s/wpf', $language),
|
359 |
+
false
|
360 |
+
)
|
361 |
+
);
|
362 |
+
|
363 |
+
return $this;
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Set the per-request configuration
|
368 |
+
*
|
369 |
+
* @return void
|
370 |
+
*/
|
371 |
+
protected function initConfiguration()
|
372 |
+
{
|
373 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
374 |
+
array(
|
375 |
+
'protocol' => 'https',
|
376 |
+
'port' => 443,
|
377 |
+
'type' => 'POST',
|
378 |
+
'format' => 'xml',
|
379 |
+
)
|
380 |
+
);
|
381 |
+
|
382 |
+
$this->setApiConfig('url', $this->buildRequestURL('wpf', 'wpf', false));
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Set the required fields
|
387 |
+
*
|
388 |
+
* @return void
|
389 |
+
*/
|
390 |
+
protected function setRequiredFields()
|
391 |
+
{
|
392 |
+
$requiredFields = array(
|
393 |
+
'transaction_id',
|
394 |
+
'amount',
|
395 |
+
'currency',
|
396 |
+
'description',
|
397 |
+
'notification_url',
|
398 |
+
'return_success_url',
|
399 |
+
'return_failure_url',
|
400 |
+
'return_cancel_url',
|
401 |
+
'transaction_types',
|
402 |
+
);
|
403 |
+
|
404 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Create the request's Tree structure
|
409 |
+
*
|
410 |
+
* @return void
|
411 |
+
*/
|
412 |
+
protected function populateStructure()
|
413 |
+
{
|
414 |
+
$treeStructure = array(
|
415 |
+
'wpf_payment' => array(
|
416 |
+
'transaction_id' => $this->transaction_id,
|
417 |
+
'amount' => $this->transform(
|
418 |
+
'amount',
|
419 |
+
array(
|
420 |
+
$this->amount,
|
421 |
+
$this->currency,
|
422 |
+
)
|
423 |
+
),
|
424 |
+
'currency' => $this->currency,
|
425 |
+
'usage' => $this->usage,
|
426 |
+
'description' => $this->description,
|
427 |
+
'customer_email' => $this->customer_email,
|
428 |
+
'customer_phone' => $this->customer_phone,
|
429 |
+
'notification_url' => $this->notification_url,
|
430 |
+
'return_success_url' => $this->return_success_url,
|
431 |
+
'return_failure_url' => $this->return_failure_url,
|
432 |
+
'return_cancel_url' => $this->return_cancel_url,
|
433 |
+
'billing_address' => array(
|
434 |
+
'first_name' => $this->billing_first_name,
|
435 |
+
'last_name' => $this->billing_last_name,
|
436 |
+
'address1' => $this->billing_address1,
|
437 |
+
'address2' => $this->billing_address2,
|
438 |
+
'zip_code' => $this->billing_zip_code,
|
439 |
+
'city' => $this->billing_city,
|
440 |
+
'state' => $this->billing_state,
|
441 |
+
'country' => $this->billing_country,
|
442 |
+
),
|
443 |
+
'shipping_address' => array(
|
444 |
+
'first_name' => $this->shipping_first_name,
|
445 |
+
'last_name' => $this->shipping_last_name,
|
446 |
+
'address1' => $this->shipping_address1,
|
447 |
+
'address2' => $this->shipping_address2,
|
448 |
+
'zip_code' => $this->shipping_zip_code,
|
449 |
+
'city' => $this->shipping_city,
|
450 |
+
'state' => $this->shipping_state,
|
451 |
+
'country' => $this->shipping_country,
|
452 |
+
),
|
453 |
+
'transaction_types' => $this->transaction_types,
|
454 |
+
'risk_params' => array(
|
455 |
+
'ssn' => $this->risk_ssn,
|
456 |
+
'mac_address' => $this->risk_mac_address,
|
457 |
+
'session_id' => $this->risk_session_id,
|
458 |
+
'user_id' => $this->risk_user_id,
|
459 |
+
'user_level' => $this->risk_user_level,
|
460 |
+
'email' => $this->risk_email,
|
461 |
+
'phone' => $this->risk_phone,
|
462 |
+
'remote_ip' => $this->risk_remote_ip,
|
463 |
+
'serial_number' => $this->risk_serial_number,
|
464 |
+
),
|
465 |
+
)
|
466 |
+
);
|
467 |
+
|
468 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
469 |
+
}
|
470 |
+
}
|
lib/Genesis/src/Genesis/API/Request/WPF/Reconcile.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API\Request\WPF;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Web-Payment-Form Reconcile
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Request
|
30 |
+
*/
|
31 |
+
class Reconcile extends \Genesis\API\Request
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Unique id of an existing WPF transaction
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $unique_id;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Set the per-request configuration
|
42 |
+
*
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
protected function initConfiguration()
|
46 |
+
{
|
47 |
+
$this->config = \Genesis\Utils\Common::createArrayObject(
|
48 |
+
array(
|
49 |
+
'protocol' => 'https',
|
50 |
+
'port' => 443,
|
51 |
+
'type' => 'POST',
|
52 |
+
'format' => 'xml',
|
53 |
+
)
|
54 |
+
);
|
55 |
+
|
56 |
+
$this->setApiConfig('url', $this->buildRequestURL('wpf', 'wpf/reconcile', false));
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Set the required fields
|
61 |
+
*
|
62 |
+
* @return void
|
63 |
+
*/
|
64 |
+
protected function setRequiredFields()
|
65 |
+
{
|
66 |
+
$requiredFields = array(
|
67 |
+
'unique_id',
|
68 |
+
);
|
69 |
+
|
70 |
+
$this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Create the request's Tree structure
|
75 |
+
*
|
76 |
+
* @return void
|
77 |
+
*/
|
78 |
+
protected function populateStructure()
|
79 |
+
{
|
80 |
+
$treeStructure = array(
|
81 |
+
'wpf_reconcile' => array(
|
82 |
+
'unique_id' => $this->unique_id,
|
83 |
+
)
|
84 |
+
);
|
85 |
+
|
86 |
+
$this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
|
87 |
+
}
|
88 |
+
}
|
lib/Genesis/src/Genesis/API/Response.php
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\API;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Response - process/format an incoming Genesis response
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage API
|
30 |
+
*/
|
31 |
+
class Response
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Store parsed, response object
|
35 |
+
*
|
36 |
+
* @var \stdClass
|
37 |
+
*/
|
38 |
+
public $responseObj;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Store the response raw data
|
42 |
+
*
|
43 |
+
* @var String
|
44 |
+
*/
|
45 |
+
public $responseRaw;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Genesis Request Context
|
49 |
+
*
|
50 |
+
* @var \Genesis\API\Request
|
51 |
+
*/
|
52 |
+
protected $requestCtx;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Initialize with NetworkContext (if available)
|
56 |
+
*
|
57 |
+
* @param \Genesis\Network|null $networkContext
|
58 |
+
*
|
59 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
60 |
+
*/
|
61 |
+
public function __construct($networkContext = null)
|
62 |
+
{
|
63 |
+
if (!is_null($networkContext) && is_a($networkContext, '\Genesis\Network')) {
|
64 |
+
$this->parseResponse($networkContext->getResponseBody());
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Parse Genesis response to stdClass and
|
70 |
+
* apply transformation to known fields
|
71 |
+
*
|
72 |
+
* @param string $response
|
73 |
+
*
|
74 |
+
* @throws \Genesis\Exceptions\ErrorAPI
|
75 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
76 |
+
* @throws \Genesis\Exceptions\InvalidResponse
|
77 |
+
*/
|
78 |
+
public function parseResponse($response)
|
79 |
+
{
|
80 |
+
$this->responseRaw = $response;
|
81 |
+
|
82 |
+
try {
|
83 |
+
$parser = new \Genesis\Parser('xml');
|
84 |
+
$parser->skipRootNode();
|
85 |
+
$parser->parseDocument($response);
|
86 |
+
|
87 |
+
$this->responseObj = $parser->getObject();
|
88 |
+
} catch (\Exception $e) {
|
89 |
+
throw new \Genesis\Exceptions\InvalidResponse(
|
90 |
+
$e->getMessage(),
|
91 |
+
$e->getCode()
|
92 |
+
);
|
93 |
+
}
|
94 |
+
|
95 |
+
if (isset($this->responseObj->status)) {
|
96 |
+
$state = new Constants\Transaction\States($this->responseObj->status);
|
97 |
+
|
98 |
+
if (!$state->isValid()) {
|
99 |
+
throw new \Genesis\Exceptions\InvalidArgument(
|
100 |
+
'Unknown transaction status',
|
101 |
+
isset($this->responseObj->code) ? $this->responseObj->code : 0
|
102 |
+
);
|
103 |
+
}
|
104 |
+
|
105 |
+
if ($state->isError() && !$this->suppressReconciliationException()) {
|
106 |
+
throw new \Genesis\Exceptions\ErrorAPI(
|
107 |
+
$this->responseObj->message,
|
108 |
+
isset($this->responseObj->code) ? $this->responseObj->code : 0
|
109 |
+
);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
// Apply per-field transformations
|
114 |
+
$this->transform(array($this->responseObj));
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Check whether the request was successful
|
119 |
+
*
|
120 |
+
* Note: You should consult with the documentation
|
121 |
+
* which transaction responses have status available.
|
122 |
+
*
|
123 |
+
* @return bool | null (on missing status)
|
124 |
+
*/
|
125 |
+
public function isSuccessful()
|
126 |
+
{
|
127 |
+
$status = new Constants\Transaction\States(
|
128 |
+
isset($this->responseObj->status) ? $this->responseObj->status : ''
|
129 |
+
);
|
130 |
+
|
131 |
+
if ($status->isValid()) {
|
132 |
+
if ($status->isError()) {
|
133 |
+
$result = false;
|
134 |
+
} else {
|
135 |
+
$result = true;
|
136 |
+
}
|
137 |
+
} else {
|
138 |
+
// return null if status is inapplicable
|
139 |
+
$result = null;
|
140 |
+
}
|
141 |
+
|
142 |
+
return $result;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Check whether the transaction was partially approved
|
147 |
+
*
|
148 |
+
* @see Genesis_API_Documentation for more information
|
149 |
+
*
|
150 |
+
* @return bool | null (if inapplicable)
|
151 |
+
*/
|
152 |
+
public function isPartiallyApproved()
|
153 |
+
{
|
154 |
+
if (isset($this->responseObj->partial_approval)) {
|
155 |
+
return \Genesis\Utils\Common::stringToBoolean($this->responseObj->partial_approval);
|
156 |
+
}
|
157 |
+
|
158 |
+
return null;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Suppress Reconciliation responses as their statuses
|
163 |
+
* reflect their transactions
|
164 |
+
*
|
165 |
+
* @return bool
|
166 |
+
*/
|
167 |
+
public function suppressReconciliationException()
|
168 |
+
{
|
169 |
+
$instances = array(
|
170 |
+
new \Genesis\API\Request\NonFinancial\Reconcile\DateRange(),
|
171 |
+
new \Genesis\API\Request\NonFinancial\Reconcile\Transaction(),
|
172 |
+
new \Genesis\API\Request\WPF\Reconcile()
|
173 |
+
);
|
174 |
+
|
175 |
+
if (isset($this->requestCtx) && isset($this->responseObj->unique_id)) {
|
176 |
+
foreach ($instances as $instance) {
|
177 |
+
if ($this->requestCtx instanceof $instance) {
|
178 |
+
return true;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
return false;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Try to fetch a description of the received Error Code
|
188 |
+
*
|
189 |
+
* @return string | null (if inapplicable)
|
190 |
+
*/
|
191 |
+
public function getErrorDescription()
|
192 |
+
{
|
193 |
+
if (isset($this->responseObj->code) && !empty($this->responseObj->code)) {
|
194 |
+
return Constants\Errors::getErrorDescription($this->responseObj->code);
|
195 |
+
}
|
196 |
+
|
197 |
+
if (isset($this->responseObj->response_code) && !empty($this->responseObj->response_code)) {
|
198 |
+
return Constants\Errors::getIssuerResponseCode($this->responseObj->response_code);
|
199 |
+
}
|
200 |
+
|
201 |
+
return null;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Get the raw Genesis output
|
206 |
+
*
|
207 |
+
* @return String
|
208 |
+
*/
|
209 |
+
public function getResponseRaw()
|
210 |
+
{
|
211 |
+
return $this->responseRaw;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Get the parsed response
|
216 |
+
*
|
217 |
+
* @return \stdClass
|
218 |
+
*/
|
219 |
+
public function getResponseObject()
|
220 |
+
{
|
221 |
+
return $this->responseObj;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Set Genesis Request context
|
226 |
+
*
|
227 |
+
* @param $requestCtx
|
228 |
+
*/
|
229 |
+
public function setRequestCtx($requestCtx)
|
230 |
+
{
|
231 |
+
$this->requestCtx = $requestCtx;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Iterate and transform object
|
236 |
+
*
|
237 |
+
* @param mixed $obj
|
238 |
+
*/
|
239 |
+
public static function transform($obj)
|
240 |
+
{
|
241 |
+
if (is_array($obj) || is_object($obj)) {
|
242 |
+
foreach ($obj as &$object) {
|
243 |
+
if (isset($object->status)) {
|
244 |
+
self::transformObject($object);
|
245 |
+
}
|
246 |
+
|
247 |
+
self::transform($object);
|
248 |
+
}
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Apply filters to an entry object
|
254 |
+
*
|
255 |
+
* @param \stdClass|\ArrayObject $entry
|
256 |
+
*
|
257 |
+
* @return mixed
|
258 |
+
*/
|
259 |
+
public static function transformObject(&$entry)
|
260 |
+
{
|
261 |
+
$filters = array(
|
262 |
+
'transformFilterAmount',
|
263 |
+
'transformFilterTimestamp'
|
264 |
+
);
|
265 |
+
|
266 |
+
foreach ($filters as $filter) {
|
267 |
+
if (method_exists(__CLASS__, $filter)) {
|
268 |
+
$result = call_user_func(array(__CLASS__, $filter), $entry);
|
269 |
+
|
270 |
+
if ($result) {
|
271 |
+
$entry = $result;
|
272 |
+
}
|
273 |
+
}
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Get formatted amount (instead of ISO4217, return in float)
|
279 |
+
*
|
280 |
+
* @param \stdClass|\ArrayObject $transaction
|
281 |
+
*
|
282 |
+
* @return String | null (if amount/currency are unavailable)
|
283 |
+
*/
|
284 |
+
public static function transformFilterAmount($transaction)
|
285 |
+
{
|
286 |
+
// Process a single transaction
|
287 |
+
if (isset($transaction->currency) && isset($transaction->amount)) {
|
288 |
+
$transaction->amount = \Genesis\Utils\Currency::exponentToAmount(
|
289 |
+
$transaction->amount,
|
290 |
+
$transaction->currency
|
291 |
+
);
|
292 |
+
}
|
293 |
+
|
294 |
+
return $transaction;
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Get DateTime object from the timestamp inside the response
|
299 |
+
*
|
300 |
+
* @param \stdClass|\ArrayObject $transaction
|
301 |
+
*
|
302 |
+
* @return \DateTime|null (if invalid timestamp)
|
303 |
+
*/
|
304 |
+
public static function transformFilterTimestamp($transaction)
|
305 |
+
{
|
306 |
+
if (isset($transaction->timestamp)) {
|
307 |
+
try {
|
308 |
+
$transaction->timestamp = new \DateTime($transaction->timestamp);
|
309 |
+
} catch (\Exception $e) {
|
310 |
+
// Just log the attempt
|
311 |
+
error_log($e->getMessage());
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
return $transaction;
|
316 |
+
}
|
317 |
+
}
|
lib/Genesis/src/Genesis/Builder.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Builder handler
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Builders
|
30 |
+
*/
|
31 |
+
class Builder
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Instance of the selected builder wrapper
|
35 |
+
*
|
36 |
+
* @var object
|
37 |
+
*/
|
38 |
+
private $context;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Initialize the required builder, based on the use's
|
42 |
+
* preference (set inside the configuration ini file)
|
43 |
+
*
|
44 |
+
* @param string $interface
|
45 |
+
*/
|
46 |
+
public function __construct($interface = null)
|
47 |
+
{
|
48 |
+
$interface = $interface ?: \Genesis\Config::getInterface('builder');
|
49 |
+
|
50 |
+
switch ($interface) {
|
51 |
+
default:
|
52 |
+
case 'xml':
|
53 |
+
$this->context = new Builders\XML();
|
54 |
+
break;
|
55 |
+
case 'json':
|
56 |
+
$this->context = new Builders\JSON();
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Get the printable Builder Output
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
*/
|
66 |
+
public function getDocument()
|
67 |
+
{
|
68 |
+
return $this->context->getOutput();
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Parse tree-structure into Builder document
|
73 |
+
*
|
74 |
+
* @param array $structure
|
75 |
+
*/
|
76 |
+
public function parseStructure(Array $structure)
|
77 |
+
{
|
78 |
+
$this->context->populateNodes($structure);
|
79 |
+
}
|
80 |
+
}
|
lib/Genesis/src/Genesis/Builders/JSON.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Builders;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class JSON
|
27 |
+
*
|
28 |
+
* Convert Array to a JSON object
|
29 |
+
*
|
30 |
+
* @package Genesis\Builders\Wrapper
|
31 |
+
*/
|
32 |
+
final class JSON implements \Genesis\Interfaces\Builder
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* JSON storage
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
private $output;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Get the generated Builder output
|
43 |
+
*
|
44 |
+
* @return mixed
|
45 |
+
*/
|
46 |
+
public function getOutput()
|
47 |
+
{
|
48 |
+
return $this->output;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Convert multi-dimensional array to JSON object
|
53 |
+
*
|
54 |
+
* @param array $structure
|
55 |
+
*
|
56 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
57 |
+
*
|
58 |
+
* @return void
|
59 |
+
*/
|
60 |
+
public function populateNodes($structure)
|
61 |
+
{
|
62 |
+
try {
|
63 |
+
$this->output = json_encode($structure);
|
64 |
+
} catch (\Exception $e) {
|
65 |
+
throw new \Genesis\Exceptions\InvalidArgument('Invalid data/tree');
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
lib/Genesis/src/Genesis/Builders/XML.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Builders;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* XMLWriter Builder Interface
|
27 |
+
* Note: requires libxml2 support (either built-in or as extension)
|
28 |
+
*
|
29 |
+
* @package Genesis
|
30 |
+
* @subpackage Builders
|
31 |
+
*/
|
32 |
+
final class XML implements \Genesis\Interfaces\Builder
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Store the XMLWriter instance
|
36 |
+
*
|
37 |
+
* @var \XMLWriter
|
38 |
+
*/
|
39 |
+
public $context;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Set and instantiate new UTF-8 XML document
|
43 |
+
*/
|
44 |
+
public function __construct()
|
45 |
+
{
|
46 |
+
$this->context = new \XMLWriter();
|
47 |
+
|
48 |
+
$this->context->openMemory();
|
49 |
+
$this->context->startDocument('1.0', 'UTF-8');
|
50 |
+
$this->context->setIndent(true);
|
51 |
+
$this->context->setIndentString("\x20\x20");
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Flush and destroy XMLWriter instance upon destruction
|
56 |
+
*/
|
57 |
+
public function __destruct()
|
58 |
+
{
|
59 |
+
if (isset($this->context)) {
|
60 |
+
$this->context->flush();
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Insert tree-structured array as nodes in XMLWriter
|
66 |
+
* and end the current Document.
|
67 |
+
*
|
68 |
+
* @param $data Array - tree-structured array
|
69 |
+
*
|
70 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
71 |
+
*
|
72 |
+
* @return void
|
73 |
+
*/
|
74 |
+
public function populateNodes($data)
|
75 |
+
{
|
76 |
+
if (!\Genesis\Utils\Common::isValidArray($data)) {
|
77 |
+
throw new \Genesis\Exceptions\InvalidArgument('Invalid data structure');
|
78 |
+
}
|
79 |
+
|
80 |
+
// Ensure that the Array position is 0
|
81 |
+
reset($data);
|
82 |
+
|
83 |
+
$this->iterateArray(key($data), reset($data));
|
84 |
+
|
85 |
+
// Finish the document
|
86 |
+
$this->context->endDocument();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get Builder output
|
91 |
+
*
|
92 |
+
* @return string XML Document
|
93 |
+
*/
|
94 |
+
public function getOutput()
|
95 |
+
{
|
96 |
+
return $this->context->outputMemory(false);
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Recursive iteration over array
|
101 |
+
*
|
102 |
+
* @param string $name name of the current leave
|
103 |
+
* @param array $data value of the current leave
|
104 |
+
*
|
105 |
+
* @return void
|
106 |
+
*/
|
107 |
+
public function iterateArray($name, $data)
|
108 |
+
{
|
109 |
+
if (\Genesis\Utils\Common::isValidXMLName($name)) {
|
110 |
+
$this->context->startElement($name);
|
111 |
+
}
|
112 |
+
|
113 |
+
foreach ($data as $key => $value) {
|
114 |
+
if (is_null($value)) {
|
115 |
+
continue;
|
116 |
+
}
|
117 |
+
|
118 |
+
// Note: XMLWriter discards Attribute writes if they are written
|
119 |
+
// after an Element, so make sure the attributes are at the top
|
120 |
+
if ($key === '@attributes') {
|
121 |
+
$this->writeAttribute($value);
|
122 |
+
continue;
|
123 |
+
}
|
124 |
+
|
125 |
+
if ($key === '@cdata') {
|
126 |
+
$this->writeCData($value);
|
127 |
+
continue;
|
128 |
+
}
|
129 |
+
|
130 |
+
if ($key === '@value') {
|
131 |
+
$this->writeText($value);
|
132 |
+
continue;
|
133 |
+
}
|
134 |
+
|
135 |
+
$this->writeElement($key, $value);
|
136 |
+
}
|
137 |
+
|
138 |
+
if (\Genesis\Utils\Common::isValidXMLName($name)) {
|
139 |
+
$this->context->endElement();
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Write Element's Attribute
|
145 |
+
*
|
146 |
+
* @param $value
|
147 |
+
*/
|
148 |
+
public function writeAttribute($value)
|
149 |
+
{
|
150 |
+
if (is_array($value)) {
|
151 |
+
foreach ($value as $attrName => $attrValue) {
|
152 |
+
$this->context->writeAttribute($attrName, $attrValue);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Write Element's CData
|
159 |
+
*
|
160 |
+
* @param $value
|
161 |
+
*/
|
162 |
+
public function writeCData($value)
|
163 |
+
{
|
164 |
+
if (is_array($value)) {
|
165 |
+
foreach ($value as $attrValue) {
|
166 |
+
$this->context->writeCData($attrValue);
|
167 |
+
}
|
168 |
+
} else {
|
169 |
+
$this->context->writeCData($value);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Write Element's Text
|
175 |
+
*
|
176 |
+
* @param $value
|
177 |
+
*/
|
178 |
+
public function writeText($value)
|
179 |
+
{
|
180 |
+
if (is_array($value)) {
|
181 |
+
foreach ($value as $attrValue) {
|
182 |
+
$this->context->text($attrValue);
|
183 |
+
}
|
184 |
+
} else {
|
185 |
+
$this->context->text($value);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Write XML Element
|
191 |
+
*
|
192 |
+
* @param $key
|
193 |
+
* @param $value
|
194 |
+
*/
|
195 |
+
public function writeElement($key, $value)
|
196 |
+
{
|
197 |
+
if (is_array($value)) {
|
198 |
+
$this->iterateArray($key, $value);
|
199 |
+
} else {
|
200 |
+
$value = \Genesis\Utils\Common::booleanToString($value);
|
201 |
+
|
202 |
+
$this->context->writeElement($key, $value);
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
lib/Genesis/src/Genesis/Certificates/ca-bundle.pem
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
##
|
2 |
+
## Genesis Certificate Bundle
|
3 |
+
##
|
4 |
+
## Root CA bundle
|
5 |
+
##
|
6 |
+
|
7 |
+
VeriSign Universal Root Certification Authority
|
8 |
+
================================================================
|
9 |
+
-----BEGIN CERTIFICATE-----
|
10 |
+
MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCB
|
11 |
+
vTELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
|
12 |
+
ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJp
|
13 |
+
U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MTgwNgYDVQQDEy9W
|
14 |
+
ZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe
|
15 |
+
Fw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJVUzEX
|
16 |
+
MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0
|
17 |
+
IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9y
|
18 |
+
IGF1dGhvcml6ZWQgdXNlIG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNh
|
19 |
+
bCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
|
20 |
+
AAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj1mCOkdeQmIN65lgZOIzF
|
21 |
+
9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGPMiJhgsWH
|
22 |
+
H26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+H
|
23 |
+
LL729fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN
|
24 |
+
/BMReYTtXlT2NJ8IAfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPT
|
25 |
+
rJ9VAMf2CGqUuV/c4DPxhGD5WycRtPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1Ud
|
26 |
+
EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0GCCsGAQUFBwEMBGEwX6FdoFsw
|
27 |
+
WTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2Oa8PPgGrUSBgs
|
28 |
+
exkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
|
29 |
+
DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4
|
30 |
+
sAPmLGd75JR3Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+
|
31 |
+
seQxIcaBlVZaDrHC1LGmWazxY8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz
|
32 |
+
4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTxP/jgdFcrGJ2BtMQo2pSXpXDrrB2+
|
33 |
+
BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+PwGZsY6rp2aQW9IHR
|
34 |
+
lRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4mJO3
|
35 |
+
7M2CYfE45k+XmCpajQ==
|
36 |
+
-----END CERTIFICATE-----
|
37 |
+
|
38 |
+
AddTrust External Root
|
39 |
+
================================================================
|
40 |
+
-----BEGIN CERTIFICATE-----
|
41 |
+
MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
|
42 |
+
MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs
|
43 |
+
IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
|
44 |
+
MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux
|
45 |
+
FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h
|
46 |
+
bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v
|
47 |
+
dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt
|
48 |
+
H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9
|
49 |
+
uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX
|
50 |
+
mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX
|
51 |
+
a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN
|
52 |
+
E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0
|
53 |
+
WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD
|
54 |
+
VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0
|
55 |
+
Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU
|
56 |
+
cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx
|
57 |
+
IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN
|
58 |
+
AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
|
59 |
+
YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
|
60 |
+
6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
|
61 |
+
Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
|
62 |
+
c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
|
63 |
+
mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
|
64 |
+
-----END CERTIFICATE-----
|
65 |
+
|
66 |
+
VeriSign Class 3 Public Primary Certification Authority - G5
|
67 |
+
================================================================
|
68 |
+
-----BEGIN CERTIFICATE-----
|
69 |
+
MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB
|
70 |
+
yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
|
71 |
+
ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
|
72 |
+
U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW
|
73 |
+
ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0
|
74 |
+
aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL
|
75 |
+
MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW
|
76 |
+
ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln
|
77 |
+
biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp
|
78 |
+
U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y
|
79 |
+
aXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1
|
80 |
+
nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbex
|
81 |
+
t0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIz
|
82 |
+
SdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG
|
83 |
+
BO+QueQA5N06tRn/Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+
|
84 |
+
rCpSx4/VBEnkjWNHiDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/
|
85 |
+
NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E
|
86 |
+
BAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH
|
87 |
+
BgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
|
88 |
+
aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKv
|
89 |
+
MzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE
|
90 |
+
p6B4Eq1iDkVwZMXnl2YtmAl+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y
|
91 |
+
5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK
|
92 |
+
WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ
|
93 |
+
4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N
|
94 |
+
hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
|
95 |
+
-----END CERTIFICATE-----
|
96 |
+
|
97 |
+
Symantec Class 3 EV SSL CA - G3
|
98 |
+
================================================================
|
99 |
+
-----BEGIN CERTIFICATE-----
|
100 |
+
MIIFKzCCBBOgAwIBAgIQfuFKb2/v8tN/P61lTTratDANBgkqhkiG9w0BAQsFADCB
|
101 |
+
yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
|
102 |
+
ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
|
103 |
+
U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW
|
104 |
+
ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0
|
105 |
+
aG9yaXR5IC0gRzUwHhcNMTMxMDMxMDAwMDAwWhcNMjMxMDMwMjM1OTU5WjB3MQsw
|
106 |
+
CQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAdBgNV
|
107 |
+
BAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxKDAmBgNVBAMTH1N5bWFudGVjIENs
|
108 |
+
YXNzIDMgRVYgU1NMIENBIC0gRzMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
|
109 |
+
AoIBAQDYoWV0I+grZOIy1zM3PY71NBZI3U9/hxz4RCMTjvsR2ERaGHGOYBYmkpv9
|
110 |
+
FwvhcXBC/r/6HMCqo6e1cej/GIP23xAKE2LIPZyn3i4/DNkd5y77Ks7Imn+Hv9hM
|
111 |
+
BBUyydHMlXGgTihPhNk1++OGb5RT5nKKY2cuvmn2926OnGAE6yn6xEdC0niY4+wL
|
112 |
+
pZLct5q9gGQrOHw4CVtm9i2VeoayNC6FnpAOX7ddpFFyRnATv2fytqdNFB5suVPu
|
113 |
+
IxpOjUhVQ0GxiXVqQCjFfd3SbtICGS97JJRL6/EaqZvjI5rq+jOrCiy39GAI3Z8c
|
114 |
+
zd0tAWaAr7MvKR0juIrhoXAHDDQPAgMBAAGjggFdMIIBWTAvBggrBgEFBQcBAQQj
|
115 |
+
MCEwHwYIKwYBBQUHMAGGE2h0dHA6Ly9zMi5zeW1jYi5jb20wEgYDVR0TAQH/BAgw
|
116 |
+
BgEB/wIBADBlBgNVHSAEXjBcMFoGBFUdIAAwUjAmBggrBgEFBQcCARYaaHR0cDov
|
117 |
+
L3d3dy5zeW1hdXRoLmNvbS9jcHMwKAYIKwYBBQUHAgIwHBoaaHR0cDovL3d3dy5z
|
118 |
+
eW1hdXRoLmNvbS9ycGEwMAYDVR0fBCkwJzAloCOgIYYfaHR0cDovL3MxLnN5bWNi
|
119 |
+
LmNvbS9wY2EzLWc1LmNybDAOBgNVHQ8BAf8EBAMCAQYwKQYDVR0RBCIwIKQeMBwx
|
120 |
+
GjAYBgNVBAMTEVN5bWFudGVjUEtJLTEtNTMzMB0GA1UdDgQWBBQBWavn3ToLWaZk
|
121 |
+
Y9bPIAdX1ZHnajAfBgNVHSMEGDAWgBR/02Wnwt3su/AwCfNDOfoCrzMxMzANBgkq
|
122 |
+
hkiG9w0BAQsFAAOCAQEAQgFVe9AWGl1Y6LubqE3X89frE5SG1n8hC0e8V5uSXU8F
|
123 |
+
nzikEHzPg74GQ0aNCLxq1xCm+quvL2GoY/Jl339MiBKIT7Np2f8nwAqXkY9W+4nE
|
124 |
+
qLuSLRtzsMarNvSWbCAI7woeZiRFT2cAQMgHVHQzO6atuyOfZu2iRHA0+w7qAf3P
|
125 |
+
eHTfp61Vt19N9tY/4IbOJMdCqRMURDVLtt/JYKwMf9mTIUvunORJApjTYHtcvNUw
|
126 |
+
LwfORELEC5n+5p/8sHiGUW3RLJ3GlvuFgrsEL/digO9i2n/2DqyQuFa9eT/ygG6j
|
127 |
+
2bkPXToHHZGThkspTOHcteHgM52zyzaRS/6htO7w+Q==
|
128 |
+
-----END CERTIFICATE-----
|
lib/Genesis/src/Genesis/Config.php
ADDED
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class Config
|
27 |
+
*
|
28 |
+
* Store/Retrieve configuration key/values across the Genesis library
|
29 |
+
*
|
30 |
+
* @package Genesis
|
31 |
+
*
|
32 |
+
* @method static \Genesis\Config getUsername() Get the Username, set in configuration
|
33 |
+
* @method static \Genesis\Config getPassword() Get the Password, set in the configuration
|
34 |
+
* @method static \Genesis\Config getToken() Get the Terminal Token, set in configuration
|
35 |
+
*
|
36 |
+
* @method static \Genesis\Config setUsername() Set the Username
|
37 |
+
* @method static \Genesis\Config setPassword() Set the Password
|
38 |
+
* @method static \Genesis\Config setToken() Set the Terminal
|
39 |
+
*/
|
40 |
+
final class Config
|
41 |
+
{
|
42 |
+
/**
|
43 |
+
* Library Version
|
44 |
+
*/
|
45 |
+
const VERSION = '1.4.0';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Core configuration settings
|
49 |
+
*
|
50 |
+
* @var Array
|
51 |
+
*/
|
52 |
+
public static $vault
|
53 |
+
= array(
|
54 |
+
'endpoint' => null,
|
55 |
+
'username' => null,
|
56 |
+
'password' => null,
|
57 |
+
'token' => null,
|
58 |
+
'environment' => \Genesis\API\Constants\Environments::STAGING,
|
59 |
+
);
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Interface settings
|
63 |
+
*
|
64 |
+
* @var array
|
65 |
+
*/
|
66 |
+
public static $interfaces
|
67 |
+
= array(
|
68 |
+
'builder' => 'xml',
|
69 |
+
'network' => 'curl',
|
70 |
+
);
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Some requests are targeting different sub-domains.
|
74 |
+
* This should map all available requests/sub-domains
|
75 |
+
* for each configuration type (develop,sandbox,production)
|
76 |
+
*
|
77 |
+
* @var Array
|
78 |
+
*/
|
79 |
+
public static $domains
|
80 |
+
= array(
|
81 |
+
'gateway' => array(
|
82 |
+
'production' => 'gate.',
|
83 |
+
'sandbox' => 'staging.gate.'
|
84 |
+
),
|
85 |
+
'wpf' => array(
|
86 |
+
'production' => 'wpf.',
|
87 |
+
'sandbox' => 'staging.wpf.',
|
88 |
+
),
|
89 |
+
);
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Dynamic Getters/Setter for getting/setting configuration parameters
|
93 |
+
*
|
94 |
+
* @param $method
|
95 |
+
* @param $args
|
96 |
+
*
|
97 |
+
* @return mixed
|
98 |
+
*/
|
99 |
+
public static function __callStatic($method, $args)
|
100 |
+
{
|
101 |
+
$keySetting = strtolower(substr($method, 3));
|
102 |
+
|
103 |
+
switch (substr($method, 0, 3)) {
|
104 |
+
case 'get':
|
105 |
+
if (isset(self::$vault[$keySetting])) {
|
106 |
+
return self::$vault[$keySetting];
|
107 |
+
}
|
108 |
+
break;
|
109 |
+
case 'set':
|
110 |
+
self::$vault[$keySetting] = trim(reset($args));
|
111 |
+
break;
|
112 |
+
}
|
113 |
+
|
114 |
+
return null;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Get the CA PEM
|
119 |
+
*
|
120 |
+
* @return string - Path to the Genesis CA Bundle; false otherwise
|
121 |
+
*
|
122 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
123 |
+
*/
|
124 |
+
public static function getCertificateBundle()
|
125 |
+
{
|
126 |
+
$bundle = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Certificates' . DIRECTORY_SEPARATOR . 'ca-bundle.pem';
|
127 |
+
|
128 |
+
if (!file_exists($bundle)) {
|
129 |
+
throw new \Genesis\Exceptions\InvalidArgument(
|
130 |
+
'CA Bundle file is missing or inaccessible'
|
131 |
+
);
|
132 |
+
}
|
133 |
+
|
134 |
+
return $bundle;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Get configuration for an interface
|
139 |
+
*
|
140 |
+
* @param $type - type of the interface
|
141 |
+
*
|
142 |
+
* @return mixed - interface name or false if non-existing
|
143 |
+
*/
|
144 |
+
public static function getInterface($type)
|
145 |
+
{
|
146 |
+
if (array_key_exists($type, self::$interfaces)) {
|
147 |
+
return self::$interfaces[$type];
|
148 |
+
}
|
149 |
+
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Set an interface
|
155 |
+
*
|
156 |
+
* @param string $interface Name of interface (e.g. builder, network)
|
157 |
+
* @param string $value Value for the new interface (e.g. xml, curl)
|
158 |
+
*
|
159 |
+
* @return bool
|
160 |
+
*/
|
161 |
+
public static function setInterface($interface, $value)
|
162 |
+
{
|
163 |
+
if (array_key_exists($interface, self::$interfaces)) {
|
164 |
+
self::$interfaces[$interface] = $value;
|
165 |
+
|
166 |
+
return true;
|
167 |
+
}
|
168 |
+
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Get the current Genesis Environment
|
174 |
+
*
|
175 |
+
* @return mixed
|
176 |
+
*/
|
177 |
+
public static function getEnvironment()
|
178 |
+
{
|
179 |
+
return self::$vault['environment'];
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Set Environment
|
184 |
+
*
|
185 |
+
* @param string $environmentArg
|
186 |
+
* @return string
|
187 |
+
*
|
188 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
189 |
+
*/
|
190 |
+
public static function setEnvironment($environmentArg)
|
191 |
+
{
|
192 |
+
$environmentArg = strtolower(trim($environmentArg));
|
193 |
+
|
194 |
+
$aliases = array(
|
195 |
+
\Genesis\API\Constants\Environments::STAGING => array(
|
196 |
+
'test',
|
197 |
+
'testing',
|
198 |
+
'staging',
|
199 |
+
\Genesis\API\Constants\Environments::STAGING
|
200 |
+
),
|
201 |
+
\Genesis\API\Constants\Environments::PRODUCTION => array(
|
202 |
+
'live',
|
203 |
+
'prod',
|
204 |
+
'production',
|
205 |
+
\Genesis\API\Constants\Environments::PRODUCTION
|
206 |
+
),
|
207 |
+
);
|
208 |
+
|
209 |
+
foreach ($aliases as $environment => $endpointAlias) {
|
210 |
+
foreach ($endpointAlias as $alias) {
|
211 |
+
if (stripos($environmentArg, $alias) !== false) {
|
212 |
+
return self::$vault['environment'] = $environment;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
throw new \Genesis\Exceptions\InvalidArgument(
|
218 |
+
'Invalid Environment'
|
219 |
+
);
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Get the current Genesis Endpoint
|
224 |
+
*
|
225 |
+
* @return mixed
|
226 |
+
*/
|
227 |
+
public static function getEndpoint()
|
228 |
+
{
|
229 |
+
return self::$vault['endpoint'];
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Set Genesis Endpoint
|
234 |
+
*
|
235 |
+
* @param string $endpointArg
|
236 |
+
* @return string
|
237 |
+
*
|
238 |
+
* @throws \Genesis\Exceptions\InvalidArgument
|
239 |
+
*/
|
240 |
+
public static function setEndpoint($endpointArg)
|
241 |
+
{
|
242 |
+
$endpointArg = strtolower(trim($endpointArg));
|
243 |
+
|
244 |
+
$aliases = array(
|
245 |
+
\Genesis\API\Constants\Endpoints::EMERCHANTPAY => array(
|
246 |
+
'emp',
|
247 |
+
'emerchantpay',
|
248 |
+
\Genesis\API\Constants\Endpoints::EMERCHANTPAY,
|
249 |
+
),
|
250 |
+
\Genesis\API\Constants\Endpoints::ECOMPROCESSING => array(
|
251 |
+
'ecp',
|
252 |
+
'ecomprocessing',
|
253 |
+
'e-comprocessing',
|
254 |
+
\Genesis\API\Constants\Endpoints::ECOMPROCESSING
|
255 |
+
),
|
256 |
+
);
|
257 |
+
|
258 |
+
foreach ($aliases as $endpoint => $endpointAlias) {
|
259 |
+
foreach ($endpointAlias as $alias) {
|
260 |
+
if (stripos($endpointArg, $alias) !== false) {
|
261 |
+
return self::$vault['endpoint'] = $endpoint;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
throw new \Genesis\Exceptions\InvalidArgument(
|
267 |
+
'Invalid Endpoint'
|
268 |
+
);
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Get a sub-domain host based on the environment
|
273 |
+
*
|
274 |
+
* @see self::$domains
|
275 |
+
*
|
276 |
+
* @param $sub
|
277 |
+
* @return string
|
278 |
+
*
|
279 |
+
* @throws Exceptions\EnvironmentNotSet
|
280 |
+
*/
|
281 |
+
public static function getSubDomain($sub)
|
282 |
+
{
|
283 |
+
if (isset(self::$domains[$sub])) {
|
284 |
+
return self::$domains[$sub][self::getEnvironment()];
|
285 |
+
}
|
286 |
+
|
287 |
+
return null;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Network timeout.
|
292 |
+
*
|
293 |
+
* @note Hard-code for now
|
294 |
+
*
|
295 |
+
* @return int
|
296 |
+
*/
|
297 |
+
public static function getNetworkTimeout()
|
298 |
+
{
|
299 |
+
return 60;
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Get the version of this Library API
|
304 |
+
*
|
305 |
+
* @return string
|
306 |
+
*/
|
307 |
+
public static function getVersion()
|
308 |
+
{
|
309 |
+
return self::VERSION;
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Load settings from an ini File
|
314 |
+
*
|
315 |
+
* @param string $iniFile Path to an ini file containing the settings
|
316 |
+
*
|
317 |
+
* @throws \Genesis\Exceptions\InvalidArgument()
|
318 |
+
*/
|
319 |
+
public static function loadSettings($iniFile)
|
320 |
+
{
|
321 |
+
if (!file_exists($iniFile)) {
|
322 |
+
throw new \Genesis\Exceptions\InvalidArgument(
|
323 |
+
'The provided configuration file is invalid or inaccessible!'
|
324 |
+
);
|
325 |
+
}
|
326 |
+
|
327 |
+
$settings = parse_ini_file($iniFile, true);
|
328 |
+
|
329 |
+
foreach ($settings['Genesis'] as $option => $value) {
|
330 |
+
if (array_key_exists($option, self::$vault)) {
|
331 |
+
self::$vault[$option] = $value;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
foreach ($settings['Interfaces'] as $option => $value) {
|
336 |
+
if (array_key_exists($option, self::$interfaces)) {
|
337 |
+
self::$interfaces[$option] = $value;
|
338 |
+
}
|
339 |
+
}
|
340 |
+
}
|
341 |
+
}
|
lib/Genesis/src/Genesis/Exceptions/EnvironmentNotSet.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Exceptions;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class EnvironmentNotSet
|
27 |
+
*
|
28 |
+
* @package Genesis\Exceptions
|
29 |
+
*/
|
30 |
+
class EnvironmentNotSet extends \Exception
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Construct
|
34 |
+
*
|
35 |
+
* @param string $message
|
36 |
+
* @param int $code
|
37 |
+
* @param null $previous
|
38 |
+
*/
|
39 |
+
public function __construct($message = '', $code = 0, $previous = null)
|
40 |
+
{
|
41 |
+
if (empty($message)) {
|
42 |
+
$message = "No working enviorment has been set, please choose between test/live environment!";
|
43 |
+
}
|
44 |
+
|
45 |
+
parent::__construct($message, $code, $previous);
|
46 |
+
}
|
47 |
+
}
|
lib/Genesis/src/Genesis/Exceptions/ErrorAPI.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Exceptions;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class ErrorAPI
|
27 |
+
*
|
28 |
+
* Used to indicate an unsuccessful API request
|
29 |
+
*
|
30 |
+
* For example - invalid card, invalid data, insufficient funds etc.
|
31 |
+
*
|
32 |
+
* @package Genesis\Exceptions
|
33 |
+
*/
|
34 |
+
class ErrorAPI extends \Exception
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Construct
|
38 |
+
*
|
39 |
+
* @param string $message
|
40 |
+
* @param int $code
|
41 |
+
* @param null $previous
|
42 |
+
*/
|
43 |
+
public function __construct($message = '', $code = 0, $previous = null)
|
44 |
+
{
|
45 |
+
$error = empty($message) ? 'Unknown error' : $message;
|
46 |
+
$description = \Genesis\API\Constants\Errors::getErrorDescription($code);
|
47 |
+
|
48 |
+
$message = 'Message: ' . $error . PHP_EOL .
|
49 |
+
'Details: ' . $description;
|
50 |
+
|
51 |
+
parent::__construct($message, $code, $previous);
|
52 |
+
}
|
53 |
+
}
|
lib/Genesis/src/Genesis/Exceptions/ErrorNetwork.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Exceptions;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class ErrorNetwork
|
27 |
+
*
|
28 |
+
* Used to indicate a problem with network transport
|
29 |
+
*
|
30 |
+
* e.g. Timeouts, SSL verification issues, DNS resolve etc.
|
31 |
+
*
|
32 |
+
* @package Genesis\Exceptions
|
33 |
+
*/
|
34 |
+
class ErrorNetwork extends \Exception
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Construct
|
38 |
+
*
|
39 |
+
* @param string $message
|
40 |
+
* @param int $code
|
41 |
+
* @param null $previous
|
42 |
+
*/
|
43 |
+
public function __construct($message = '', $code = 0, $previous = null)
|
44 |
+
{
|
45 |
+
if (empty($message)) {
|
46 |
+
$message = 'Unknown error during network request!';
|
47 |
+
}
|
48 |
+
|
49 |
+
parent::__construct($message, $code, $previous);
|
50 |
+
}
|
51 |
+
}
|
lib/Genesis/src/Genesis/Exceptions/ErrorParameter.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Exceptions;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class ErrorParameter
|
27 |
+
*
|
28 |
+
* Used to indicate a problem with transaction's parameters
|
29 |
+
*
|
30 |
+
* @package Genesis\Exceptions
|
31 |
+
*/
|
32 |
+
class ErrorParameter extends \Exception
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Construct
|
36 |
+
*
|
37 |
+
* @param string $message
|
38 |
+
* @param bool $code
|
39 |
+
* @param null $previous
|
40 |
+
*/
|
41 |
+
public function __construct($message = '', $code = false, $previous = null)
|
42 |
+
{
|
43 |
+
$message = 'Please verify the following transaction parameters:' . PHP_EOL .
|
44 |
+
$message;
|
45 |
+
|
46 |
+
parent::__construct($message, $code, $previous);
|
47 |
+
}
|
48 |
+
}
|
lib/Genesis/src/Genesis/Exceptions/InvalidArgument.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Exceptions;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class InvalidArgument
|
27 |
+
*
|
28 |
+
* @package Genesis\Exceptions
|
29 |
+
*/
|
30 |
+
class InvalidArgument extends \Exception
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Construct
|
34 |
+
*
|
35 |
+
* @param string $message
|
36 |
+
* @param int $code
|
37 |
+
* @param null $previous
|
38 |
+
*/
|
39 |
+
public function __construct($message = '', $code = 0, $previous = null)
|
40 |
+
{
|
41 |
+
if (empty($message)) {
|
42 |
+
$message = "The supplied argument is invalid for this method!";
|
43 |
+
}
|
44 |
+
|
45 |
+
parent::__construct($message, $code, $previous);
|
46 |
+
}
|
47 |
+
}
|
lib/Genesis/src/Genesis/Exceptions/InvalidMethod.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Exceptions;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class InvalidMethod
|
27 |
+
*
|
28 |
+
* @package Genesis\Exceptions
|
29 |
+
*/
|
30 |
+
class InvalidMethod extends \Exception
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Construct
|
34 |
+
*
|
35 |
+
* @param string $message
|
36 |
+
* @param int $code
|
37 |
+
* @param null $previous
|
38 |
+
*/
|
39 |
+
public function __construct($message = '', $code = 0, $previous = null)
|
40 |
+
{
|
41 |
+
if (empty($message)) {
|
42 |
+
$message =
|
43 |
+
'You\'re trying to call a non-existent method!' . PHP_EOL .
|
44 |
+
'For proper usage, please refer to the documentation!';
|
45 |
+
}
|
46 |
+
|
47 |
+
parent::__construct($message, $code, $previous);
|
48 |
+
}
|
49 |
+
}
|
lib/Genesis/src/Genesis/Exceptions/InvalidResponse.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Exceptions;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class InvalidResponse
|
27 |
+
*
|
28 |
+
* Used to indicate an invalid document
|
29 |
+
* in the API response.
|
30 |
+
*
|
31 |
+
* @package Genesis\Exceptions
|
32 |
+
*/
|
33 |
+
class InvalidResponse extends \Exception
|
34 |
+
{
|
35 |
+
/**
|
36 |
+
* Construct
|
37 |
+
*
|
38 |
+
* @param string $message
|
39 |
+
* @param int $code
|
40 |
+
* @param null $previous
|
41 |
+
*/
|
42 |
+
public function __construct($message = '', $code = 0, $previous = null)
|
43 |
+
{
|
44 |
+
if (empty($message)) {
|
45 |
+
$message = 'Invalid/Unexpected format!';
|
46 |
+
}
|
47 |
+
|
48 |
+
parent::__construct($message, $code, $previous);
|
49 |
+
}
|
50 |
+
}
|
lib/Genesis/src/Genesis/Genesis.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Base class of Genesis
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
*/
|
30 |
+
class Genesis
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Store the Network Request Instance
|
34 |
+
*
|
35 |
+
* @var mixed
|
36 |
+
*/
|
37 |
+
protected $requestCtx;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Store the Network Response Instance
|
41 |
+
*
|
42 |
+
* @var \Genesis\API\Response
|
43 |
+
*/
|
44 |
+
protected $responseCtx;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Store the Network Request Instance
|
48 |
+
*
|
49 |
+
* @var \Genesis\Network
|
50 |
+
*/
|
51 |
+
protected $networkCtx;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Initialize and instantiate the desired request
|
55 |
+
*
|
56 |
+
* @param $request - API Request name, please consult the README for a list of all requests
|
57 |
+
*
|
58 |
+
* @throws Exceptions\InvalidMethod()
|
59 |
+
*/
|
60 |
+
public function __construct($request)
|
61 |
+
{
|
62 |
+
// Verify system requirements
|
63 |
+
\Genesis\Utils\Requirements::verify();
|
64 |
+
|
65 |
+
// Initialize the request
|
66 |
+
$request = sprintf('\Genesis\API\Request\%s', $request);
|
67 |
+
|
68 |
+
if (class_exists($request)) {
|
69 |
+
$this->requestCtx = new $request;
|
70 |
+
} else {
|
71 |
+
throw new \Genesis\Exceptions\InvalidMethod(
|
72 |
+
'The selected transaction type is invalid!'
|
73 |
+
);
|
74 |
+
}
|
75 |
+
|
76 |
+
// Initialize the Network
|
77 |
+
$this->networkCtx = new \Genesis\Network();
|
78 |
+
|
79 |
+
// Initialize Response Object
|
80 |
+
$this->responseCtx = new \Genesis\API\Response();
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Get request instance
|
85 |
+
*
|
86 |
+
* @return mixed
|
87 |
+
*/
|
88 |
+
public function request()
|
89 |
+
{
|
90 |
+
return $this->requestCtx;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Get Response instance
|
95 |
+
*
|
96 |
+
* @return \Genesis\API\Response
|
97 |
+
*/
|
98 |
+
public function response()
|
99 |
+
{
|
100 |
+
return $this->responseCtx;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Send the request
|
105 |
+
*
|
106 |
+
* @throws Exceptions\ErrorAPI
|
107 |
+
* @throws Exceptions\InvalidArgument
|
108 |
+
* @throws Exceptions\InvalidResponse
|
109 |
+
*/
|
110 |
+
public function execute()
|
111 |
+
{
|
112 |
+
// Build the previously set data
|
113 |
+
$this->networkCtx->setApiCtxData(
|
114 |
+
$this->requestCtx
|
115 |
+
);
|
116 |
+
|
117 |
+
// Send the request
|
118 |
+
$this->networkCtx->sendRequest();
|
119 |
+
|
120 |
+
// Set the request context
|
121 |
+
$this->responseCtx->setRequestCtx(
|
122 |
+
$this->requestCtx
|
123 |
+
);
|
124 |
+
|
125 |
+
// Parse the response
|
126 |
+
$this->responseCtx->parseResponse(
|
127 |
+
$this->networkCtx->getResponseBody()
|
128 |
+
);
|
129 |
+
}
|
130 |
+
}
|
lib/Genesis/src/Genesis/Interfaces/Builder.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Interfaces;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* An interface for every builder abstraction (XMLWriter, DOMDocument, JSON etc.).
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Builders
|
30 |
+
*/
|
31 |
+
interface Builder
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Get the generated Builder output
|
35 |
+
*
|
36 |
+
* @return mixed
|
37 |
+
*/
|
38 |
+
public function getOutput();
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Tree-structured array representing the data structure
|
42 |
+
*
|
43 |
+
* @param array $structure
|
44 |
+
*
|
45 |
+
* @return mixed
|
46 |
+
*/
|
47 |
+
public function populateNodes($structure);
|
48 |
+
}
|
lib/Genesis/src/Genesis/Interfaces/Network.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Interfaces;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* An interface for every network abstraction (cURL, Stream etc.).
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Network
|
30 |
+
*/
|
31 |
+
interface Network
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Get HTTP Status code
|
35 |
+
*
|
36 |
+
* @return mixed
|
37 |
+
*/
|
38 |
+
public function getStatus();
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get the full response (headers/body)
|
42 |
+
*
|
43 |
+
* @return mixed
|
44 |
+
*/
|
45 |
+
public function getResponse();
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Get response headers
|
49 |
+
*
|
50 |
+
* @return mixed
|
51 |
+
*/
|
52 |
+
public function getResponseHeaders();
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get response body
|
56 |
+
*
|
57 |
+
* @return mixed
|
58 |
+
*/
|
59 |
+
public function getResponseBody();
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Set the request parameters
|
63 |
+
*
|
64 |
+
* @param $requestData
|
65 |
+
*
|
66 |
+
* @return mixed
|
67 |
+
*/
|
68 |
+
public function prepareRequestBody($requestData);
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Execute pre-set request
|
72 |
+
*
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function execute();
|
76 |
+
}
|
lib/Genesis/src/Genesis/Interfaces/Parser.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Interfaces;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* An interface for every parser abstraction (XML, JSON etc.)
|
27 |
+
*
|
28 |
+
* @package Genesis\Interfaces
|
29 |
+
*/
|
30 |
+
interface Parser
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Get the parsed object
|
34 |
+
*
|
35 |
+
* @return mixed
|
36 |
+
*/
|
37 |
+
public function getObject();
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Parse the provided document
|
41 |
+
*
|
42 |
+
* @param mixed $document
|
43 |
+
*
|
44 |
+
* @return mixed
|
45 |
+
*/
|
46 |
+
public function parseDocument($document);
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Set a flag, indicating, if the root
|
50 |
+
* node of a document should be skipped
|
51 |
+
* during parsing
|
52 |
+
*
|
53 |
+
* @return bool
|
54 |
+
*/
|
55 |
+
public function skipRootNode();
|
56 |
+
}
|
lib/Genesis/src/Genesis/Network.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Network Requests Handler
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Network
|
30 |
+
*/
|
31 |
+
class Network
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Instance of the selected network wrapper
|
35 |
+
*
|
36 |
+
* @var mixed
|
37 |
+
*/
|
38 |
+
private $context;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Initialize the Network instance with API Request instance
|
42 |
+
*
|
43 |
+
* @param string $interface
|
44 |
+
*/
|
45 |
+
public function __construct($interface = null)
|
46 |
+
{
|
47 |
+
$interface = $interface ?: \Genesis\Config::getInterface('network');
|
48 |
+
|
49 |
+
switch ($interface) {
|
50 |
+
default:
|
51 |
+
case 'curl':
|
52 |
+
$this->context = new Network\cURL();
|
53 |
+
break;
|
54 |
+
case 'stream':
|
55 |
+
$this->context = new Network\Stream();
|
56 |
+
break;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get Genesis Response to a previously sent request
|
62 |
+
*
|
63 |
+
* @return mixed
|
64 |
+
*/
|
65 |
+
public function getGenesisResponse()
|
66 |
+
{
|
67 |
+
return $this->context->getResponse();
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get the Body of the response
|
72 |
+
*
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function getResponseBody()
|
76 |
+
{
|
77 |
+
return $this->context->getResponseBody();
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get the Headers of the response
|
82 |
+
*
|
83 |
+
* @return mixed
|
84 |
+
*/
|
85 |
+
public function getResponseHeaders()
|
86 |
+
{
|
87 |
+
return $this->context->getResponseHeaders();
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Set Header/Body of the HTTP request
|
92 |
+
*
|
93 |
+
* @param \Genesis\API\Request $apiContext
|
94 |
+
*/
|
95 |
+
public function setApiCtxData($apiContext)
|
96 |
+
{
|
97 |
+
$this->context->prepareRequestBody(
|
98 |
+
array(
|
99 |
+
'body' => $apiContext->getDocument(),
|
100 |
+
'url' => $apiContext->getApiConfig('url'),
|
101 |
+
'type' => $apiContext->getApiConfig('type'),
|
102 |
+
'port' => $apiContext->getApiConfig('port'),
|
103 |
+
'protocol' => $apiContext->getApiConfig('protocol'),
|
104 |
+
'timeout' => \Genesis\Config::getNetworkTimeout(),
|
105 |
+
'ca_bundle' => \Genesis\Config::getCertificateBundle(),
|
106 |
+
'user_agent' => sprintf('Genesis PHP Client v%s', \Genesis\Config::getVersion()),
|
107 |
+
'user_login' => sprintf('%s:%s', \Genesis\Config::getUsername(), \Genesis\Config::getPassword()),
|
108 |
+
)
|
109 |
+
);
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Submit the prepared request to Genesis
|
114 |
+
*/
|
115 |
+
public function sendRequest()
|
116 |
+
{
|
117 |
+
$this->context->execute();
|
118 |
+
}
|
119 |
+
}
|
lib/Genesis/src/Genesis/Network/Stream.php
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Network;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Stream Context Network Interface
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Network
|
30 |
+
*/
|
31 |
+
class Stream implements \Genesis\Interfaces\Network
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Keep per-request data as other methods need it
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
private $requestData;
|
38 |
+
/**
|
39 |
+
* Storing Stream parameters
|
40 |
+
* @var Resource
|
41 |
+
*/
|
42 |
+
private $streamContext;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Storing the full incoming response
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
private $response;
|
49 |
+
/**
|
50 |
+
* Storing body from an incoming response
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
private $responseBody;
|
54 |
+
/**
|
55 |
+
* Storing headers from an incoming response
|
56 |
+
* @var string
|
57 |
+
*/
|
58 |
+
private $responseHeaders;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get HTTP Status Code from an incoming response
|
62 |
+
*
|
63 |
+
* @return mixed
|
64 |
+
*/
|
65 |
+
public function getStatus()
|
66 |
+
{
|
67 |
+
return (int)substr($this->response, 9, 3);
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get Body/Headers from an incoming response
|
72 |
+
*
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function getResponse()
|
76 |
+
{
|
77 |
+
return $this->response;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get Headers from an incoming response
|
82 |
+
*
|
83 |
+
* @return mixed
|
84 |
+
*/
|
85 |
+
public function getResponseHeaders()
|
86 |
+
{
|
87 |
+
return $this->responseHeaders;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Get Body from an incoming response
|
92 |
+
*
|
93 |
+
* @return mixed
|
94 |
+
*/
|
95 |
+
public function getResponseBody()
|
96 |
+
{
|
97 |
+
return $this->responseBody;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Set Stream parameters: url, data, auth etc.
|
102 |
+
*
|
103 |
+
* @param array $requestData
|
104 |
+
*
|
105 |
+
* @return void
|
106 |
+
*/
|
107 |
+
public function prepareRequestBody($requestData)
|
108 |
+
{
|
109 |
+
$url = parse_url($requestData['url']);
|
110 |
+
|
111 |
+
$headers = array(
|
112 |
+
'Content-Type: text/xml',
|
113 |
+
sprintf('Authorization: Basic %s', base64_encode($requestData['user_login'])),
|
114 |
+
sprintf('Content-Length: %s', strlen($requestData['body'])),
|
115 |
+
sprintf('User-Agent: %s', $requestData['user_agent']),
|
116 |
+
);
|
117 |
+
|
118 |
+
$contextOptions = array(
|
119 |
+
'http' => array(
|
120 |
+
'method' => $requestData['type'],
|
121 |
+
'header' => implode("\r\n", $headers),
|
122 |
+
'content' => $requestData['body'],
|
123 |
+
'timeout' => $requestData['timeout']
|
124 |
+
),
|
125 |
+
'ssl' => array(
|
126 |
+
// DO NOT allow self-signed certificates
|
127 |
+
'allow_self_signed' => false,
|
128 |
+
// Path to certificate/s PEM files used to validate the server authenticity
|
129 |
+
'cafile' => $requestData['ca_bundle'],
|
130 |
+
// Validate Certificates
|
131 |
+
'verify_peer' => true,
|
132 |
+
// Abort if the certificate-chain is longer than 5 nodes
|
133 |
+
'verify_depth' => 10,
|
134 |
+
// SNI causes errors due to improper handling of alerts by OpenSSL in 0.9.8
|
135 |
+
// As many php releases are linked against 0.9.8, its better to disable SNI
|
136 |
+
// in case you can't upgrade.
|
137 |
+
'SNI_enabled' => true,
|
138 |
+
// You can tweak the accepted Cipher list (if needed)
|
139 |
+
'ciphers' => implode(':', self::getCiphers())
|
140 |
+
)
|
141 |
+
);
|
142 |
+
|
143 |
+
// Note: Mitigate CRIME/BEAST attacks
|
144 |
+
if (\Genesis\Utils\Common::compareVersions('5.4.13', '>=')) {
|
145 |
+
$contextOptions['ssl']['disable_compression'] = true;
|
146 |
+
}
|
147 |
+
|
148 |
+
// Note: PHP does NOT support SAN certs on PHP version < 5.6
|
149 |
+
if (\Genesis\Utils\Common::compareVersions('5.6.0', '<')) {
|
150 |
+
$contextOptions['ssl']['CN_match'] = $url['host'];
|
151 |
+
$contextOptions['ssl']['SNI_server_name'] = $url['host'];
|
152 |
+
} else {
|
153 |
+
$contextOptions['ssl']['peer_name'] = $url['host'];
|
154 |
+
$contextOptions['ssl']['verify_peer_name'] = true;
|
155 |
+
}
|
156 |
+
|
157 |
+
$this->streamContext = stream_context_create($contextOptions);
|
158 |
+
|
159 |
+
$this->requestData = $requestData;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Send the request
|
164 |
+
*
|
165 |
+
* @return void
|
166 |
+
*/
|
167 |
+
public function execute()
|
168 |
+
{
|
169 |
+
set_error_handler(array($this, 'processErrors'), E_WARNING);
|
170 |
+
|
171 |
+
$stream = fopen($this->requestData['url'], 'r', false, $this->streamContext);
|
172 |
+
|
173 |
+
$this->responseBody = stream_get_contents($stream);
|
174 |
+
|
175 |
+
$this->responseHeaders = $http_response_header;
|
176 |
+
|
177 |
+
$this->response = implode("\r\n", $http_response_header) . "\r\n\r\n" . $this->responseBody;
|
178 |
+
|
179 |
+
restore_error_handler();
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Handle stream-related errors
|
184 |
+
*
|
185 |
+
* @param $errNo - error code
|
186 |
+
* @param $errStr - error message
|
187 |
+
*
|
188 |
+
* @throws \Genesis\Exceptions\ErrorNetwork
|
189 |
+
*/
|
190 |
+
public static function processErrors($errNo, $errStr)
|
191 |
+
{
|
192 |
+
// When an exception is being thrown, we have to restore
|
193 |
+
// the handler.
|
194 |
+
restore_error_handler();
|
195 |
+
|
196 |
+
throw new \Genesis\Exceptions\ErrorNetwork($errStr, $errNo);
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Grab an array of Cipher definitions
|
201 |
+
*
|
202 |
+
* @return array
|
203 |
+
*/
|
204 |
+
public static function getCiphers()
|
205 |
+
{
|
206 |
+
return array(
|
207 |
+
'ECDHE-RSA-AES128-GCM-SHA256',
|
208 |
+
'ECDHE-ECDSA-AES128-GCM-SHA256',
|
209 |
+
'ECDHE-RSA-AES256-GCM-SHA384',
|
210 |
+
'ECDHE-ECDSA-AES256-GCM-SHA384',
|
211 |
+
'DHE-RSA-AES128-GCM-SHA256',
|
212 |
+
'DHE-DSS-AES128-GCM-SHA256',
|
213 |
+
'kEDH+AESGCM',
|
214 |
+
'ECDHE-RSA-AES128-SHA256',
|
215 |
+
'ECDHE-ECDSA-AES128-SHA256',
|
216 |
+
'ECDHE-RSA-AES128-SHA',
|
217 |
+
'ECDHE-ECDSA-AES128-SHA',
|
218 |
+
'ECDHE-RSA-AES256-SHA384',
|
219 |
+
'ECDHE-ECDSA-AES256-SHA384',
|
220 |
+
'ECDHE-RSA-AES256-SHA',
|
221 |
+
'ECDHE-ECDSA-AES256-SHA',
|
222 |
+
'DHE-RSA-AES128-SHA256',
|
223 |
+
'DHE-RSA-AES128-SHA',
|
224 |
+
'DHE-DSS-AES128-SHA256',
|
225 |
+
'DHE-RSA-AES256-SHA256',
|
226 |
+
'DHE-DSS-AES256-SHA',
|
227 |
+
'DHE-RSA-AES256-SHA',
|
228 |
+
'!aNULL',
|
229 |
+
'!eNULL',
|
230 |
+
'!EXPORT',
|
231 |
+
'!DES',
|
232 |
+
'!3DES',
|
233 |
+
'!MD5',
|
234 |
+
'!RC4',
|
235 |
+
'!PSK',
|
236 |
+
'!SSLv2',
|
237 |
+
'!SSLv3'
|
238 |
+
);
|
239 |
+
}
|
240 |
+
}
|
lib/Genesis/src/Genesis/Network/cURL.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Network;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* cURL Network Interface
|
27 |
+
* Note: requires php curl extension
|
28 |
+
*
|
29 |
+
* @package Genesis
|
30 |
+
* @subpackage Network
|
31 |
+
*/
|
32 |
+
// @codingStandardsIgnoreStart
|
33 |
+
class cURL implements \Genesis\Interfaces\Network
|
34 |
+
// @codingStandardsIgnoreEnd
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Storing cURL Handle
|
38 |
+
*
|
39 |
+
* @var resource
|
40 |
+
*/
|
41 |
+
private $curlHandle;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Storing the full incoming response
|
45 |
+
*
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
private $response;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Storing body from an incoming response
|
52 |
+
*
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
private $responseBody;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Storing headers from an incoming response
|
59 |
+
*
|
60 |
+
* @var string
|
61 |
+
*/
|
62 |
+
private $responseHeaders;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Initialize cURL
|
66 |
+
*/
|
67 |
+
public function __construct()
|
68 |
+
{
|
69 |
+
$this->curlHandle = curl_init();
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Get the HTTP Status of the request
|
74 |
+
*
|
75 |
+
* @return mixed
|
76 |
+
*/
|
77 |
+
public function getStatus()
|
78 |
+
{
|
79 |
+
return (int)curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Get Body/Headers from an incoming response
|
84 |
+
*
|
85 |
+
* @return mixed
|
86 |
+
*/
|
87 |
+
public function getResponse()
|
88 |
+
{
|
89 |
+
return $this->response;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Get Headers from an incoming response
|
94 |
+
*
|
95 |
+
* @return mixed
|
96 |
+
*/
|
97 |
+
public function getResponseHeaders()
|
98 |
+
{
|
99 |
+
return $this->responseHeaders;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get Body from an incoming response
|
104 |
+
*
|
105 |
+
* @return mixed
|
106 |
+
*/
|
107 |
+
public function getResponseBody()
|
108 |
+
{
|
109 |
+
return $this->responseBody;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Set cURL headers/options, based on the request data
|
114 |
+
*
|
115 |
+
* @param array $requestData
|
116 |
+
*
|
117 |
+
* @return void
|
118 |
+
*/
|
119 |
+
public function prepareRequestBody($requestData)
|
120 |
+
{
|
121 |
+
$options = array(
|
122 |
+
CURLOPT_URL => $requestData['url'],
|
123 |
+
CURLOPT_TIMEOUT => $requestData['timeout'],
|
124 |
+
CURLOPT_USERAGENT => $requestData['user_agent'],
|
125 |
+
CURLOPT_USERPWD => $requestData['user_login'],
|
126 |
+
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
|
127 |
+
CURLOPT_ENCODING => 'gzip',
|
128 |
+
CURLOPT_HTTPHEADER => array(
|
129 |
+
'Content-Type: text/xml',
|
130 |
+
// Workaround to prevent cURL from parsing HTTP 100 as separate request
|
131 |
+
'Expect:'
|
132 |
+
),
|
133 |
+
CURLOPT_HEADER => true,
|
134 |
+
CURLOPT_FAILONERROR => true,
|
135 |
+
CURLOPT_FRESH_CONNECT => true,
|
136 |
+
CURLOPT_RETURNTRANSFER => true,
|
137 |
+
// SSL/TLS Configuration
|
138 |
+
CURLOPT_CAINFO => $requestData['ca_bundle'],
|
139 |
+
CURLOPT_SSL_VERIFYPEER => true,
|
140 |
+
CURLOPT_SSL_VERIFYHOST => 2,
|
141 |
+
);
|
142 |
+
|
143 |
+
if ('POST' == strtoupper($requestData['type'])) {
|
144 |
+
$post = array(
|
145 |
+
CURLOPT_POST => true,
|
146 |
+
CURLOPT_POSTFIELDS => $requestData['body']
|
147 |
+
);
|
148 |
+
|
149 |
+
$options = $options + $post;
|
150 |
+
}
|
151 |
+
|
152 |
+
curl_setopt_array($this->curlHandle, $options);
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Send the request
|
157 |
+
*
|
158 |
+
* @return void
|
159 |
+
*
|
160 |
+
* @throws
|
161 |
+
*/
|
162 |
+
public function execute()
|
163 |
+
{
|
164 |
+
$this->response = curl_exec($this->curlHandle);
|
165 |
+
|
166 |
+
$this->checkForErrors();
|
167 |
+
|
168 |
+
list($this->responseHeaders, $this->responseBody) = explode("\r\n\r\n", $this->response, 2);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Check whether or not a cURL request is successful
|
173 |
+
*
|
174 |
+
* @return string
|
175 |
+
* @throws \Genesis\Exceptions\ErrorNetwork
|
176 |
+
*/
|
177 |
+
public function checkForErrors()
|
178 |
+
{
|
179 |
+
$errNo = curl_errno($this->curlHandle);
|
180 |
+
$errStr = curl_error($this->curlHandle);
|
181 |
+
|
182 |
+
if ($errNo > 0) {
|
183 |
+
throw new \Genesis\Exceptions\ErrorNetwork($errStr, $errNo);
|
184 |
+
}
|
185 |
+
}
|
186 |
+
}
|
lib/Genesis/src/Genesis/Parser.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Parser handler
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
*/
|
30 |
+
class Parser
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Instance of the selected builder wrapper
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
private $context;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Initialize the required builder, based on the use's
|
41 |
+
* preference (set inside the configuration ini file)
|
42 |
+
*
|
43 |
+
* @param string $interface
|
44 |
+
*/
|
45 |
+
public function __construct($interface = null)
|
46 |
+
{
|
47 |
+
$interface = $interface ?: \Genesis\Config::getInterface('parser');
|
48 |
+
|
49 |
+
switch ($interface) {
|
50 |
+
default:
|
51 |
+
case 'xml':
|
52 |
+
$this->context = new Parsers\XML();
|
53 |
+
break;
|
54 |
+
case 'json':
|
55 |
+
break;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get the printable Builder Output
|
61 |
+
*
|
62 |
+
* @return \stdClass
|
63 |
+
*/
|
64 |
+
public function getObject()
|
65 |
+
{
|
66 |
+
return $this->context->getObject();
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Parse tree-structure into Builder document
|
71 |
+
*
|
72 |
+
* @param mixed $document
|
73 |
+
*/
|
74 |
+
public function parseDocument($document)
|
75 |
+
{
|
76 |
+
$this->context->parseDocument($document);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Set a flag, indicating, if the root
|
81 |
+
* node of a document should be skipped
|
82 |
+
* during parsing
|
83 |
+
*
|
84 |
+
* @return bool
|
85 |
+
*/
|
86 |
+
public function skipRootNode()
|
87 |
+
{
|
88 |
+
$this->context->skipRootNode();
|
89 |
+
}
|
90 |
+
}
|
lib/Genesis/src/Genesis/Parsers/XML.php
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Parsers;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class XML
|
27 |
+
*
|
28 |
+
* Parse an XML Document into a stdClass
|
29 |
+
*
|
30 |
+
* @package Genesis\Parsers
|
31 |
+
*/
|
32 |
+
final class XML implements \Genesis\Interfaces\Parser
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* Converted XML
|
36 |
+
*
|
37 |
+
* @var \stdClass
|
38 |
+
*/
|
39 |
+
public $stdClassObj;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Should we skip the RootNode?
|
43 |
+
*
|
44 |
+
* @var bool
|
45 |
+
*/
|
46 |
+
public $skipRootNode;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Set default variables
|
50 |
+
*/
|
51 |
+
public function __construct()
|
52 |
+
{
|
53 |
+
$this->skipRootNode = false;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get the parsed object
|
58 |
+
*
|
59 |
+
* @return \stdClass
|
60 |
+
*/
|
61 |
+
public function getObject()
|
62 |
+
{
|
63 |
+
return $this->stdClassObj;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Set skipRootNode to true
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function skipRootNode()
|
72 |
+
{
|
73 |
+
return $this->skipRootNode = true;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Parse a document to an stdClass
|
78 |
+
*
|
79 |
+
* @param string $xmlDocument XML Document
|
80 |
+
*
|
81 |
+
* @return void
|
82 |
+
*/
|
83 |
+
public function parseDocument($xmlDocument)
|
84 |
+
{
|
85 |
+
$reader = new \XMLReader();
|
86 |
+
$reader->open('data:text/plain;base64,' . base64_encode($xmlDocument));
|
87 |
+
|
88 |
+
if ($this->skipRootNode) {
|
89 |
+
$reader->read();
|
90 |
+
}
|
91 |
+
|
92 |
+
$this->stdClassObj = self::readerLoop($reader);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Read through the entire document
|
97 |
+
*
|
98 |
+
* @param \XMLReader $reader
|
99 |
+
* @return mixed
|
100 |
+
*/
|
101 |
+
public function readerLoop($reader)
|
102 |
+
{
|
103 |
+
$tree = new \stdClass();
|
104 |
+
|
105 |
+
while ($reader->read()) {
|
106 |
+
switch ($reader->nodeType) {
|
107 |
+
case \XMLReader::END_ELEMENT:
|
108 |
+
return $tree;
|
109 |
+
break;
|
110 |
+
case \XMLReader::ELEMENT:
|
111 |
+
$this->processElement($reader, $tree);
|
112 |
+
|
113 |
+
if ($reader->hasAttributes) {
|
114 |
+
$this->processAttributes($reader, $tree);
|
115 |
+
}
|
116 |
+
break;
|
117 |
+
case \XMLReader::TEXT:
|
118 |
+
case \XMLReader::CDATA:
|
119 |
+
$tree = \Genesis\Utils\Common::stringToBoolean(
|
120 |
+
trim($reader->expand()->textContent)
|
121 |
+
);
|
122 |
+
break;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
return $tree;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Process XMLReader element
|
131 |
+
*
|
132 |
+
* @param $reader
|
133 |
+
* @param $tree
|
134 |
+
*/
|
135 |
+
public function processElement(&$reader, &$tree)
|
136 |
+
{
|
137 |
+
$name = $reader->name;
|
138 |
+
|
139 |
+
if (isset($tree->$name)) {
|
140 |
+
if (is_a($tree->$name, 'stdClass')) {
|
141 |
+
$currentEl = $tree->$name;
|
142 |
+
|
143 |
+
$tree->$name = new \ArrayObject();
|
144 |
+
|
145 |
+
$tree->$name->append($currentEl);
|
146 |
+
}
|
147 |
+
|
148 |
+
if (is_a($tree->$name, 'ArrayObject')) {
|
149 |
+
$tree->$name->append(($reader->isEmptyElement) ? '' : $this->readerLoop($reader));
|
150 |
+
}
|
151 |
+
} else {
|
152 |
+
$tree->$name = ($reader->isEmptyElement) ? '' : $this->readerLoop($reader);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Process element attributes
|
158 |
+
*
|
159 |
+
* @param \XMLReader $reader
|
160 |
+
* @param \stdClass $tree
|
161 |
+
*/
|
162 |
+
public function processAttributes(&$reader, &$tree)
|
163 |
+
{
|
164 |
+
$name = $reader->name;
|
165 |
+
|
166 |
+
$node = new \stdClass();
|
167 |
+
|
168 |
+
$node->attr = new \stdClass();
|
169 |
+
|
170 |
+
while ($reader->moveToNextAttribute()) {
|
171 |
+
$node->attr->$name = $reader->value;
|
172 |
+
}
|
173 |
+
|
174 |
+
if (isset($tree->$name) && is_a($tree->$name, 'ArrayObject')) {
|
175 |
+
$lastKey = $tree->$name->count() - 1;
|
176 |
+
|
177 |
+
$node->value = $tree->$name->offsetGet($lastKey);
|
178 |
+
$tree->$name->offsetSet($lastKey, $node);
|
179 |
+
} else {
|
180 |
+
$node->value = isset($tree->$name) ? $tree->$name : '';
|
181 |
+
|
182 |
+
$tree->$name = $node;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
}
|
lib/Genesis/src/Genesis/Utils/Common.php
ADDED
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Utils;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Various helper functions used across the project
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Utils
|
30 |
+
*/
|
31 |
+
final class Common
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Helper for version_compare()
|
35 |
+
*
|
36 |
+
* @param string $version - The version you want to check against
|
37 |
+
* @param string $operator - Type of version check
|
38 |
+
*
|
39 |
+
* @return mixed
|
40 |
+
*/
|
41 |
+
public static function compareVersions($version, $operator)
|
42 |
+
{
|
43 |
+
return version_compare(self::getPHPVersion(), $version, $operator);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Helper to get the current PHP version
|
48 |
+
*
|
49 |
+
* @return int
|
50 |
+
*/
|
51 |
+
public static function getPHPVersion()
|
52 |
+
{
|
53 |
+
// PHP_VERSION_ID is available as of PHP 5.2.7, if the current version is older than that - emulate it
|
54 |
+
if (!defined('PHP_VERSION_ID')) {
|
55 |
+
list($major, $minor, $release) = explode('.', PHP_VERSION);
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Define PHP_VERSION_ID if its not present (unsupported version)
|
59 |
+
*
|
60 |
+
* format: major minor release
|
61 |
+
*/
|
62 |
+
define('PHP_VERSION_ID', (($major * 10000) + ($minor * 100) + $release));
|
63 |
+
}
|
64 |
+
|
65 |
+
return (int)PHP_VERSION_ID;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Convert PascalCase string to a SnakeCase
|
70 |
+
* useful for argument parsing
|
71 |
+
*
|
72 |
+
* @param string $input
|
73 |
+
*
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public static function pascalToSnakeCase($input)
|
77 |
+
{
|
78 |
+
preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
|
79 |
+
|
80 |
+
foreach ($matches[0] as &$match) {
|
81 |
+
$match = ($match == strtoupper($match)) ? strtolower($match) : lcfirst($match);
|
82 |
+
}
|
83 |
+
|
84 |
+
return implode('_', $matches[0]);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get PascalCase to action/target array
|
89 |
+
*
|
90 |
+
* @param $input
|
91 |
+
*
|
92 |
+
* @return array
|
93 |
+
*/
|
94 |
+
public static function resolveDynamicMethod($input)
|
95 |
+
{
|
96 |
+
$snakeCase = explode('_', self::pascalToSnakeCase($input));
|
97 |
+
|
98 |
+
$result = array(
|
99 |
+
current(
|
100 |
+
array_slice($snakeCase, 0, 1)
|
101 |
+
),
|
102 |
+
implode(
|
103 |
+
'_',
|
104 |
+
array_slice($snakeCase, 1)
|
105 |
+
)
|
106 |
+
);
|
107 |
+
|
108 |
+
return $result;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Convert SnakeCase to CamelCase
|
113 |
+
*
|
114 |
+
* @param string $input
|
115 |
+
*
|
116 |
+
* @return string
|
117 |
+
*/
|
118 |
+
public static function snakeCaseToCamelCase($input)
|
119 |
+
{
|
120 |
+
return preg_replace_callback(
|
121 |
+
'/(?:^|_)(.?)/',
|
122 |
+
function ($value) {
|
123 |
+
return strtoupper($value[1]);
|
124 |
+
},
|
125 |
+
$input
|
126 |
+
);
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Helper function - iterate over array ($haystack) and
|
131 |
+
* remove every key with empty value
|
132 |
+
*
|
133 |
+
* @param array $haystack - input array
|
134 |
+
*
|
135 |
+
* @return array
|
136 |
+
*/
|
137 |
+
public static function emptyValueRecursiveRemoval($haystack)
|
138 |
+
{
|
139 |
+
foreach ($haystack as $key => $value) {
|
140 |
+
if (is_array($value)) {
|
141 |
+
$haystack[$key] = self::emptyValueRecursiveRemoval($haystack[$key]);
|
142 |
+
}
|
143 |
+
|
144 |
+
if (empty($haystack[$key])) {
|
145 |
+
unset($haystack[$key]);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
return $haystack;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Create ArrayObject ($target) from passed Array ($source_array)
|
154 |
+
*
|
155 |
+
* @param $srcArray - input array
|
156 |
+
*
|
157 |
+
* @return \ArrayObject
|
158 |
+
*/
|
159 |
+
public static function createArrayObject($srcArray)
|
160 |
+
{
|
161 |
+
return new \ArrayObject($srcArray, \ArrayObject::ARRAY_AS_PROPS);
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Check if the passed argument is:
|
166 |
+
* - Array
|
167 |
+
* - Its not empty
|
168 |
+
*
|
169 |
+
* @param array $arr incoming array
|
170 |
+
*
|
171 |
+
* @return bool
|
172 |
+
*/
|
173 |
+
public static function isValidArray($arr)
|
174 |
+
{
|
175 |
+
if (!is_array($arr) || empty($arr) || count($arr) < 1) {
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
|
179 |
+
return true;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Check if the passed argument is a valid XML tag name
|
184 |
+
*
|
185 |
+
* @param string $tag
|
186 |
+
*
|
187 |
+
* @return bool
|
188 |
+
*/
|
189 |
+
public static function isValidXMLName($tag)
|
190 |
+
{
|
191 |
+
if (!is_array($tag)) {
|
192 |
+
return preg_match('/^[a-z_]+[a-z0-9\:\-\.\_]*[^:]*$/i', $tag, $matches) && reset($matches) == $tag;
|
193 |
+
}
|
194 |
+
|
195 |
+
return false;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Evaluate a boolean expression from String
|
200 |
+
* or return the string itself
|
201 |
+
*
|
202 |
+
* @param $string
|
203 |
+
*
|
204 |
+
* @return bool | string
|
205 |
+
*/
|
206 |
+
public static function stringToBoolean($string)
|
207 |
+
{
|
208 |
+
$flag = filter_var($string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
209 |
+
|
210 |
+
if ($flag) {
|
211 |
+
return true;
|
212 |
+
} elseif (is_null($flag)) {
|
213 |
+
return $string;
|
214 |
+
} else {
|
215 |
+
return false;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Convert Boolean to String
|
221 |
+
*
|
222 |
+
* @param bool $bool
|
223 |
+
*
|
224 |
+
* @return string
|
225 |
+
*/
|
226 |
+
public static function booleanToString($bool)
|
227 |
+
{
|
228 |
+
if (is_bool($bool)) {
|
229 |
+
if ($bool) {
|
230 |
+
return 'true';
|
231 |
+
} else {
|
232 |
+
return 'false';
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
return $bool;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Check if a string is base64 Encoded
|
241 |
+
*
|
242 |
+
* @param string $input Data to verify if its valid base64
|
243 |
+
* @return bool
|
244 |
+
*/
|
245 |
+
public static function isBase64Encoded($input)
|
246 |
+
{
|
247 |
+
if ($input && @base64_encode(@base64_decode($input, true)) === $input) {
|
248 |
+
return true;
|
249 |
+
}
|
250 |
+
|
251 |
+
return false;
|
252 |
+
}
|
253 |
+
}
|
lib/Genesis/src/Genesis/Utils/Country.php
ADDED
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Utils;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Country-related methods
|
27 |
+
*
|
28 |
+
* @package Genesis
|
29 |
+
* @subpackage Country
|
30 |
+
*/
|
31 |
+
final class Country
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* List of all countries, defined by ISO 3166
|
35 |
+
*
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
public static $countries
|
39 |
+
= array(
|
40 |
+
'AF' => 'Afghanistan',
|
41 |
+
'AX' => 'Aland Islands',
|
42 |
+
'AL' => 'Albania',
|
43 |
+
'DZ' => 'Algeria',
|
44 |
+
'AS' => 'American Samoa',
|
45 |
+
'AD' => 'Andorra',
|
46 |
+
'AO' => 'Angola',
|
47 |
+
'AI' => 'Anguilla',
|
48 |
+
'AQ' => 'Antarctica',
|
49 |
+
'AG' => 'Antigua And Barbuda',
|
50 |
+
'AR' => 'Argentina',
|
51 |
+
'AM' => 'Armenia',
|
52 |
+
'AW' => 'Aruba',
|
53 |
+
'AU' => 'Australia',
|
54 |
+
'AT' => 'Austria',
|
55 |
+
'AZ' => 'Azerbaijan',
|
56 |
+
'BS' => 'Bahamas',
|
57 |
+
'BH' => 'Bahrain',
|
58 |
+
'BD' => 'Bangladesh',
|
59 |
+
'BB' => 'Barbados',
|
60 |
+
'BY' => 'Belarus',
|
61 |
+
'BE' => 'Belgium',
|
62 |
+
'BZ' => 'Belize',
|
63 |
+
'BJ' => 'Benin',
|
64 |
+
'BM' => 'Bermuda',
|
65 |
+
'BT' => 'Bhutan',
|
66 |
+
'BO' => 'Bolivia',
|
67 |
+
'BA' => 'Bosnia And Herzegovina',
|
68 |
+
'BW' => 'Botswana',
|
69 |
+
'BV' => 'Bouvet Island',
|
70 |
+
'BR' => 'Brazil',
|
71 |
+
'IO' => 'British Indian Ocean Territory',
|
72 |
+
'BN' => 'Brunei Darussalam',
|
73 |
+
'BG' => 'Bulgaria',
|
74 |
+
'BF' => 'Burkina Faso',
|
75 |
+
'BI' => 'Burundi',
|
76 |
+
'KH' => 'Cambodia',
|
77 |
+
'CM' => 'Cameroon',
|
78 |
+
'CA' => 'Canada',
|
79 |
+
'CV' => 'Cape Verde',
|
80 |
+
'KY' => 'Cayman Islands',
|
81 |
+
'CF' => 'Central African Republic',
|
82 |
+
'TD' => 'Chad',
|
83 |
+
'CL' => 'Chile',
|
84 |
+
'CN' => 'China',
|
85 |
+
'CX' => 'Christmas Island',
|
86 |
+
'CC' => 'Cocos (Keeling) Islands',
|
87 |
+
'CO' => 'Colombia',
|
88 |
+
'KM' => 'Comoros',
|
89 |
+
'CG' => 'Congo',
|
90 |
+
'CD' => 'Congo, Democratic Republic',
|
91 |
+
'CK' => 'Cook Islands',
|
92 |
+
'CR' => 'Costa Rica',
|
93 |
+
'CI' => 'Cote D\'Ivoire',
|
94 |
+
'HR' => 'Croatia',
|
95 |
+
'CU' => 'Cuba',
|
96 |
+
'CY' => 'Cyprus',
|
97 |
+
'CZ' => 'Czech Republic',
|
98 |
+
'DK' => 'Denmark',
|
99 |
+
'DJ' => 'Djibouti',
|
100 |
+
'DM' => 'Dominica',
|
101 |
+
'DO' => 'Dominican Republic',
|
102 |
+
'EC' => 'Ecuador',
|
103 |
+
'EG' => 'Egypt',
|
104 |
+
'SV' => 'El Salvador',
|
105 |
+
'GQ' => 'Equatorial Guinea',
|
106 |
+
'ER' => 'Eritrea',
|
107 |
+
'EE' => 'Estonia',
|
108 |
+
'ET' => 'Ethiopia',
|
109 |
+
'FK' => 'Falkland Islands (Malvinas)',
|
110 |
+
'FO' => 'Faroe Islands',
|
111 |
+
'FJ' => 'Fiji',
|
112 |
+
'FI' => 'Finland',
|
113 |
+
'FR' => 'France',
|
114 |
+
'GF' => 'French Guiana',
|
115 |
+
'PF' => 'French Polynesia',
|
116 |
+
'TF' => 'French Southern Territories',
|
117 |
+
'GA' => 'Gabon',
|
118 |
+
'GM' => 'Gambia',
|
119 |
+
'GE' => 'Georgia',
|
120 |
+
'DE' => 'Germany',
|
121 |
+
'GH' => 'Ghana',
|
122 |
+
'GI' => 'Gibraltar',
|
123 |
+
'GR' => 'Greece',
|
124 |
+
'GL' => 'Greenland',
|
125 |
+
'GD' => 'Grenada',
|
126 |
+
'GP' => 'Guadeloupe',
|
127 |
+
'GU' => 'Guam',
|
128 |
+
'GT' => 'Guatemala',
|
129 |
+
'GG' => 'Guernsey',
|
130 |
+
'GN' => 'Guinea',
|
131 |
+
'GW' => 'Guinea-Bissau',
|
132 |
+
'GY' => 'Guyana',
|
133 |
+
'HT' => 'Haiti',
|
134 |
+
'HM' => 'Heard Island & Mcdonald Islands',
|
135 |
+
'VA' => 'Holy See (Vatican City State)',
|
136 |
+
'HN' => 'Honduras',
|
137 |
+
'HK' => 'Hong Kong',
|
138 |
+
'HU' => 'Hungary',
|
139 |
+
'IS' => 'Iceland',
|
140 |
+
'IN' => 'India',
|
141 |
+
'ID' => 'Indonesia',
|
142 |
+
'IR' => 'Iran, Islamic Republic Of',
|
143 |
+
'IQ' => 'Iraq',
|
144 |
+
'IE' => 'Ireland',
|
145 |
+
'IM' => 'Isle Of Man',
|
146 |
+
'IL' => 'Israel',
|
147 |
+
'IT' => 'Italy',
|
148 |
+
'JM' => 'Jamaica',
|
149 |
+
'JP' => 'Japan',
|
150 |
+
'JE' => 'Jersey',
|
151 |
+
'JO' => 'Jordan',
|
152 |
+
'KZ' => 'Kazakhstan',
|
153 |
+
'KE' => 'Kenya',
|
154 |
+
'KI' => 'Kiribati',
|
155 |
+
'KR' => 'Korea',
|
156 |
+
'KW' => 'Kuwait',
|
157 |
+
'KG' => 'Kyrgyzstan',
|
158 |
+
'LA' => 'Lao People\'s Democratic Republic',
|
159 |
+
'LV' => 'Latvia',
|
160 |
+
'LB' => 'Lebanon',
|
161 |
+
'LS' => 'Lesotho',
|
162 |
+
'LR' => 'Liberia',
|
163 |
+
'LY' => 'Libyan Arab Jamahiriya',
|
164 |
+
'LI' => 'Liechtenstein',
|
165 |
+
'LT' => 'Lithuania',
|
166 |
+
'LU' => 'Luxembourg',
|
167 |
+
'MO' => 'Macao',
|
168 |
+
'MK' => 'Macedonia',
|
169 |
+
'MG' => 'Madagascar',
|
170 |
+
'MW' => 'Malawi',
|
171 |
+
'MY' => 'Malaysia',
|
172 |
+
'MV' => 'Maldives',
|
173 |
+
'ML' => 'Mali',
|
174 |
+
'MT' => 'Malta',
|
175 |
+
'MH' => 'Marshall Islands',
|
176 |
+
'MQ' => 'Martinique',
|
177 |
+
'MR' => 'Mauritania',
|
178 |
+
'MU' => 'Mauritius',
|
179 |
+
'YT' => 'Mayotte',
|
180 |
+
'MX' => 'Mexico',
|
181 |
+
'FM' => 'Micronesia, Federated States Of',
|
182 |
+
'MD' => 'Moldova',
|
183 |
+
'MC' => 'Monaco',
|
184 |
+
'MN' => 'Mongolia',
|
185 |
+
'ME' => 'Montenegro',
|
186 |
+
'MS' => 'Montserrat',
|
187 |
+
'MA' => 'Morocco',
|
188 |
+
'MZ' => 'Mozambique',
|
189 |
+
'MM' => 'Myanmar',
|
190 |
+
'NA' => 'Namibia',
|
191 |
+
'NR' => 'Nauru',
|
192 |
+
'NP' => 'Nepal',
|
193 |
+
'NL' => 'Netherlands',
|
194 |
+
'AN' => 'Netherlands Antilles',
|
195 |
+
'NC' => 'New Caledonia',
|
196 |
+
'NZ' => 'New Zealand',
|
197 |
+
'NI' => 'Nicaragua',
|
198 |
+
'NE' => 'Niger',
|
199 |
+
'NG' => 'Nigeria',
|
200 |
+
'NU' => 'Niue',
|
201 |
+
'NF' => 'Norfolk Island',
|
202 |
+
'MP' => 'Northern Mariana Islands',
|
203 |
+
'NO' => 'Norway',
|
204 |
+
'OM' => 'Oman',
|
205 |
+
'PK' => 'Pakistan',
|
206 |
+
'PW' => 'Palau',
|
207 |
+
'PS' => 'Palestinian Territory, Occupied',
|
208 |
+
'PA' => 'Panama',
|
209 |
+
'PG' => 'Papua New Guinea',
|
210 |
+
'PY' => 'Paraguay',
|
211 |
+
'PE' => 'Peru',
|
212 |
+
'PH' => 'Philippines',
|
213 |
+
'PN' => 'Pitcairn',
|
214 |
+
'PL' => 'Poland',
|
215 |
+
'PT' => 'Portugal',
|
216 |
+
'PR' => 'Puerto Rico',
|
217 |
+
'QA' => 'Qatar',
|
218 |
+
'RE' => 'Reunion',
|
219 |
+
'RO' => 'Romania',
|
220 |
+
'RU' => 'Russian Federation',
|
221 |
+
'RW' => 'Rwanda',
|
222 |
+
'BL' => 'Saint Barthelemy',
|
223 |
+
'SH' => 'Saint Helena',
|
224 |
+
'KN' => 'Saint Kitts And Nevis',
|
225 |
+
'LC' => 'Saint Lucia',
|
226 |
+
'MF' => 'Saint Martin',
|
227 |
+
'PM' => 'Saint Pierre And Miquelon',
|
228 |
+
'VC' => 'Saint Vincent And Grenadines',
|
229 |
+
'WS' => 'Samoa',
|
230 |
+
'SM' => 'San Marino',
|
231 |
+
'ST' => 'Sao Tome And Principe',
|
232 |
+
'SA' => 'Saudi Arabia',
|
233 |
+
'SN' => 'Senegal',
|
234 |
+
'RS' => 'Serbia',
|
235 |
+
'SC' => 'Seychelles',
|
236 |
+
'SL' => 'Sierra Leone',
|
237 |
+
'SG' => 'Singapore',
|
238 |
+
'SK' => 'Slovakia',
|
239 |
+
'SI' => 'Slovenia',
|
240 |
+
'SB' => 'Solomon Islands',
|
241 |
+
'SO' => 'Somalia',
|
242 |
+
'ZA' => 'South Africa',
|
243 |
+
'GS' => 'South Georgia And Sandwich Isl.',
|
244 |
+
'ES' => 'Spain',
|
245 |
+
'LK' => 'Sri Lanka',
|
246 |
+
'SD' => 'Sudan',
|
247 |
+
'SR' => 'Suriname',
|
248 |
+
'SJ' => 'Svalbard And Jan Mayen',
|
249 |
+
'SZ' => 'Swaziland',
|
250 |
+
'SE' => 'Sweden',
|
251 |
+
'CH' => 'Switzerland',
|
252 |
+
'SY' => 'Syrian Arab Republic',
|
253 |
+
'TW' => 'Taiwan',
|
254 |
+
'TJ' => 'Tajikistan',
|
255 |
+
'TZ' => 'Tanzania',
|
256 |
+
'TH' => 'Thailand',
|
257 |
+
'TL' => 'Timor-Leste',
|
258 |
+
'TG' => 'Togo',
|
259 |
+
'TK' => 'Tokelau',
|
260 |
+
'TO' => 'Tonga',
|
261 |
+
'TT' => 'Trinidad And Tobago',
|
262 |
+
'TN' => 'Tunisia',
|
263 |
+
'TR' => 'Turkey',
|
264 |
+
'TM' => 'Turkmenistan',
|
265 |
+
'TC' => 'Turks And Caicos Islands',
|
266 |
+
'TV' => 'Tuvalu',
|
267 |
+
'UG' => 'Uganda',
|
268 |
+
'UA' => 'Ukraine',
|
269 |
+
'AE' => 'United Arab Emirates',
|
270 |
+
'GB' => 'United Kingdom',
|
271 |
+
'US' => 'United States',
|
272 |
+
'UM' => 'United States Outlying Islands',
|
273 |
+
'UY' => 'Uruguay',
|
274 |
+
'UZ' => 'Uzbekistan',
|
275 |
+
'VU' => 'Vanuatu',
|
276 |
+
'VE' => 'Venezuela',
|
277 |
+
'VN' => 'Viet Nam',
|
278 |
+
'VG' => 'Virgin Islands, British',
|
279 |
+
'VI' => 'Virgin Islands, U.S.',
|
280 |
+
'WF' => 'Wallis And Futuna',
|
281 |
+
'EH' => 'Western Sahara',
|
282 |
+
'YE' => 'Yemen',
|
283 |
+
'ZM' => 'Zambia',
|
284 |
+
'ZW' => 'Zimbabwe',
|
285 |
+
);
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Get a country's name by its ISO Code
|
289 |
+
*
|
290 |
+
* @param $iso_code - country's iso code
|
291 |
+
*
|
292 |
+
* @return mixed - string if code is present, false otherwise
|
293 |
+
*/
|
294 |
+
public static function getCountryName($iso_code)
|
295 |
+
{
|
296 |
+
if (isset(self::$countries[$iso_code])) {
|
297 |
+
return self::$countries[$iso_code];
|
298 |
+
}
|
299 |
+
|
300 |
+
return false;
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Get a country's ISO code by its name
|
305 |
+
*
|
306 |
+
* @param $country_name - name of the country
|
307 |
+
*
|
308 |
+
* @return string - iso
|
309 |
+
*/
|
310 |
+
public static function getCountryISO($country_name)
|
311 |
+
{
|
312 |
+
return array_search(strtolower($country_name), array_map('strtolower', self::$countries));
|
313 |
+
}
|
314 |
+
}
|
lib/Genesis/src/Genesis/Utils/Currency.php
ADDED
@@ -0,0 +1,1156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Utils;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Currency-related methods
|
27 |
+
*
|
28 |
+
* @package Genesis\Utils
|
29 |
+
*/
|
30 |
+
final class Currency
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* List of currencies, defined by ISO-4217
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
public static $iso4217
|
38 |
+
= array(
|
39 |
+
'AED' => array(
|
40 |
+
'name' => 'UAE Dirham',
|
41 |
+
'code' => '784',
|
42 |
+
'country' => 'UNITED ARAB EMIRATES (THE)',
|
43 |
+
'exponent' => '2'
|
44 |
+
),
|
45 |
+
'AFN' => array(
|
46 |
+
'name' => 'Afghani',
|
47 |
+
'code' => '971',
|
48 |
+
'country' => 'AFGHANISTAN',
|
49 |
+
'exponent' => '2'
|
50 |
+
),
|
51 |
+
'ALL' => array(
|
52 |
+
'name' => 'Lek',
|
53 |
+
'code' => '008',
|
54 |
+
'country' => 'ALBANIA',
|
55 |
+
'exponent' => '2'
|
56 |
+
),
|
57 |
+
'AMD' => array(
|
58 |
+
'name' => 'Armenian Dram',
|
59 |
+
'code' => '051',
|
60 |
+
'country' => 'ARMENIA',
|
61 |
+
'exponent' => '2'
|
62 |
+
),
|
63 |
+
'ANG' => array(
|
64 |
+
'name' => 'Netherlands Antillean Guilder',
|
65 |
+
'code' => '532',
|
66 |
+
'country' => 'SINT MAARTEN (DUTCH PART)',
|
67 |
+
'exponent' => '2'
|
68 |
+
),
|
69 |
+
'AOA' => array(
|
70 |
+
'name' => 'Kwanza',
|
71 |
+
'code' => '973',
|
72 |
+
'country' => 'ANGOLA',
|
73 |
+
'exponent' => '2'
|
74 |
+
),
|
75 |
+
'ARS' => array(
|
76 |
+
'name' => 'Argentine Peso',
|
77 |
+
'code' => '032',
|
78 |
+
'country' => 'ARGENTINA',
|
79 |
+
'exponent' => '2'
|
80 |
+
),
|
81 |
+
'AUD' => array(
|
82 |
+
'name' => 'Australian Dollar',
|
83 |
+
'code' => '036',
|
84 |
+
'country' => 'TUVALU',
|
85 |
+
'exponent' => '2'
|
86 |
+
),
|
87 |
+
'AWG' => array(
|
88 |
+
'name' => 'Aruban Florin',
|
89 |
+
'code' => '533',
|
90 |
+
'country' => 'ARUBA',
|
91 |
+
'exponent' => '2'
|
92 |
+
),
|
93 |
+
'AZN' => array(
|
94 |
+
'name' => 'Azerbaijanian Manat',
|
95 |
+
'code' => '944',
|
96 |
+
'country' => 'AZERBAIJAN',
|
97 |
+
'exponent' => '2'
|
98 |
+
),
|
99 |
+
'BAM' => array(
|
100 |
+
'name' => 'Convertible Mark',
|
101 |
+
'code' => '977',
|
102 |
+
'country' => 'BOSNIA AND HERZEGOVINA',
|
103 |
+
'exponent' => '2'
|
104 |
+
),
|
105 |
+
'BBD' => array(
|
106 |
+
'name' => 'Barbados Dollar',
|
107 |
+
'code' => '052',
|
108 |
+
'country' => 'BARBADOS',
|
109 |
+
'exponent' => '2'
|
110 |
+
),
|
111 |
+
'BDT' => array(
|
112 |
+
'name' => 'Taka',
|
113 |
+
'code' => '050',
|
114 |
+
'country' => 'BANGLADESH',
|
115 |
+
'exponent' => '2'
|
116 |
+
),
|
117 |
+
'BGN' => array(
|
118 |
+
'name' => 'Bulgarian Lev',
|
119 |
+
'code' => '975',
|
120 |
+
'country' => 'BULGARIA',
|
121 |
+
'exponent' => '2'
|
122 |
+
),
|
123 |
+
'BHD' => array(
|
124 |
+
'name' => 'Bahraini Dinar',
|
125 |
+
'code' => '048',
|
126 |
+
'country' => 'BAHRAIN',
|
127 |
+
'exponent' => '3'
|
128 |
+
),
|
129 |
+
'BIF' => array(
|
130 |
+
'name' => 'Burundi Franc',
|
131 |
+
'code' => '108',
|
132 |
+
'country' => 'BURUNDI',
|
133 |
+
'exponent' => '0'
|
134 |
+
),
|
135 |
+
'BMD' => array(
|
136 |
+
'name' => 'Bermudian Dollar',
|
137 |
+
'code' => '060',
|
138 |
+
'country' => 'BERMUDA',
|
139 |
+
'exponent' => '2'
|
140 |
+
),
|
141 |
+
'BND' => array(
|
142 |
+
'name' => 'Brunei Dollar',
|
143 |
+
'code' => '096',
|
144 |
+
'country' => 'BRUNEI DARUSSALAM',
|
145 |
+
'exponent' => '2'
|
146 |
+
),
|
147 |
+
'BOB' => array(
|
148 |
+
'name' => 'Boliviano',
|
149 |
+
'code' => '068',
|
150 |
+
'country' => 'BOLIVIA (PLURINATIONAL STATE OF)',
|
151 |
+
'exponent' => '2'
|
152 |
+
),
|
153 |
+
'BOV' => array(
|
154 |
+
'name' => 'Mvdol',
|
155 |
+
'code' => '984',
|
156 |
+
'country' => 'BOLIVIA (PLURINATIONAL STATE OF)',
|
157 |
+
'exponent' => '2'
|
158 |
+
),
|
159 |
+
'BRL' => array(
|
160 |
+
'name' => 'Brazilian Real',
|
161 |
+
'code' => '986',
|
162 |
+
'country' => 'BRAZIL',
|
163 |
+
'exponent' => '2'
|
164 |
+
),
|
165 |
+
'BSD' => array(
|
166 |
+
'name' => 'Bahamian Dollar',
|
167 |
+
'code' => '044',
|
168 |
+
'country' => 'BAHAMAS (THE)',
|
169 |
+
'exponent' => '2'
|
170 |
+
),
|
171 |
+
'BTN' => array(
|
172 |
+
'name' => 'Ngultrum',
|
173 |
+
'code' => '064',
|
174 |
+
'country' => 'BHUTAN',
|
175 |
+
'exponent' => '2'
|
176 |
+
),
|
177 |
+
'BWP' => array(
|
178 |
+
'name' => 'Pula',
|
179 |
+
'code' => '072',
|
180 |
+
'country' => 'BOTSWANA',
|
181 |
+
'exponent' => '2'
|
182 |
+
),
|
183 |
+
'BYR' => array(
|
184 |
+
'name' => 'Belarussian Ruble',
|
185 |
+
'code' => '974',
|
186 |
+
'country' => 'BELARUS',
|
187 |
+
'exponent' => '0'
|
188 |
+
),
|
189 |
+
'BZD' => array(
|
190 |
+
'name' => 'Belize Dollar',
|
191 |
+
'code' => '084',
|
192 |
+
'country' => 'BELIZE',
|
193 |
+
'exponent' => '2'
|
194 |
+
),
|
195 |
+
'CAD' => array(
|
196 |
+
'name' => 'Canadian Dollar',
|
197 |
+
'code' => '124',
|
198 |
+
'country' => 'CANADA',
|
199 |
+
'exponent' => '2'
|
200 |
+
),
|
201 |
+
'CDF' => array(
|
202 |
+
'name' => 'Congolese Franc',
|
203 |
+
'code' => '976',
|
204 |
+
'country' => 'CONGO (THE DEMOCRATIC REPUBLIC OF THE)',
|
205 |
+
'exponent' => '2'
|
206 |
+
),
|
207 |
+
'CHE' => array(
|
208 |
+
'name' => 'WIR Euro',
|
209 |
+
'code' => '947',
|
210 |
+
'country' => 'SWITZERLAND',
|
211 |
+
'exponent' => '2'
|
212 |
+
),
|
213 |
+
'CHF' => array(
|
214 |
+
'name' => 'Swiss Franc',
|
215 |
+
'code' => '756',
|
216 |
+
'country' => 'SWITZERLAND',
|
217 |
+
'exponent' => '2'
|
218 |
+
),
|
219 |
+
'CHW' => array(
|
220 |
+
'name' => 'WIR Franc',
|
221 |
+
'code' => '948',
|
222 |
+
'country' => 'SWITZERLAND',
|
223 |
+
'exponent' => '2'
|
224 |
+
),
|
225 |
+
'CLF' => array(
|
226 |
+
'name' => 'Unidad de Fomento',
|
227 |
+
'code' => '990',
|
228 |
+
'country' => 'CHILE',
|
229 |
+
'exponent' => '4'
|
230 |
+
),
|
231 |
+
'CLP' => array(
|
232 |
+
'name' => 'Chilean Peso',
|
233 |
+
'code' => '152',
|
234 |
+
'country' => 'CHILE',
|
235 |
+
'exponent' => '0'
|
236 |
+
),
|
237 |
+
'CNY' => array(
|
238 |
+
'name' => 'Yuan Renminbi',
|
239 |
+
'code' => '156',
|
240 |
+
'country' => 'CHINA',
|
241 |
+
'exponent' => '2'
|
242 |
+
),
|
243 |
+
'COP' => array(
|
244 |
+
'name' => 'Colombian Peso',
|
245 |
+
'code' => '170',
|
246 |
+
'country' => 'COLOMBIA',
|
247 |
+
'exponent' => '2'
|
248 |
+
),
|
249 |
+
'COU' => array(
|
250 |
+
'name' => 'Unidad de Valor Real',
|
251 |
+
'code' => '970',
|
252 |
+
'country' => 'COLOMBIA',
|
253 |
+
'exponent' => '2'
|
254 |
+
),
|
255 |
+
'CRC' => array(
|
256 |
+
'name' => 'Costa Rican Colon',
|
257 |
+
'code' => '188',
|
258 |
+
'country' => 'COSTA RICA',
|
259 |
+
'exponent' => '2'
|
260 |
+
),
|
261 |
+
'CUC' => array(
|
262 |
+
'name' => 'Peso Convertible',
|
263 |
+
'code' => '931',
|
264 |
+
'country' => 'CUBA',
|
265 |
+
'exponent' => '2'
|
266 |
+
),
|
267 |
+
'CUP' => array(
|
268 |
+
'name' => 'Cuban Peso',
|
269 |
+
'code' => '192',
|
270 |
+
'country' => 'CUBA',
|
271 |
+
'exponent' => '2'
|
272 |
+
),
|
273 |
+
'CVE' => array(
|
274 |
+
'name' => 'Cabo Verde Escudo',
|
275 |
+
'code' => '132',
|
276 |
+
'country' => 'CABO VERDE',
|
277 |
+
'exponent' => '2'
|
278 |
+
),
|
279 |
+
'CZK' => array(
|
280 |
+
'name' => 'Czech Koruna',
|
281 |
+
'code' => '203',
|
282 |
+
'country' => 'CZECH REPUBLIC (THE)',
|
283 |
+
'exponent' => '2'
|
284 |
+
),
|
285 |
+
'DJF' => array(
|
286 |
+
'name' => 'Djibouti Franc',
|
287 |
+
'code' => '262',
|
288 |
+
'country' => 'DJIBOUTI',
|
289 |
+
'exponent' => '0'
|
290 |
+
),
|
291 |
+
'DKK' => array(
|
292 |
+
'name' => 'Danish Krone',
|
293 |
+
'code' => '208',
|
294 |
+
'country' => 'GREENLAND',
|
295 |
+
'exponent' => '2'
|
296 |
+
),
|
297 |
+
'DOP' => array(
|
298 |
+
'name' => 'Dominican Peso',
|
299 |
+
'code' => '214',
|
300 |
+
'country' => 'DOMINICAN REPUBLIC (THE)',
|
301 |
+
'exponent' => '2'
|
302 |
+
),
|
303 |
+
'DZD' => array(
|
304 |
+
'name' => 'Algerian Dinar',
|
305 |
+
'code' => '012',
|
306 |
+
'country' => 'ALGERIA',
|
307 |
+
'exponent' => '2'
|
308 |
+
),
|
309 |
+
'EGP' => array(
|
310 |
+
'name' => 'Egyptian Pound',
|
311 |
+
'code' => '818',
|
312 |
+
'country' => 'EGYPT',
|
313 |
+
'exponent' => '2'
|
314 |
+
),
|
315 |
+
'ERN' => array(
|
316 |
+
'name' => 'Nakfa',
|
317 |
+
'code' => '232',
|
318 |
+
'country' => 'ERITREA',
|
319 |
+
'exponent' => '2'
|
320 |
+
),
|
321 |
+
'ETB' => array(
|
322 |
+
'name' => 'Ethiopian Birr',
|
323 |
+
'code' => '230',
|
324 |
+
'country' => 'ETHIOPIA',
|
325 |
+
'exponent' => '2'
|
326 |
+
),
|
327 |
+
'EUR' => array(
|
328 |
+
'name' => 'Euro',
|
329 |
+
'code' => '978',
|
330 |
+
'country' => 'SPAIN',
|
331 |
+
'exponent' => '2'
|
332 |
+
),
|
333 |
+
'FJD' => array(
|
334 |
+
'name' => 'Fiji Dollar',
|
335 |
+
'code' => '242',
|
336 |
+
'country' => 'FIJI',
|
337 |
+
'exponent' => '2'
|
338 |
+
),
|
339 |
+
'FKP' => array(
|
340 |
+
'name' => 'Falkland Islands Pound',
|
341 |
+
'code' => '238',
|
342 |
+
'country' => 'FALKLAND ISLANDS (THE) [MALVINAS]',
|
343 |
+
'exponent' => '2'
|
344 |
+
),
|
345 |
+
'GBP' => array(
|
346 |
+
'name' => 'Pound Sterling',
|
347 |
+
'code' => '826',
|
348 |
+
'country' => 'UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND (THE)',
|
349 |
+
'exponent' => '2'
|
350 |
+
),
|
351 |
+
'GEL' => array(
|
352 |
+
'name' => 'Lari',
|
353 |
+
'code' => '981',
|
354 |
+
'country' => 'GEORGIA',
|
355 |
+
'exponent' => '2'
|
356 |
+
),
|
357 |
+
'GHS' => array(
|
358 |
+
'name' => 'Ghana Cedi',
|
359 |
+
'code' => '936',
|
360 |
+
'country' => 'GHANA',
|
361 |
+
'exponent' => '2'
|
362 |
+
),
|
363 |
+
'GIP' => array(
|
364 |
+
'name' => 'Gibraltar Pound',
|
365 |
+
'code' => '292',
|
366 |
+
'country' => 'GIBRALTAR',
|
367 |
+
'exponent' => '2'
|
368 |
+
),
|
369 |
+
'GMD' => array(
|
370 |
+
'name' => 'Dalasi',
|
371 |
+
'code' => '270',
|
372 |
+
'country' => 'GAMBIA (THE)',
|
373 |
+
'exponent' => '2'
|
374 |
+
),
|
375 |
+
'GNF' => array(
|
376 |
+
'name' => 'Guinea Franc',
|
377 |
+
'code' => '324',
|
378 |
+
'country' => 'GUINEA',
|
379 |
+
'exponent' => '0'
|
380 |
+
),
|
381 |
+
'GTQ' => array(
|
382 |
+
'name' => 'Quetzal',
|
383 |
+
'code' => '320',
|
384 |
+
'country' => 'GUATEMALA',
|
385 |
+
'exponent' => '2'
|
386 |
+
),
|
387 |
+
'GYD' => array(
|
388 |
+
'name' => 'Guyana Dollar',
|
389 |
+
'code' => '328',
|
390 |
+
'country' => 'GUYANA',
|
391 |
+
'exponent' => '2'
|
392 |
+
),
|
393 |
+
'HKD' => array(
|
394 |
+
'name' => 'Hong Kong Dollar',
|
395 |
+
'code' => '344',
|
396 |
+
'country' => 'HONG KONG',
|
397 |
+
'exponent' => '2'
|
398 |
+
),
|
399 |
+
'HNL' => array(
|
400 |
+
'name' => 'Lempira',
|
401 |
+
'code' => '340',
|
402 |
+
'country' => 'HONDURAS',
|
403 |
+
'exponent' => '2'
|
404 |
+
),
|
405 |
+
'HRK' => array(
|
406 |
+
'name' => 'Kuna',
|
407 |
+
'code' => '191',
|
408 |
+
'country' => 'CROATIA',
|
409 |
+
'exponent' => '2'
|
410 |
+
),
|
411 |
+
'HTG' => array(
|
412 |
+
'name' => 'Gourde',
|
413 |
+
'code' => '332',
|
414 |
+
'country' => 'HAITI',
|
415 |
+
'exponent' => '2'
|
416 |
+
),
|
417 |
+
'HUF' => array(
|
418 |
+
'name' => 'Forint',
|
419 |
+
'code' => '348',
|
420 |
+
'country' => 'HUNGARY',
|
421 |
+
'exponent' => '2'
|
422 |
+
),
|
423 |
+
'IDR' => array(
|
424 |
+
'name' => 'Rupiah',
|
425 |
+
'code' => '360',
|
426 |
+
'country' => 'INDONESIA',
|
427 |
+
'exponent' => '2'
|
428 |
+
),
|
429 |
+
'ILS' => array(
|
430 |
+
'name' => 'New Israeli Sheqel',
|
431 |
+
'code' => '376',
|
432 |
+
'country' => 'ISRAEL',
|
433 |
+
'exponent' => '2'
|
434 |
+
),
|
435 |
+
'INR' => array(
|
436 |
+
'name' => 'Indian Rupee',
|
437 |
+
'code' => '356',
|
438 |
+
'country' => 'INDIA',
|
439 |
+
'exponent' => '2'
|
440 |
+
),
|
441 |
+
'IQD' => array(
|
442 |
+
'name' => 'Iraqi Dinar',
|
443 |
+
'code' => '368',
|
444 |
+
'country' => 'IRAQ',
|
445 |
+
'exponent' => '3'
|
446 |
+
),
|
447 |
+
'IRR' => array(
|
448 |
+
'name' => 'Iranian Rial',
|
449 |
+
'code' => '364',
|
450 |
+
'country' => 'IRAN (ISLAMIC REPUBLIC OF)',
|
451 |
+
'exponent' => '2'
|
452 |
+
),
|
453 |
+
'ISK' => array(
|
454 |
+
'name' => 'Iceland Krona',
|
455 |
+
'code' => '352',
|
456 |
+
'country' => 'ICELAND',
|
457 |
+
'exponent' => '0'
|
458 |
+
),
|
459 |
+
'JMD' => array(
|
460 |
+
'name' => 'Jamaican Dollar',
|
461 |
+
'code' => '388',
|
462 |
+
'country' => 'JAMAICA',
|
463 |
+
'exponent' => '2'
|
464 |
+
),
|
465 |
+
'JOD' => array(
|
466 |
+
'name' => 'Jordanian Dinar',
|
467 |
+
'code' => '400',
|
468 |
+
'country' => 'JORDAN',
|
469 |
+
'exponent' => '3'
|
470 |
+
),
|
471 |
+
'JPY' => array(
|
472 |
+
'name' => 'Yen',
|
473 |
+
'code' => '392',
|
474 |
+
'country' => 'JAPAN',
|
475 |
+
'exponent' => '0'
|
476 |
+
),
|
477 |
+
'KES' => array(
|
478 |
+
'name' => 'Kenyan Shilling',
|
479 |
+
'code' => '404',
|
480 |
+
'country' => 'KENYA',
|
481 |
+
'exponent' => '2'
|
482 |
+
),
|
483 |
+
'KGS' => array(
|
484 |
+
'name' => 'Som',
|
485 |
+
'code' => '417',
|
486 |
+
'country' => 'KYRGYZSTAN',
|
487 |
+
'exponent' => '2'
|
488 |
+
),
|
489 |
+
'KHR' => array(
|
490 |
+
'name' => 'Riel',
|
491 |
+
'code' => '116',
|
492 |
+
'country' => 'CAMBODIA',
|
493 |
+
'exponent' => '2'
|
494 |
+
),
|
495 |
+
'KMF' => array(
|
496 |
+
'name' => 'Comoro Franc',
|
497 |
+
'code' => '174',
|
498 |
+
'country' => 'COMOROS (THE)',
|
499 |
+
'exponent' => '0'
|
500 |
+
),
|
501 |
+
'KPW' => array(
|
502 |
+
'name' => 'North Korean Won',
|
503 |
+
'code' => '408',
|
504 |
+
'country' => 'KOREA (THE DEMOCRATIC PEOPLE’S REPUBLIC OF)',
|
505 |
+
'exponent' => '2'
|
506 |
+
),
|
507 |
+
'KRW' => array(
|
508 |
+
'name' => 'Won',
|
509 |
+
'code' => '410',
|
510 |
+
'country' => 'KOREA (THE REPUBLIC OF)',
|
511 |
+
'exponent' => '0'
|
512 |
+
),
|
513 |
+
'KWD' => array(
|
514 |
+
'name' => 'Kuwaiti Dinar',
|
515 |
+
'code' => '414',
|
516 |
+
'country' => 'KUWAIT',
|
517 |
+
'exponent' => '3'
|
518 |
+
),
|
519 |
+
'KYD' => array(
|
520 |
+
'name' => 'Cayman Islands Dollar',
|
521 |
+
'code' => '136',
|
522 |
+
'country' => 'CAYMAN ISLANDS (THE)',
|
523 |
+
'exponent' => '2'
|
524 |
+
),
|
525 |
+
'KZT' => array(
|
526 |
+
'name' => 'Tenge',
|
527 |
+
'code' => '398',
|
528 |
+
'country' => 'KAZAKHSTAN',
|
529 |
+
'exponent' => '2'
|
530 |
+
),
|
531 |
+
'LAK' => array(
|
532 |
+
'name' => 'Kip',
|
533 |
+
'code' => '418',
|
534 |
+
'country' => 'LAO PEOPLE’S DEMOCRATIC REPUBLIC (THE)',
|
535 |
+
'exponent' => '2'
|
536 |
+
),
|
537 |
+
'LBP' => array(
|
538 |
+
'name' => 'Lebanese Pound',
|
539 |
+
'code' => '422',
|
540 |
+
'country' => 'LEBANON',
|
541 |
+
'exponent' => '2'
|
542 |
+
),
|
543 |
+
'LKR' => array(
|
544 |
+
'name' => 'Sri Lanka Rupee',
|
545 |
+
'code' => '144',
|
546 |
+
'country' => 'SRI LANKA',
|
547 |
+
'exponent' => '2'
|
548 |
+
),
|
549 |
+
'LRD' => array(
|
550 |
+
'name' => 'Liberian Dollar',
|
551 |
+
'code' => '430',
|
552 |
+
'country' => 'LIBERIA',
|
553 |
+
'exponent' => '2'
|
554 |
+
),
|
555 |
+
'LSL' => array(
|
556 |
+
'name' => 'Loti',
|
557 |
+
'code' => '426',
|
558 |
+
'country' => 'LESOTHO',
|
559 |
+
'exponent' => '2'
|
560 |
+
),
|
561 |
+
'LYD' => array(
|
562 |
+
'name' => 'Libyan Dinar',
|
563 |
+
'code' => '434',
|
564 |
+
'country' => 'LIBYA',
|
565 |
+
'exponent' => '3'
|
566 |
+
),
|
567 |
+
'MAD' => array(
|
568 |
+
'name' => 'Moroccan Dirham',
|
569 |
+
'code' => '504',
|
570 |
+
'country' => 'WESTERN SAHARA',
|
571 |
+
'exponent' => '2'
|
572 |
+
),
|
573 |
+
'MDL' => array(
|
574 |
+
'name' => 'Moldovan Leu',
|
575 |
+
'code' => '498',
|
576 |
+
'country' => 'MOLDOVA (THE REPUBLIC OF)',
|
577 |
+
'exponent' => '2'
|
578 |
+
),
|
579 |
+
'MGA' => array(
|
580 |
+
'name' => 'Malagasy Ariary',
|
581 |
+
'code' => '969',
|
582 |
+
'country' => 'MADAGASCAR',
|
583 |
+
'exponent' => '2'
|
584 |
+
),
|
585 |
+
'MKD' => array(
|
586 |
+
'name' => 'Denar',
|
587 |
+
'code' => '807',
|
588 |
+
'country' => 'MACEDONIA (THE FORMER YUGOSLAV REPUBLIC OF)',
|
589 |
+
'exponent' => '2'
|
590 |
+
),
|
591 |
+
'MMK' => array(
|
592 |
+
'name' => 'Kyat',
|
593 |
+
'code' => '104',
|
594 |
+
'country' => 'MYANMAR',
|
595 |
+
'exponent' => '2'
|
596 |
+
),
|
597 |
+
'MNT' => array(
|
598 |
+
'name' => 'Tugrik',
|
599 |
+
'code' => '496',
|
600 |
+
'country' => 'MONGOLIA',
|
601 |
+
'exponent' => '2'
|
602 |
+
),
|
603 |
+
'MOP' => array(
|
604 |
+
'name' => 'Pataca',
|
605 |
+
'code' => '446',
|
606 |
+
'country' => 'MACAO',
|
607 |
+
'exponent' => '2'
|
608 |
+
),
|
609 |
+
'MRO' => array(
|
610 |
+
'name' => 'Ouguiya',
|
611 |
+
'code' => '478',
|
612 |
+
'country' => 'MAURITANIA',
|
613 |
+
'exponent' => '2'
|
614 |
+
),
|
615 |
+
'MUR' => array(
|
616 |
+
'name' => 'Mauritius Rupee',
|
617 |
+
'code' => '480',
|
618 |
+
'country' => 'MAURITIUS',
|
619 |
+
'exponent' => '2'
|
620 |
+
),
|
621 |
+
'MVR' => array(
|
622 |
+
'name' => 'Rufiyaa',
|
623 |
+
'code' => '462',
|
624 |
+
'country' => 'MALDIVES',
|
625 |
+
'exponent' => '2'
|
626 |
+
),
|
627 |
+
'MWK' => array(
|
628 |
+
'name' => 'Kwacha',
|
629 |
+
'code' => '454',
|
630 |
+
'country' => 'MALAWI',
|
631 |
+
'exponent' => '2'
|
632 |
+
),
|
633 |
+
'MXN' => array(
|
634 |
+
'name' => 'Mexican Peso',
|
635 |
+
'code' => '484',
|
636 |
+
'country' => 'MEXICO',
|
637 |
+
'exponent' => '2'
|
638 |
+
),
|
639 |
+
'MXV' => array(
|
640 |
+
'name' => 'Mexican Unidad de Inversion (UDI)',
|
641 |
+
'code' => '979',
|
642 |
+
'country' => 'MEXICO',
|
643 |
+
'exponent' => '2'
|
644 |
+
),
|
645 |
+
'MYR' => array(
|
646 |
+
'name' => 'Malaysian Ringgit',
|
647 |
+
'code' => '458',
|
648 |
+
'country' => 'MALAYSIA',
|
649 |
+
'exponent' => '2'
|
650 |
+
),
|
651 |
+
'MZN' => array(
|
652 |
+
'name' => 'Mozambique Metical',
|
653 |
+
'code' => '943',
|
654 |
+
'country' => 'MOZAMBIQUE',
|
655 |
+
'exponent' => '2'
|
656 |
+
),
|
657 |
+
'NAD' => array(
|
658 |
+
'name' => 'Namibia Dollar',
|
659 |
+
'code' => '516',
|
660 |
+
'country' => 'NAMIBIA',
|
661 |
+
'exponent' => '2'
|
662 |
+
),
|
663 |
+
'NGN' => array(
|
664 |
+
'name' => 'Naira',
|
665 |
+
'code' => '566',
|
666 |
+
'country' => 'NIGERIA',
|
667 |
+
'exponent' => '2'
|
668 |
+
),
|
669 |
+
'NIO' => array(
|
670 |
+
'name' => 'Cordoba Oro',
|
671 |
+
'code' => '558',
|
672 |
+
'country' => 'NICARAGUA',
|
673 |
+
'exponent' => '2'
|
674 |
+
),
|
675 |
+
'NOK' => array(
|
676 |
+
'name' => 'Norwegian Krone',
|
677 |
+
'code' => '578',
|
678 |
+
'country' => 'SVALBARD AND JAN MAYEN',
|
679 |
+
'exponent' => '2'
|
680 |
+
),
|
681 |
+
'NPR' => array(
|
682 |
+
'name' => 'Nepalese Rupee',
|
683 |
+
'code' => '524',
|
684 |
+
'country' => 'NEPAL',
|
685 |
+
'exponent' => '2'
|
686 |
+
),
|
687 |
+
'NZD' => array(
|
688 |
+
'name' => 'New Zealand Dollar',
|
689 |
+
'code' => '554',
|
690 |
+
'country' => 'TOKELAU',
|
691 |
+
'exponent' => '2'
|
692 |
+
),
|
693 |
+
'OMR' => array(
|
694 |
+
'name' => 'Rial Omani',
|
695 |
+
'code' => '512',
|
696 |
+
'country' => 'OMAN',
|
697 |
+
'exponent' => '3'
|
698 |
+
),
|
699 |
+
'PAB' => array(
|
700 |
+
'name' => 'Balboa',
|
701 |
+
'code' => '590',
|
702 |
+
'country' => 'PANAMA',
|
703 |
+
'exponent' => '2'
|
704 |
+
),
|
705 |
+
'PEN' => array(
|
706 |
+
'name' => 'Nuevo Sol',
|
707 |
+
'code' => '604',
|
708 |
+
'country' => 'PERU',
|
709 |
+
'exponent' => '2'
|
710 |
+
),
|
711 |
+
'PGK' => array(
|
712 |
+
'name' => 'Kina',
|
713 |
+
'code' => '598',
|
714 |
+
'country' => 'PAPUA NEW GUINEA',
|
715 |
+
'exponent' => '2'
|
716 |
+
),
|
717 |
+
'PHP' => array(
|
718 |
+
'name' => 'Philippine Peso',
|
719 |
+
'code' => '608',
|
720 |
+
'country' => 'PHILIPPINES (THE)',
|
721 |
+
'exponent' => '2'
|
722 |
+
),
|
723 |
+
'PKR' => array(
|
724 |
+
'name' => 'Pakistan Rupee',
|
725 |
+
'code' => '586',
|
726 |
+
'country' => 'PAKISTAN',
|
727 |
+
'exponent' => '2'
|
728 |
+
),
|
729 |
+
'PLN' => array(
|
730 |
+
'name' => 'Zloty',
|
731 |
+
'code' => '985',
|
732 |
+
'country' => 'POLAND',
|
733 |
+
'exponent' => '2'
|
734 |
+
),
|
735 |
+
'PYG' => array(
|
736 |
+
'name' => 'Guarani',
|
737 |
+
'code' => '600',
|
738 |
+
'country' => 'PARAGUAY',
|
739 |
+
'exponent' => '0'
|
740 |
+
),
|
741 |
+
'QAR' => array(
|
742 |
+
'name' => 'Qatari Rial',
|
743 |
+
'code' => '634',
|
744 |
+
'country' => 'QATAR',
|
745 |
+
'exponent' => '2'
|
746 |
+
),
|
747 |
+
'RON' => array(
|
748 |
+
'name' => 'Romanian Leu',
|
749 |
+
'code' => '946',
|
750 |
+
'country' => 'ROMANIA',
|
751 |
+
'exponent' => '2'
|
752 |
+
),
|
753 |
+
'RSD' => array(
|
754 |
+
'name' => 'Serbian Dinar',
|
755 |
+
'code' => '941',
|
756 |
+
'country' => 'SERBIA',
|
757 |
+
'exponent' => '2'
|
758 |
+
),
|
759 |
+
'RUB' => array(
|
760 |
+
'name' => 'Russian Ruble',
|
761 |
+
'code' => '643',
|
762 |
+
'country' => 'RUSSIAN FEDERATION (THE)',
|
763 |
+
'exponent' => '2'
|
764 |
+
),
|
765 |
+
'RWF' => array(
|
766 |
+
'name' => 'Rwanda Franc',
|
767 |
+
'code' => '646',
|
768 |
+
'country' => 'RWANDA',
|
769 |
+
'exponent' => '0'
|
770 |
+
),
|
771 |
+
'SAR' => array(
|
772 |
+
'name' => 'Saudi Riyal',
|
773 |
+
'code' => '682',
|
774 |
+
'country' => 'SAUDI ARABIA',
|
775 |
+
'exponent' => '2'
|
776 |
+
),
|
777 |
+
'SBD' => array(
|
778 |
+
'name' => 'Solomon Islands Dollar',
|
779 |
+
'code' => '090',
|
780 |
+
'country' => 'SOLOMON ISLANDS',
|
781 |
+
'exponent' => '2'
|
782 |
+
),
|
783 |
+
'SCR' => array(
|
784 |
+
'name' => 'Seychelles Rupee',
|
785 |
+
'code' => '690',
|
786 |
+
'country' => 'SEYCHELLES',
|
787 |
+
'exponent' => '2'
|
788 |
+
),
|
789 |
+
'SDG' => array(
|
790 |
+
'name' => 'Sudanese Pound',
|
791 |
+
'code' => '938',
|
792 |
+
'country' => 'SUDAN (THE)',
|
793 |
+
'exponent' => '2'
|
794 |
+
),
|
795 |
+
'SEK' => array(
|
796 |
+
'name' => 'Swedish Krona',
|
797 |
+
'code' => '752',
|
798 |
+
'country' => 'SWEDEN',
|
799 |
+
'exponent' => '2'
|
800 |
+
),
|
801 |
+
'SGD' => array(
|
802 |
+
'name' => 'Singapore Dollar',
|
803 |
+
'code' => '702',
|
804 |
+
'country' => 'SINGAPORE',
|
805 |
+
'exponent' => '2'
|
806 |
+
),
|
807 |
+
'SHP' => array(
|
808 |
+
'name' => 'Saint Helena Pound',
|
809 |
+
'code' => '654',
|
810 |
+
'country' => 'SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA',
|
811 |
+
'exponent' => '2'
|
812 |
+
),
|
813 |
+
'SLL' => array(
|
814 |
+
'name' => 'Leone',
|
815 |
+
'code' => '694',
|
816 |
+
'country' => 'SIERRA LEONE',
|
817 |
+
'exponent' => '2'
|
818 |
+
),
|
819 |
+
'SOS' => array(
|
820 |
+
'name' => 'Somali Shilling',
|
821 |
+
'code' => '706',
|
822 |
+
'country' => 'SOMALIA',
|
823 |
+
'exponent' => '2'
|
824 |
+
),
|
825 |
+
'SRD' => array(
|
826 |
+
'name' => 'Surinam Dollar',
|
827 |
+
'code' => '968',
|
828 |
+
'country' => 'SURINAME',
|
829 |
+
'exponent' => '2'
|
830 |
+
),
|
831 |
+
'SSP' => array(
|
832 |
+
'name' => 'South Sudanese Pound',
|
833 |
+
'code' => '728',
|
834 |
+
'country' => 'SOUTH SUDAN',
|
835 |
+
'exponent' => '2'
|
836 |
+
),
|
837 |
+
'STD' => array(
|
838 |
+
'name' => 'Dobra',
|
839 |
+
'code' => '678',
|
840 |
+
'country' => 'SAO TOME AND PRINCIPE',
|
841 |
+
'exponent' => '2'
|
842 |
+
),
|
843 |
+
'SVC' => array(
|
844 |
+
'name' => 'El Salvador Colon',
|
845 |
+
'code' => '222',
|
846 |
+
'country' => 'EL SALVADOR',
|
847 |
+
'exponent' => '2'
|
848 |
+
),
|
849 |
+
'SYP' => array(
|
850 |
+
'name' => 'Syrian Pound',
|
851 |
+
'code' => '760',
|
852 |
+
'country' => 'SYRIAN ARAB REPUBLIC',
|
853 |
+
'exponent' => '2'
|
854 |
+
),
|
855 |
+
'SZL' => array(
|
856 |
+
'name' => 'Lilangeni',
|
857 |
+
'code' => '748',
|
858 |
+
'country' => 'SWAZILAND',
|
859 |
+
'exponent' => '2'
|
860 |
+
),
|
861 |
+
'THB' => array(
|
862 |
+
'name' => 'Baht',
|
863 |
+
'code' => '764',
|
864 |
+
'country' => 'THAILAND',
|
865 |
+
'exponent' => '2'
|
866 |
+
),
|
867 |
+
'TJS' => array(
|
868 |
+
'name' => 'Somoni',
|
869 |
+
'code' => '972',
|
870 |
+
'country' => 'TAJIKISTAN',
|
871 |
+
'exponent' => '2'
|
872 |
+
),
|
873 |
+
'TMT' => array(
|
874 |
+
'name' => 'Turkmenistan New Manat',
|
875 |
+
'code' => '934',
|
876 |
+
'country' => 'TURKMENISTAN',
|
877 |
+
'exponent' => '2'
|
878 |
+
),
|
879 |
+
'TND' => array(
|
880 |
+
'name' => 'Tunisian Dinar',
|
881 |
+
'code' => '788',
|
882 |
+
'country' => 'TUNISIA',
|
883 |
+
'exponent' => '3'
|
884 |
+
),
|
885 |
+
'TOP' => array(
|
886 |
+
'name' => 'Pa’anga',
|
887 |
+
'code' => '776',
|
888 |
+
'country' => 'TONGA',
|
889 |
+
'exponent' => '2'
|
890 |
+
),
|
891 |
+
'TRY' => array(
|
892 |
+
'name' => 'Turkish Lira',
|
893 |
+
'code' => '949',
|
894 |
+
'country' => 'TURKEY',
|
895 |
+
'exponent' => '2'
|
896 |
+
),
|
897 |
+
'TTD' => array(
|
898 |
+
'name' => 'Trinidad and Tobago Dollar',
|
899 |
+
'code' => '780',
|
900 |
+
'country' => 'TRINIDAD AND TOBAGO',
|
901 |
+
'exponent' => '2'
|
902 |
+
),
|
903 |
+
'TWD' => array(
|
904 |
+
'name' => 'New Taiwan Dollar',
|
905 |
+
'code' => '901',
|
906 |
+
'country' => 'TAIWAN (PROVINCE OF CHINA)',
|
907 |
+
'exponent' => '2'
|
908 |
+
),
|
909 |
+
'TZS' => array(
|
910 |
+
'name' => 'Tanzanian Shilling',
|
911 |
+
'code' => '834',
|
912 |
+
'country' => 'TANZANIA, UNITED REPUBLIC OF',
|
913 |
+
'exponent' => '2'
|
914 |
+
),
|
915 |
+
'UAH' => array(
|
916 |
+
'name' => 'Hryvnia',
|
917 |
+
'code' => '980',
|
918 |
+
'country' => 'UKRAINE',
|
919 |
+
'exponent' => '2'
|
920 |
+
),
|
921 |
+
'UGX' => array(
|
922 |
+
'name' => 'Uganda Shilling',
|
923 |
+
'code' => '800',
|
924 |
+
'country' => 'UGANDA',
|
925 |
+
'exponent' => '0'
|
926 |
+
),
|
927 |
+
'USD' => array(
|
928 |
+
'name' => 'US Dollar',
|
929 |
+
'code' => '840',
|
930 |
+
'country' => 'VIRGIN ISLANDS (U.S.)',
|
931 |
+
'exponent' => '2'
|
932 |
+
),
|
933 |
+
'USN' => array(
|
934 |
+
'name' => 'US Dollar (Next day)',
|
935 |
+
'code' => '997',
|
936 |
+
'country' => 'UNITED STATES OF AMERICA (THE)',
|
937 |
+
'exponent' => '2'
|
938 |
+
),
|
939 |
+
'UYI' => array(
|
940 |
+
'name' => 'Uruguay Peso en Unidades Indexadas (URUIURUI)',
|
941 |
+
'code' => '940',
|
942 |
+
'country' => 'URUGUAY',
|
943 |
+
'exponent' => '0'
|
944 |
+
),
|
945 |
+
'UYU' => array(
|
946 |
+
'name' => 'Peso Uruguayo',
|
947 |
+
'code' => '858',
|
948 |
+
'country' => 'URUGUAY',
|
949 |
+
'exponent' => '2'
|
950 |
+
),
|
951 |
+
'UZS' => array(
|
952 |
+
'name' => 'Uzbekistan Sum',
|
953 |
+
'code' => '860',
|
954 |
+
'country' => 'UZBEKISTAN',
|
955 |
+
'exponent' => '2'
|
956 |
+
),
|
957 |
+
'VEF' => array(
|
958 |
+
'name' => 'Bolivar',
|
959 |
+
'code' => '937',
|
960 |
+
'country' => 'VENEZUELA (BOLIVARIAN REPUBLIC OF)',
|
961 |
+
'exponent' => '2'
|
962 |
+
),
|
963 |
+
'VND' => array(
|
964 |
+
'name' => 'Dong',
|
965 |
+
'code' => '704',
|
966 |
+
'country' => 'VIET NAM',
|
967 |
+
'exponent' => '0'
|
968 |
+
),
|
969 |
+
'VUV' => array(
|
970 |
+
'name' => 'Vatu',
|
971 |
+
'code' => '548',
|
972 |
+
'country' => 'VANUATU',
|
973 |
+
'exponent' => '0'
|
974 |
+
),
|
975 |
+
'WST' => array(
|
976 |
+
'name' => 'Tala',
|
977 |
+
'code' => '882',
|
978 |
+
'country' => 'SAMOA',
|
979 |
+
'exponent' => '2'
|
980 |
+
),
|
981 |
+
'XAF' => array(
|
982 |
+
'name' => 'CFA Franc BEAC',
|
983 |
+
'code' => '950',
|
984 |
+
'country' => 'GABON',
|
985 |
+
'exponent' => '0'
|
986 |
+
),
|
987 |
+
'XAG' => array(
|
988 |
+
'name' => 'Silver',
|
989 |
+
'code' => '961',
|
990 |
+
'country' => 'ZZ11_Silver',
|
991 |
+
'exponent' => 'N.A.'
|
992 |
+
),
|
993 |
+
'XAU' => array(
|
994 |
+
'name' => 'Gold',
|
995 |
+
'code' => '959',
|
996 |
+
'country' => 'ZZ08_Gold',
|
997 |
+
'exponent' => 'N.A.'
|
998 |
+
),
|
999 |
+
'XBA' => array(
|
1000 |
+
'name' => 'Bond Markets Unit European Composite Unit (EURCO)',
|
1001 |
+
'code' => '955',
|
1002 |
+
'country' => 'ZZ01_Bond Markets Unit European_EURCO',
|
1003 |
+
'exponent' => 'N.A.'
|
1004 |
+
),
|
1005 |
+
'XBB' => array(
|
1006 |
+
'name' => 'Bond Markets Unit European Monetary Unit (E.M.U.-6)',
|
1007 |
+
'code' => '956',
|
1008 |
+
'country' => 'ZZ02_Bond Markets Unit European_EMU-6',
|
1009 |
+
'exponent' => 'N.A.'
|
1010 |
+
),
|
1011 |
+
'XBC' => array(
|
1012 |
+
'name' => 'Bond Markets Unit European Unit of Account 9 (E.U.A.-9)',
|
1013 |
+
'code' => '957',
|
1014 |
+
'country' => 'ZZ03_Bond Markets Unit European_EUA-9',
|
1015 |
+
'exponent' => 'N.A.'
|
1016 |
+
),
|
1017 |
+
'XBD' => array(
|
1018 |
+
'name' => 'Bond Markets Unit European Unit of Account 17 (E.U.A.-17)',
|
1019 |
+
'code' => '958',
|
1020 |
+
'country' => 'ZZ04_Bond Markets Unit European_EUA-17',
|
1021 |
+
'exponent' => 'N.A.'
|
1022 |
+
),
|
1023 |
+
'XCD' => array(
|
1024 |
+
'name' => 'East Caribbean Dollar',
|
1025 |
+
'code' => '951',
|
1026 |
+
'country' => 'SAINT VINCENT AND THE GRENADINES',
|
1027 |
+
'exponent' => '2'
|
1028 |
+
),
|
1029 |
+
'XDR' => array(
|
1030 |
+
'name' => 'SDR (Special Drawing Right)',
|
1031 |
+
'code' => '960',
|
1032 |
+
'country' => 'INTERNATIONAL MONETARY FUND (IMF)Â ',
|
1033 |
+
'exponent' => 'N.A.'
|
1034 |
+
),
|
1035 |
+
'XOF' => array(
|
1036 |
+
'name' => 'CFA Franc BCEAO',
|
1037 |
+
'code' => '952',
|
1038 |
+
'country' => 'TOGO',
|
1039 |
+
'exponent' => '0'
|
1040 |
+
),
|
1041 |
+
'XPD' => array(
|
1042 |
+
'name' => 'Palladium',
|
1043 |
+
'code' => '964',
|
1044 |
+
'country' => 'ZZ09_Palladium',
|
1045 |
+
'exponent' => 'N.A.'
|
1046 |
+
),
|
1047 |
+
'XPF' => array(
|
1048 |
+
'name' => 'CFP Franc',
|
1049 |
+
'code' => '953',
|
1050 |
+
'country' => 'WALLIS AND FUTUNA',
|
1051 |
+
'exponent' => '0'
|
1052 |
+
),
|
1053 |
+
'XPT' => array(
|
1054 |
+
'name' => 'Platinum',
|
1055 |
+
'code' => '962',
|
1056 |
+
'country' => 'ZZ10_Platinum',
|
1057 |
+
'exponent' => 'N.A.'
|
1058 |
+
),
|
1059 |
+
'XSU' => array(
|
1060 |
+
'name' => 'Sucre',
|
1061 |
+
'code' => '994',
|
1062 |
+
'country' => 'SISTEMA UNITARIO DE COMPENSACION REGIONAL DE PAGOS "SUCRE"',
|
1063 |
+
'exponent' => 'N.A.'
|
1064 |
+
),
|
1065 |
+
'XTS' => array(
|
1066 |
+
'name' => 'Codes specifically reserved for testing purposes',
|
1067 |
+
'code' => '963',
|
1068 |
+
'country' => 'ZZ06_Testing_Code',
|
1069 |
+
'exponent' => 'N.A.'
|
1070 |
+
),
|
1071 |
+
'XUA' => array(
|
1072 |
+
'name' => 'ADB Unit of Account',
|
1073 |
+
'code' => '965',
|
1074 |
+
'country' => 'MEMBER COUNTRIES OF THE AFRICAN DEVELOPMENT BANK GROUP',
|
1075 |
+
'exponent' => 'N.A.'
|
1076 |
+
),
|
1077 |
+
'XXX' => array(
|
1078 |
+
'name' => 'The codes assigned for transactions where no currency is involved',
|
1079 |
+
'code' => '999',
|
1080 |
+
'country' => 'ZZ07_No_Currency',
|
1081 |
+
'exponent' => 'N.A.'
|
1082 |
+
),
|
1083 |
+
'YER' => array(
|
1084 |
+
'name' => 'Yemeni Rial',
|
1085 |
+
'code' => '886',
|
1086 |
+
'country' => 'YEMEN',
|
1087 |
+
'exponent' => '2'
|
1088 |
+
),
|
1089 |
+
'ZAR' => array(
|
1090 |
+
'name' => 'Rand',
|
1091 |
+
'code' => '710',
|
1092 |
+
'country' => 'SOUTH AFRICA',
|
1093 |
+
'exponent' => '2'
|
1094 |
+
),
|
1095 |
+
'ZMW' => array(
|
1096 |
+
'name' => 'Zambian Kwacha',
|
1097 |
+
'code' => '967',
|
1098 |
+
'country' => 'ZAMBIA',
|
1099 |
+
'exponent' => '2'
|
1100 |
+
),
|
1101 |
+
'ZWL' => array(
|
1102 |
+
'name' => 'Zimbabwe Dollar',
|
1103 |
+
'code' => '932',
|
1104 |
+
'country' => 'ZIMBABWE',
|
1105 |
+
'exponent' => '2'
|
1106 |
+
),
|
1107 |
+
);
|
1108 |
+
|
1109 |
+
/**
|
1110 |
+
* Convert amount to ISO-4217 minor currency unit
|
1111 |
+
*
|
1112 |
+
* @param $amount - amount to convert
|
1113 |
+
* @param $iso - iso code of the currency
|
1114 |
+
*
|
1115 |
+
* @return mixed - using string as we don't want to cast it without knowing how much precision
|
1116 |
+
* is required
|
1117 |
+
*/
|
1118 |
+
public static function amountToExponent($amount, $iso)
|
1119 |
+
{
|
1120 |
+
$iso = strtoupper($iso);
|
1121 |
+
|
1122 |
+
if (array_key_exists($iso, self::$iso4217)) {
|
1123 |
+
$exp = intval(self::$iso4217[$iso]['exponent']);
|
1124 |
+
|
1125 |
+
if ($exp > 0) {
|
1126 |
+
return bcmul($amount, pow(10, $exp), 0);
|
1127 |
+
}
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
return strval($amount);
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
/**
|
1134 |
+
* Convert ISO-4217 minor currency unit to amount
|
1135 |
+
*
|
1136 |
+
* @param $amount - amount to convert
|
1137 |
+
* @param $iso - iso code of the currency
|
1138 |
+
*
|
1139 |
+
* @return string - using string as we don't want to cast it without knowing how much precision
|
1140 |
+
* is required
|
1141 |
+
*/
|
1142 |
+
public static function exponentToAmount($amount, $iso)
|
1143 |
+
{
|
1144 |
+
$iso = strtoupper($iso);
|
1145 |
+
|
1146 |
+
if (array_key_exists($iso, self::$iso4217)) {
|
1147 |
+
$exp = intval(self::$iso4217[$iso]['exponent']);
|
1148 |
+
|
1149 |
+
if ($exp > 0) {
|
1150 |
+
return bcdiv($amount, pow(10, $exp), $exp);
|
1151 |
+
}
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
return strval($amount);
|
1155 |
+
}
|
1156 |
+
}
|
lib/Genesis/src/Genesis/Utils/Requirements.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
namespace Genesis\Utils;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Check the system for dependencies
|
27 |
+
*
|
28 |
+
* @package Genesis\Utils
|
29 |
+
*/
|
30 |
+
final class Requirements
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Check if the current system fulfils the project's dependencies
|
34 |
+
*
|
35 |
+
* @throws \Exception
|
36 |
+
*/
|
37 |
+
public static function verify()
|
38 |
+
{
|
39 |
+
// PHP interpreter version
|
40 |
+
self::checkSystemVersion();
|
41 |
+
|
42 |
+
// BCMath
|
43 |
+
self::isFunctionExists('bcmul', self::getErrorMessage('bcmath'));
|
44 |
+
self::isFunctionExists('bcdiv', self::getErrorMessage('bcmath'));
|
45 |
+
|
46 |
+
// Filter
|
47 |
+
self::isFunctionExists('filter_var', self::getErrorMessage('filter'));
|
48 |
+
|
49 |
+
// Hash
|
50 |
+
self::isFunctionExists('hash', self::getErrorMessage('hash'));
|
51 |
+
|
52 |
+
// XMLReader
|
53 |
+
self::isClassExists('XMLReader', self::getErrorMessage('xmlreader'));
|
54 |
+
|
55 |
+
// XMLWriter
|
56 |
+
if (\Genesis\Config::getInterface('builder') == 'xml') {
|
57 |
+
self::isClassExists('XMLWriter', self::getErrorMessage('xmlwriter'));
|
58 |
+
}
|
59 |
+
|
60 |
+
// cURL
|
61 |
+
if (\Genesis\Config::getInterface('network') == 'curl') {
|
62 |
+
self::isFunctionExists('curl_init', self::getErrorMessage('curl'));
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Check the PHP interpreter version we're currently running
|
68 |
+
*
|
69 |
+
* @throws \Exception
|
70 |
+
*/
|
71 |
+
public static function checkSystemVersion()
|
72 |
+
{
|
73 |
+
if (\Genesis\Utils\Common::compareVersions('5.3.2', '<')) {
|
74 |
+
throw new \Exception(self::getErrorMessage('system'));
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Check if function (passed by arg) exists
|
80 |
+
*
|
81 |
+
* @param $function
|
82 |
+
* @param $error
|
83 |
+
* @throws \Exception
|
84 |
+
*/
|
85 |
+
public static function isFunctionExists($function, $error)
|
86 |
+
{
|
87 |
+
if (!function_exists($function)) {
|
88 |
+
throw new \Exception($error);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Check if method exists in a given class
|
94 |
+
*
|
95 |
+
* @param string $method - Method name to check for
|
96 |
+
* @param string $class - Class to test against
|
97 |
+
* @param string $error - Error message to display
|
98 |
+
* @throws \Exception
|
99 |
+
*/
|
100 |
+
public static function isMethodExists($method, $class, $error)
|
101 |
+
{
|
102 |
+
if (!method_exists($method, $class)) {
|
103 |
+
throw new \Exception($error);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Check if class (passed by arg) exists
|
109 |
+
*
|
110 |
+
* @param $class
|
111 |
+
* @param $error
|
112 |
+
* @throws \Exception
|
113 |
+
*/
|
114 |
+
public static function isClassExists($class, $error)
|
115 |
+
{
|
116 |
+
if (!class_exists($class)) {
|
117 |
+
throw new \Exception($error);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Get error message for certain type
|
123 |
+
*
|
124 |
+
* @param string $name
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
public static function getErrorMessage($name)
|
128 |
+
{
|
129 |
+
$messages = array(
|
130 |
+
'system' => 'Unsupported PHP version, please upgrade!' . PHP_EOL .
|
131 |
+
'This library requires PHP version 5.3.2 or newer.',
|
132 |
+
'bcmath' => 'BCMath extension is required!' . PHP_EOL .
|
133 |
+
'Please install the extension or rebuild with "--enable-bcmath" option.',
|
134 |
+
'filter' => 'Filter extensions is required!' . PHP_EOL .
|
135 |
+
'Please install the extension or rebuild with "--enable-filter" option.',
|
136 |
+
'hash' => 'Hash extension is required!' . PHP_EOL .
|
137 |
+
'Please install the extension or rebuild with "--enable-hash" option.',
|
138 |
+
'xmlreader' => 'XMLReader extension is required!' . PHP_EOL .
|
139 |
+
'Please install the extension or rebuild with "--enable-xmlreader" option.',
|
140 |
+
'xmlwriter' => 'XMLWriter extension is required!' . PHP_EOL .
|
141 |
+
'Please install the extension or rebuild with "--enable-xmlwriter" option.',
|
142 |
+
'curl' => 'cURL interface is selected, but its not installed on your system!' . PHP_EOL .
|
143 |
+
'Please install the extension or select "stream" as your network interface.'
|
144 |
+
);
|
145 |
+
|
146 |
+
if (array_key_exists($name, $messages)) {
|
147 |
+
return $messages[$name];
|
148 |
+
} else {
|
149 |
+
return '[' . $name . '] Missing project dependency!';
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
lib/Genesis/vendor/autoload.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
|
24 |
+
if (!class_exists('\GenesisAutoLoader', false)) {
|
25 |
+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'composer' . DIRECTORY_SEPARATOR . 'autoload_real.php';
|
26 |
+
|
27 |
+
return GenesisAutoLoader::getLoader();
|
28 |
+
}
|
lib/Genesis/vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,383 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0 class loader
|
17 |
+
*
|
18 |
+
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
|
19 |
+
*
|
20 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
21 |
+
*
|
22 |
+
* // register classes with namespaces
|
23 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
24 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
25 |
+
*
|
26 |
+
* // activate the autoloader
|
27 |
+
* $loader->register();
|
28 |
+
*
|
29 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
30 |
+
* $loader->setUseIncludePath(true);
|
31 |
+
*
|
32 |
+
* In this example, if you try to use a class in the Symfony\Component
|
33 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
34 |
+
* the autoloader will first look for the class under the component/
|
35 |
+
* directory, and it will then fallback to the framework/ directory if not
|
36 |
+
* found before giving up.
|
37 |
+
*
|
38 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
39 |
+
*
|
40 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
41 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
|
57 |
+
public function getPrefixes()
|
58 |
+
{
|
59 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getPrefixesPsr4()
|
63 |
+
{
|
64 |
+
return $this->prefixDirsPsr4;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getFallbackDirs()
|
68 |
+
{
|
69 |
+
return $this->fallbackDirsPsr0;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getFallbackDirsPsr4()
|
73 |
+
{
|
74 |
+
return $this->fallbackDirsPsr4;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function getClassMap()
|
78 |
+
{
|
79 |
+
return $this->classMap;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @param array $classMap Class to filename map
|
84 |
+
*/
|
85 |
+
public function addClassMap(array $classMap)
|
86 |
+
{
|
87 |
+
if ($this->classMap) {
|
88 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
89 |
+
} else {
|
90 |
+
$this->classMap = $classMap;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
96 |
+
* appending or prepending to the ones previously set for this prefix.
|
97 |
+
*
|
98 |
+
* @param string $prefix The prefix
|
99 |
+
* @param array|string $paths The PSR-0 root directories
|
100 |
+
* @param bool $prepend Whether to prepend the directories
|
101 |
+
*/
|
102 |
+
public function add($prefix, $paths, $prepend = false)
|
103 |
+
{
|
104 |
+
if (!$prefix) {
|
105 |
+
if ($prepend) {
|
106 |
+
$this->fallbackDirsPsr0 = array_merge(
|
107 |
+
(array) $paths,
|
108 |
+
$this->fallbackDirsPsr0
|
109 |
+
);
|
110 |
+
} else {
|
111 |
+
$this->fallbackDirsPsr0 = array_merge(
|
112 |
+
$this->fallbackDirsPsr0,
|
113 |
+
(array) $paths
|
114 |
+
);
|
115 |
+
}
|
116 |
+
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
|
120 |
+
$first = $prefix[0];
|
121 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
122 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
123 |
+
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
if ($prepend) {
|
127 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
128 |
+
(array) $paths,
|
129 |
+
$this->prefixesPsr0[$first][$prefix]
|
130 |
+
);
|
131 |
+
} else {
|
132 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
133 |
+
$this->prefixesPsr0[$first][$prefix],
|
134 |
+
(array) $paths
|
135 |
+
);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
141 |
+
* appending or prepending to the ones previously set for this namespace.
|
142 |
+
*
|
143 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
144 |
+
* @param array|string $paths The PSR-0 base directories
|
145 |
+
* @param bool $prepend Whether to prepend the directories
|
146 |
+
*
|
147 |
+
* @throws \InvalidArgumentException
|
148 |
+
*/
|
149 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
150 |
+
{
|
151 |
+
if (!$prefix) {
|
152 |
+
// Register directories for the root namespace.
|
153 |
+
if ($prepend) {
|
154 |
+
$this->fallbackDirsPsr4 = array_merge(
|
155 |
+
(array) $paths,
|
156 |
+
$this->fallbackDirsPsr4
|
157 |
+
);
|
158 |
+
} else {
|
159 |
+
$this->fallbackDirsPsr4 = array_merge(
|
160 |
+
$this->fallbackDirsPsr4,
|
161 |
+
(array) $paths
|
162 |
+
);
|
163 |
+
}
|
164 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
165 |
+
// Register directories for a new namespace.
|
166 |
+
$length = strlen($prefix);
|
167 |
+
if ('\\' !== $prefix[$length - 1]) {
|
168 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
169 |
+
}
|
170 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
171 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
172 |
+
} elseif ($prepend) {
|
173 |
+
// Prepend directories for an already registered namespace.
|
174 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
175 |
+
(array) $paths,
|
176 |
+
$this->prefixDirsPsr4[$prefix]
|
177 |
+
);
|
178 |
+
} else {
|
179 |
+
// Append directories for an already registered namespace.
|
180 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
181 |
+
$this->prefixDirsPsr4[$prefix],
|
182 |
+
(array) $paths
|
183 |
+
);
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
189 |
+
* replacing any others previously set for this prefix.
|
190 |
+
*
|
191 |
+
* @param string $prefix The prefix
|
192 |
+
* @param array|string $paths The PSR-0 base directories
|
193 |
+
*/
|
194 |
+
public function set($prefix, $paths)
|
195 |
+
{
|
196 |
+
if (!$prefix) {
|
197 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
198 |
+
} else {
|
199 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
205 |
+
* replacing any others previously set for this namespace.
|
206 |
+
*
|
207 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
208 |
+
* @param array|string $paths The PSR-4 base directories
|
209 |
+
*
|
210 |
+
* @throws \InvalidArgumentException
|
211 |
+
*/
|
212 |
+
public function setPsr4($prefix, $paths)
|
213 |
+
{
|
214 |
+
if (!$prefix) {
|
215 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
216 |
+
} else {
|
217 |
+
$length = strlen($prefix);
|
218 |
+
if ('\\' !== $prefix[$length - 1]) {
|
219 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
220 |
+
}
|
221 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
222 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Turns on searching the include path for class files.
|
228 |
+
*
|
229 |
+
* @param bool $useIncludePath
|
230 |
+
*/
|
231 |
+
public function setUseIncludePath($useIncludePath)
|
232 |
+
{
|
233 |
+
$this->useIncludePath = $useIncludePath;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Can be used to check if the autoloader uses the include path to check
|
238 |
+
* for classes.
|
239 |
+
*
|
240 |
+
* @return bool
|
241 |
+
*/
|
242 |
+
public function getUseIncludePath()
|
243 |
+
{
|
244 |
+
return $this->useIncludePath;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Registers this instance as an autoloader.
|
249 |
+
*
|
250 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
251 |
+
*/
|
252 |
+
public function register($prepend = false)
|
253 |
+
{
|
254 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Unregisters this instance as an autoloader.
|
259 |
+
*/
|
260 |
+
public function unregister()
|
261 |
+
{
|
262 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Loads the given class or interface.
|
267 |
+
*
|
268 |
+
* @param string $class The name of the class
|
269 |
+
* @return bool|null True if loaded, null otherwise
|
270 |
+
*/
|
271 |
+
public function loadClass($class)
|
272 |
+
{
|
273 |
+
if ($file = $this->findFile($class)) {
|
274 |
+
includeFile($file);
|
275 |
+
|
276 |
+
return true;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Finds the path to the file where the class is defined.
|
282 |
+
*
|
283 |
+
* @param string $class The name of the class
|
284 |
+
*
|
285 |
+
* @return string|false The path if found, false otherwise
|
286 |
+
*/
|
287 |
+
public function findFile($class)
|
288 |
+
{
|
289 |
+
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
290 |
+
if ('\\' == $class[0]) {
|
291 |
+
$class = substr($class, 1);
|
292 |
+
}
|
293 |
+
|
294 |
+
// class map lookup
|
295 |
+
if (isset($this->classMap[$class])) {
|
296 |
+
return $this->classMap[$class];
|
297 |
+
}
|
298 |
+
|
299 |
+
$file = $this->findFileWithExtension($class, '.php');
|
300 |
+
|
301 |
+
// Search for Hack files if we are running on HHVM
|
302 |
+
if ($file === null && defined('HHVM_VERSION')) {
|
303 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
304 |
+
}
|
305 |
+
|
306 |
+
if ($file === null) {
|
307 |
+
// Remember that this class does not exist.
|
308 |
+
return $this->classMap[$class] = false;
|
309 |
+
}
|
310 |
+
|
311 |
+
return $file;
|
312 |
+
}
|
313 |
+
|
314 |
+
private function findFileWithExtension($class, $ext)
|
315 |
+
{
|
316 |
+
// PSR-4 lookup
|
317 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
318 |
+
|
319 |
+
$first = $class[0];
|
320 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
321 |
+
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
322 |
+
if (0 === strpos($class, $prefix)) {
|
323 |
+
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
324 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
325 |
+
return $file;
|
326 |
+
}
|
327 |
+
}
|
328 |
+
}
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
// PSR-4 fallback dirs
|
333 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
334 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
335 |
+
return $file;
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
// PSR-0 lookup
|
340 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
341 |
+
// namespaced class name
|
342 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
343 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
344 |
+
} else {
|
345 |
+
// PEAR-like class name
|
346 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
347 |
+
}
|
348 |
+
|
349 |
+
if (isset($this->prefixesPsr0[$first])) {
|
350 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
351 |
+
if (0 === strpos($class, $prefix)) {
|
352 |
+
foreach ($dirs as $dir) {
|
353 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
354 |
+
return $file;
|
355 |
+
}
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
|
361 |
+
// PSR-0 fallback dirs
|
362 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
363 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
364 |
+
return $file;
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
// PSR-0 include paths.
|
369 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
370 |
+
return $file;
|
371 |
+
}
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Scope isolated include.
|
377 |
+
*
|
378 |
+
* Prevents access to $this/self from included files.
|
379 |
+
*/
|
380 |
+
function includeFile($file)
|
381 |
+
{
|
382 |
+
include $file;
|
383 |
+
}
|
lib/Genesis/vendor/composer/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2015 Nils Adermann, Jordi Boggiano
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
of this software and associated documentation files (the "Software"), to deal
|
5 |
+
in the Software without restriction, including without limitation the rights
|
6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
8 |
+
to do so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
THE SOFTWARE.
|
lib/Genesis/vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
lib/Genesis/vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
|
24 |
+
$vendorDir = dirname(dirname(__FILE__));
|
25 |
+
$baseDir = dirname($vendorDir);
|
26 |
+
|
27 |
+
return array(
|
28 |
+
'Genesis' => array($baseDir . '/src'),
|
29 |
+
);
|
lib/Genesis/vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
lib/Genesis/vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
* of this software and associated documentation files (the "Software"), to deal
|
5 |
+
* in the Software without restriction, including without limitation the rights
|
6 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
* copies of the Software, and to permit persons to whom the Software is
|
8 |
+
* furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in
|
11 |
+
* all copies or substantial portions of the Software.
|
12 |
+
*
|
13 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
* THE SOFTWARE.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/MIT The MIT License
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Setup the namespaces and class loaders
|
26 |
+
*
|
27 |
+
* @class GenesisAutoLoader
|
28 |
+
*/
|
29 |
+
class GenesisAutoLoader
|
30 |
+
{
|
31 |
+
private static $loader;
|
32 |
+
|
33 |
+
public static function loadClassLoader($class)
|
34 |
+
{
|
35 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
36 |
+
if (!class_exists('\Composer\Autoload\ClassLoader')) {
|
37 |
+
require __DIR__ . DIRECTORY_SEPARATOR . 'ClassLoader.php';
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
public static function getLoader()
|
43 |
+
{
|
44 |
+
if (null !== self::$loader) {
|
45 |
+
return self::$loader;
|
46 |
+
}
|
47 |
+
|
48 |
+
spl_autoload_register(array('GenesisAutoLoader', 'loadClassLoader'), true, true);
|
49 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
50 |
+
spl_autoload_unregister(array('GenesisAutoLoader', 'loadClassLoader'));
|
51 |
+
|
52 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
53 |
+
foreach ($map as $namespace => $path) {
|
54 |
+
$loader->set($namespace, $path);
|
55 |
+
}
|
56 |
+
|
57 |
+
$loader->register(true);
|
58 |
+
|
59 |
+
return $loader;
|
60 |
+
}
|
61 |
+
}
|
lib/Genesis/vendor/composer/installed.json
ADDED
@@ -0,0 +1,545 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "fzaninotto/faker",
|
4 |
+
"version": "v1.4.0",
|
5 |
+
"version_normalized": "1.4.0.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/fzaninotto/Faker.git",
|
9 |
+
"reference": "010c7efedd88bf31141a02719f51fb44c732d5a0"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/010c7efedd88bf31141a02719f51fb44c732d5a0",
|
14 |
+
"reference": "010c7efedd88bf31141a02719f51fb44c732d5a0",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"php": ">=5.3.3"
|
19 |
+
},
|
20 |
+
"require-dev": {
|
21 |
+
"phpunit/phpunit": "~4.0",
|
22 |
+
"squizlabs/php_codesniffer": "~1.5"
|
23 |
+
},
|
24 |
+
"time": "2014-06-04 14:43:02",
|
25 |
+
"type": "library",
|
26 |
+
"extra": {
|
27 |
+
"branch-alias": []
|
28 |
+
},
|
29 |
+
"installation-source": "dist",
|
30 |
+
"autoload": {
|
31 |
+
"psr-0": {
|
32 |
+
"Faker": "src/",
|
33 |
+
"Faker\\PHPUnit": "test/"
|
34 |
+
}
|
35 |
+
},
|
36 |
+
"notification-url": "https://packagist.org/downloads/",
|
37 |
+
"license": [
|
38 |
+
"MIT"
|
39 |
+
],
|
40 |
+
"authors": [
|
41 |
+
{
|
42 |
+
"name": "François Zaninotto"
|
43 |
+
}
|
44 |
+
],
|
45 |
+
"description": "Faker is a PHP library that generates fake data for you.",
|
46 |
+
"keywords": [
|
47 |
+
"data",
|
48 |
+
"faker",
|
49 |
+
"fixtures"
|
50 |
+
]
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"name": "symfony/yaml",
|
54 |
+
"version": "v2.5.6",
|
55 |
+
"version_normalized": "2.5.6.0",
|
56 |
+
"target-dir": "Symfony/Component/Yaml",
|
57 |
+
"source": {
|
58 |
+
"type": "git",
|
59 |
+
"url": "https://github.com/symfony/Yaml.git",
|
60 |
+
"reference": "2d9f527449cabfa8543dd7fa3a466d6ae83d6726"
|
61 |
+
},
|
62 |
+
"dist": {
|
63 |
+
"type": "zip",
|
64 |
+
"url": "https://api.github.com/repos/symfony/Yaml/zipball/2d9f527449cabfa8543dd7fa3a466d6ae83d6726",
|
65 |
+
"reference": "2d9f527449cabfa8543dd7fa3a466d6ae83d6726",
|
66 |
+
"shasum": ""
|
67 |
+
},
|
68 |
+
"require": {
|
69 |
+
"php": ">=5.3.3"
|
70 |
+
},
|
71 |
+
"time": "2014-10-01 05:50:18",
|
72 |
+
"type": "library",
|
73 |
+
"extra": {
|
74 |
+
"branch-alias": {
|
75 |
+
"dev-master": "2.5-dev"
|
76 |
+
}
|
77 |
+
},
|
78 |
+
"installation-source": "dist",
|
79 |
+
"autoload": {
|
80 |
+
"psr-0": {
|
81 |
+
"Symfony\\Component\\Yaml\\": ""
|
82 |
+
}
|
83 |
+
},
|
84 |
+
"notification-url": "https://packagist.org/downloads/",
|
85 |
+
"license": [
|
86 |
+
"MIT"
|
87 |
+
],
|
88 |
+
"authors": [
|
89 |
+
{
|
90 |
+
"name": "Symfony Community",
|
91 |
+
"homepage": "http://symfony.com/contributors"
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"name": "Fabien Potencier",
|
95 |
+
"email": "fabien@symfony.com"
|
96 |
+
}
|
97 |
+
],
|
98 |
+
"description": "Symfony Yaml Component",
|
99 |
+
"homepage": "http://symfony.com"
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"name": "symfony/finder",
|
103 |
+
"version": "v2.5.6",
|
104 |
+
"version_normalized": "2.5.6.0",
|
105 |
+
"target-dir": "Symfony/Component/Finder",
|
106 |
+
"source": {
|
107 |
+
"type": "git",
|
108 |
+
"url": "https://github.com/symfony/Finder.git",
|
109 |
+
"reference": "cf66df4e783e6aade319b273c9bcf9e42aa9b10f"
|
110 |
+
},
|
111 |
+
"dist": {
|
112 |
+
"type": "zip",
|
113 |
+
"url": "https://api.github.com/repos/symfony/Finder/zipball/cf66df4e783e6aade319b273c9bcf9e42aa9b10f",
|
114 |
+
"reference": "cf66df4e783e6aade319b273c9bcf9e42aa9b10f",
|
115 |
+
"shasum": ""
|
116 |
+
},
|
117 |
+
"require": {
|
118 |
+
"php": ">=5.3.3"
|
119 |
+
},
|
120 |
+
"time": "2014-10-01 05:50:18",
|
121 |
+
"type": "library",
|
122 |
+
"extra": {
|
123 |
+
"branch-alias": {
|
124 |
+
"dev-master": "2.5-dev"
|
125 |
+
}
|
126 |
+
},
|
127 |
+
"installation-source": "dist",
|
128 |
+
"autoload": {
|
129 |
+
"psr-0": {
|
130 |
+
"Symfony\\Component\\Finder\\": ""
|
131 |
+
}
|
132 |
+
},
|
133 |
+
"notification-url": "https://packagist.org/downloads/",
|
134 |
+
"license": [
|
135 |
+
"MIT"
|
136 |
+
],
|
137 |
+
"authors": [
|
138 |
+
{
|
139 |
+
"name": "Symfony Community",
|
140 |
+
"homepage": "http://symfony.com/contributors"
|
141 |
+
},
|
142 |
+
{
|
143 |
+
"name": "Fabien Potencier",
|
144 |
+
"email": "fabien@symfony.com"
|
145 |
+
}
|
146 |
+
],
|
147 |
+
"description": "Symfony Finder Component",
|
148 |
+
"homepage": "http://symfony.com"
|
149 |
+
},
|
150 |
+
{
|
151 |
+
"name": "symfony/event-dispatcher",
|
152 |
+
"version": "v2.5.6",
|
153 |
+
"version_normalized": "2.5.6.0",
|
154 |
+
"target-dir": "Symfony/Component/EventDispatcher",
|
155 |
+
"source": {
|
156 |
+
"type": "git",
|
157 |
+
"url": "https://github.com/symfony/EventDispatcher.git",
|
158 |
+
"reference": "804eb28dbbfba9ffdab21fe2066744906cea2212"
|
159 |
+
},
|
160 |
+
"dist": {
|
161 |
+
"type": "zip",
|
162 |
+
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/804eb28dbbfba9ffdab21fe2066744906cea2212",
|
163 |
+
"reference": "804eb28dbbfba9ffdab21fe2066744906cea2212",
|
164 |
+
"shasum": ""
|
165 |
+
},
|
166 |
+
"require": {
|
167 |
+
"php": ">=5.3.3"
|
168 |
+
},
|
169 |
+
"require-dev": {
|
170 |
+
"psr/log": "~1.0",
|
171 |
+
"symfony/config": "~2.0",
|
172 |
+
"symfony/dependency-injection": "~2.0,<2.6.0",
|
173 |
+
"symfony/stopwatch": "~2.2"
|
174 |
+
},
|
175 |
+
"suggest": {
|
176 |
+
"symfony/dependency-injection": "",
|
177 |
+
"symfony/http-kernel": ""
|
178 |
+
},
|
179 |
+
"time": "2014-10-01 15:43:05",
|
180 |
+
"type": "library",
|
181 |
+
"extra": {
|
182 |
+
"branch-alias": {
|
183 |
+
"dev-master": "2.5-dev"
|
184 |
+
}
|
185 |
+
},
|
186 |
+
"installation-source": "dist",
|
187 |
+
"autoload": {
|
188 |
+
"psr-0": {
|
189 |
+
"Symfony\\Component\\EventDispatcher\\": ""
|
190 |
+
}
|
191 |
+
},
|
192 |
+
"notification-url": "https://packagist.org/downloads/",
|
193 |
+
"license": [
|
194 |
+
"MIT"
|
195 |
+
],
|
196 |
+
"authors": [
|
197 |
+
{
|
198 |
+
"name": "Symfony Community",
|
199 |
+
"homepage": "http://symfony.com/contributors"
|
200 |
+
},
|
201 |
+
{
|
202 |
+
"name": "Fabien Potencier",
|
203 |
+
"email": "fabien@symfony.com"
|
204 |
+
}
|
205 |
+
],
|
206 |
+
"description": "Symfony EventDispatcher Component",
|
207 |
+
"homepage": "http://symfony.com"
|
208 |
+
},
|
209 |
+
{
|
210 |
+
"name": "symfony/console",
|
211 |
+
"version": "v2.5.6",
|
212 |
+
"version_normalized": "2.5.6.0",
|
213 |
+
"target-dir": "Symfony/Component/Console",
|
214 |
+
"source": {
|
215 |
+
"type": "git",
|
216 |
+
"url": "https://github.com/symfony/Console.git",
|
217 |
+
"reference": "6f177fca24200a5b97aef5ce7a5c98124a0f0db0"
|
218 |
+
},
|
219 |
+
"dist": {
|
220 |
+
"type": "zip",
|
221 |
+
"url": "https://api.github.com/repos/symfony/Console/zipball/6f177fca24200a5b97aef5ce7a5c98124a0f0db0",
|
222 |
+
"reference": "6f177fca24200a5b97aef5ce7a5c98124a0f0db0",
|
223 |
+
"shasum": ""
|
224 |
+
},
|
225 |
+
"require": {
|
226 |
+
"php": ">=5.3.3"
|
227 |
+
},
|
228 |
+
"require-dev": {
|
229 |
+
"psr/log": "~1.0",
|
230 |
+
"symfony/event-dispatcher": "~2.1"
|
231 |
+
},
|
232 |
+
"suggest": {
|
233 |
+
"psr/log": "For using the console logger",
|
234 |
+
"symfony/event-dispatcher": ""
|
235 |
+
},
|
236 |
+
"time": "2014-10-05 13:57:04",
|
237 |
+
"type": "library",
|
238 |
+
"extra": {
|
239 |
+
"branch-alias": {
|
240 |
+
"dev-master": "2.5-dev"
|
241 |
+
}
|
242 |
+
},
|
243 |
+
"installation-source": "dist",
|
244 |
+
"autoload": {
|
245 |
+
"psr-0": {
|
246 |
+
"Symfony\\Component\\Console\\": ""
|
247 |
+
}
|
248 |
+
},
|
249 |
+
"notification-url": "https://packagist.org/downloads/",
|
250 |
+
"license": [
|
251 |
+
"MIT"
|
252 |
+
],
|
253 |
+
"authors": [
|
254 |
+
{
|
255 |
+
"name": "Symfony Community",
|
256 |
+
"homepage": "http://symfony.com/contributors"
|
257 |
+
},
|
258 |
+
{
|
259 |
+
"name": "Fabien Potencier",
|
260 |
+
"email": "fabien@symfony.com"
|
261 |
+
}
|
262 |
+
],
|
263 |
+
"description": "Symfony Console Component",
|
264 |
+
"homepage": "http://symfony.com"
|
265 |
+
},
|
266 |
+
{
|
267 |
+
"name": "phpdocumentor/reflection-docblock",
|
268 |
+
"version": "2.0.3",
|
269 |
+
"version_normalized": "2.0.3.0",
|
270 |
+
"source": {
|
271 |
+
"type": "git",
|
272 |
+
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
273 |
+
"reference": "38743b677965c48a637097b2746a281264ae2347"
|
274 |
+
},
|
275 |
+
"dist": {
|
276 |
+
"type": "zip",
|
277 |
+
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347",
|
278 |
+
"reference": "38743b677965c48a637097b2746a281264ae2347",
|
279 |
+
"shasum": ""
|
280 |
+
},
|
281 |
+
"require": {
|
282 |
+
"php": ">=5.3.3"
|
283 |
+
},
|
284 |
+
"require-dev": {
|
285 |
+
"phpunit/phpunit": "3.7.*@stable"
|
286 |
+
},
|
287 |
+
"suggest": {
|
288 |
+
"dflydev/markdown": "1.0.*",
|
289 |
+
"erusev/parsedown": "~0.7"
|
290 |
+
},
|
291 |
+
"time": "2014-08-09 10:27:07",
|
292 |
+
"type": "library",
|
293 |
+
"extra": {
|
294 |
+
"branch-alias": {
|
295 |
+
"dev-master": "2.0.x-dev"
|
296 |
+
}
|
297 |
+
},
|
298 |
+
"installation-source": "dist",
|
299 |
+
"autoload": {
|
300 |
+
"psr-0": {
|
301 |
+
"phpDocumentor": [
|
302 |
+
"src/"
|
303 |
+
]
|
304 |
+
}
|
305 |
+
},
|
306 |
+
"notification-url": "https://packagist.org/downloads/",
|
307 |
+
"license": [
|
308 |
+
"MIT"
|
309 |
+
],
|
310 |
+
"authors": [
|
311 |
+
{
|
312 |
+
"name": "Mike van Riel",
|
313 |
+
"email": "mike.vanriel@naenius.com"
|
314 |
+
}
|
315 |
+
]
|
316 |
+
},
|
317 |
+
{
|
318 |
+
"name": "doctrine/instantiator",
|
319 |
+
"version": "1.0.4",
|
320 |
+
"version_normalized": "1.0.4.0",
|
321 |
+
"source": {
|
322 |
+
"type": "git",
|
323 |
+
"url": "https://github.com/doctrine/instantiator.git",
|
324 |
+
"reference": "f976e5de371104877ebc89bd8fecb0019ed9c119"
|
325 |
+
},
|
326 |
+
"dist": {
|
327 |
+
"type": "zip",
|
328 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119",
|
329 |
+
"reference": "f976e5de371104877ebc89bd8fecb0019ed9c119",
|
330 |
+
"shasum": ""
|
331 |
+
},
|
332 |
+
"require": {
|
333 |
+
"php": ">=5.3,<8.0-DEV"
|
334 |
+
},
|
335 |
+
"require-dev": {
|
336 |
+
"athletic/athletic": "~0.1.8",
|
337 |
+
"ext-pdo": "*",
|
338 |
+
"ext-phar": "*",
|
339 |
+
"phpunit/phpunit": "~4.0",
|
340 |
+
"squizlabs/php_codesniffer": "2.0.*@ALPHA"
|
341 |
+
},
|
342 |
+
"time": "2014-10-13 12:58:55",
|
343 |
+
"type": "library",
|
344 |
+
"extra": {
|
345 |
+
"branch-alias": {
|
346 |
+
"dev-master": "1.0.x-dev"
|
347 |
+
}
|
348 |
+
},
|
349 |
+
"installation-source": "dist",
|
350 |
+
"autoload": {
|
351 |
+
"psr-0": {
|
352 |
+
"Doctrine\\Instantiator\\": "src"
|
353 |
+
}
|
354 |
+
},
|
355 |
+
"notification-url": "https://packagist.org/downloads/",
|
356 |
+
"license": [
|
357 |
+
"MIT"
|
358 |
+
],
|
359 |
+
"authors": [
|
360 |
+
{
|
361 |
+
"name": "Marco Pivetta",
|
362 |
+
"email": "ocramius@gmail.com",
|
363 |
+
"homepage": "http://ocramius.github.com/"
|
364 |
+
}
|
365 |
+
],
|
366 |
+
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
367 |
+
"homepage": "https://github.com/doctrine/instantiator",
|
368 |
+
"keywords": [
|
369 |
+
"constructor",
|
370 |
+
"instantiate"
|
371 |
+
]
|
372 |
+
},
|
373 |
+
{
|
374 |
+
"name": "phpspec/prophecy",
|
375 |
+
"version": "v1.2.1",
|
376 |
+
"version_normalized": "1.2.1.0",
|
377 |
+
"source": {
|
378 |
+
"type": "git",
|
379 |
+
"url": "https://github.com/phpspec/prophecy.git",
|
380 |
+
"reference": "ed9c0bcffe4639a5b0ff83e399eeb28e7fcc68f0"
|
381 |
+
},
|
382 |
+
"dist": {
|
383 |
+
"type": "zip",
|
384 |
+
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/ed9c0bcffe4639a5b0ff83e399eeb28e7fcc68f0",
|
385 |
+
"reference": "ed9c0bcffe4639a5b0ff83e399eeb28e7fcc68f0",
|
386 |
+
"shasum": ""
|
387 |
+
},
|
388 |
+
"require": {
|
389 |
+
"doctrine/instantiator": "~1.0,>=1.0.2",
|
390 |
+
"phpdocumentor/reflection-docblock": "~2.0"
|
391 |
+
},
|
392 |
+
"require-dev": {
|
393 |
+
"phpspec/phpspec": "~2.0"
|
394 |
+
},
|
395 |
+
"time": "2014-09-23 10:52:18",
|
396 |
+
"type": "library",
|
397 |
+
"extra": {
|
398 |
+
"branch-alias": {
|
399 |
+
"dev-master": "1.2.x-dev"
|
400 |
+
}
|
401 |
+
},
|
402 |
+
"installation-source": "dist",
|
403 |
+
"autoload": {
|
404 |
+
"psr-0": {
|
405 |
+
"Prophecy\\": "src/"
|
406 |
+
}
|
407 |
+
},
|
408 |
+
"notification-url": "https://packagist.org/downloads/",
|
409 |
+
"license": [
|
410 |
+
"MIT"
|
411 |
+
],
|
412 |
+
"authors": [
|
413 |
+
{
|
414 |
+
"name": "Konstantin Kudryashov",
|
415 |
+
"email": "ever.zet@gmail.com",
|
416 |
+
"homepage": "http://everzet.com"
|
417 |
+
},
|
418 |
+
{
|
419 |
+
"name": "Marcello Duarte",
|
420 |
+
"email": "marcello.duarte@gmail.com"
|
421 |
+
}
|
422 |
+
],
|
423 |
+
"description": "Highly opinionated mocking framework for PHP 5.3+",
|
424 |
+
"homepage": "http://phpspec.org",
|
425 |
+
"keywords": [
|
426 |
+
"Double",
|
427 |
+
"Dummy",
|
428 |
+
"fake",
|
429 |
+
"mock",
|
430 |
+
"spy",
|
431 |
+
"stub"
|
432 |
+
]
|
433 |
+
},
|
434 |
+
{
|
435 |
+
"name": "phpspec/php-diff",
|
436 |
+
"version": "v1.0.2",
|
437 |
+
"version_normalized": "1.0.2.0",
|
438 |
+
"source": {
|
439 |
+
"type": "git",
|
440 |
+
"url": "https://github.com/phpspec/php-diff.git",
|
441 |
+
"reference": "30e103d19519fe678ae64a60d77884ef3d71b28a"
|
442 |
+
},
|
443 |
+
"dist": {
|
444 |
+
"type": "zip",
|
445 |
+
"url": "https://api.github.com/repos/phpspec/php-diff/zipball/30e103d19519fe678ae64a60d77884ef3d71b28a",
|
446 |
+
"reference": "30e103d19519fe678ae64a60d77884ef3d71b28a",
|
447 |
+
"shasum": ""
|
448 |
+
},
|
449 |
+
"time": "2013-11-01 13:02:21",
|
450 |
+
"type": "library",
|
451 |
+
"installation-source": "dist",
|
452 |
+
"autoload": {
|
453 |
+
"psr-0": {
|
454 |
+
"Diff": "lib/"
|
455 |
+
}
|
456 |
+
},
|
457 |
+
"notification-url": "https://packagist.org/downloads/",
|
458 |
+
"license": [
|
459 |
+
"BSD-3-Clause"
|
460 |
+
],
|
461 |
+
"authors": [
|
462 |
+
{
|
463 |
+
"name": "Chris Boulton",
|
464 |
+
"homepage": "http://github.com/chrisboulton",
|
465 |
+
"role": "Original developer"
|
466 |
+
}
|
467 |
+
],
|
468 |
+
"description": "A comprehensive library for generating differences between two hashable objects (strings or arrays)."
|
469 |
+
},
|
470 |
+
{
|
471 |
+
"name": "phpspec/phpspec",
|
472 |
+
"version": "2.0.1",
|
473 |
+
"version_normalized": "2.0.1.0",
|
474 |
+
"source": {
|
475 |
+
"type": "git",
|
476 |
+
"url": "https://github.com/phpspec/phpspec.git",
|
477 |
+
"reference": "61712147412cb647b6cb68b19833a60bfda759a1"
|
478 |
+
},
|
479 |
+
"dist": {
|
480 |
+
"type": "zip",
|
481 |
+
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/61712147412cb647b6cb68b19833a60bfda759a1",
|
482 |
+
"reference": "61712147412cb647b6cb68b19833a60bfda759a1",
|
483 |
+
"shasum": ""
|
484 |
+
},
|
485 |
+
"require": {
|
486 |
+
"php": ">=5.3.3",
|
487 |
+
"phpspec/php-diff": "~1.0.0",
|
488 |
+
"phpspec/prophecy": "~1.1",
|
489 |
+
"symfony/console": "~2.1",
|
490 |
+
"symfony/event-dispatcher": "~2.1",
|
491 |
+
"symfony/finder": "~2.1",
|
492 |
+
"symfony/yaml": "~2.1"
|
493 |
+
},
|
494 |
+
"require-dev": {
|
495 |
+
"behat/behat": "~2.5",
|
496 |
+
"bossa/phpspec2-expect": "dev-master",
|
497 |
+
"symfony/filesystem": "~2.1"
|
498 |
+
},
|
499 |
+
"suggest": {
|
500 |
+
"phpspec/nyan-formatters": "~1.0 – Adds Nyan formatters"
|
501 |
+
},
|
502 |
+
"time": "2014-07-01 14:09:19",
|
503 |
+
"bin": [
|
504 |
+
"bin/phpspec"
|
505 |
+
],
|
506 |
+
"type": "library",
|
507 |
+
"extra": {
|
508 |
+
"branch-alias": {
|
509 |
+
"dev-master": "2.0.x-dev"
|
510 |
+
}
|
511 |
+
},
|
512 |
+
"installation-source": "dist",
|
513 |
+
"autoload": {
|
514 |
+
"psr-0": {
|
515 |
+
"PhpSpec": "src/"
|
516 |
+
}
|
517 |
+
},
|
518 |
+
"notification-url": "https://packagist.org/downloads/",
|
519 |
+
"license": [
|
520 |
+
"MIT"
|
521 |
+
],
|
522 |
+
"authors": [
|
523 |
+
{
|
524 |
+
"name": "Konstantin Kudryashov",
|
525 |
+
"email": "ever.zet@gmail.com",
|
526 |
+
"homepage": "http://everzet.com"
|
527 |
+
},
|
528 |
+
{
|
529 |
+
"name": "Marcello Duarte",
|
530 |
+
"homepage": "http://marcelloduarte.net/"
|
531 |
+
}
|
532 |
+
],
|
533 |
+
"description": "Specification-oriented BDD framework for PHP 5.3+",
|
534 |
+
"homepage": "http://phpspec.net/",
|
535 |
+
"keywords": [
|
536 |
+
"BDD",
|
537 |
+
"SpecBDD",
|
538 |
+
"TDD",
|
539 |
+
"spec",
|
540 |
+
"specification",
|
541 |
+
"testing",
|
542 |
+
"tests"
|
543 |
+
]
|
544 |
+
}
|
545 |
+
]
|
package.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>EMerchantPay_Genesis_Client</name>
|
4 |
+
<version>1.2.5</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>Genesis client for Magento Community Edition </summary>
|
10 |
+
<description>This is a Payment Module for Magento Community Edition, that gives you the ability to process payments through eMerchantPay's Payment Gateway - Genesis.
|
11 |
+

|
12 |
+
The Payment Gateway supports all of the major credit/debit card brands and more than 40 alternative payment methods (APMs) and e-wallets. When using the module, the merchant benefits from eMerchantPay’s vast payment industry experience and a full suite of value-added services such as sophisticated risk management and monitoring tools, with the added benefit of removing the burden of PCI DSS compliance from the merchant.</description>
|
13 |
+
<notes>1.) Added Support for GenesisLib v1.4 - Additional Transaction Types are now available using the eMerchantPay Checkout Method
|
14 |
+

|
15 |
+
2.) A possibility has been added to use an external GenesisGateway Library (installed by composer) instead of the integrated in Module
|
16 |
+

|
17 |
+
2.) A few minor issues were resolved regarding Capture / Refund Transactions</notes>
|
18 |
+
<authors><author><name>eMerchantPay Ltd.</name><user>chrisrive</user><email>chris@emerchantpay.com</email></author></authors>
|
19 |
+
<date>2016-03-08</date>
|
20 |
+
<time>08:43:54</time>
|
21 |
+
<contents><target name="magecommunity"><dir name="EMerchantPay"><dir name="Genesis"><dir name="Block"><dir name="Form"><file name="Checkout.php" hash="e1713fe21f92f7bb7a522b7730939c1d"/><file name="Direct.php" hash="c5f16b7b7fb6f1f07bd8089e85dc01a9"/></dir><dir name="Info"><file name="Checkout.php" hash="c2fd5ae90dcf40e6da76178060ad5bdd"/><file name="Direct.php" hash="7f4daf266862c14c2a960688bb9e7670"/></dir><dir name="Redirect"><file name="Checkout.php" hash="603172085e3048c978141cc10638eac3"/><file name="Direct.php" hash="104ba1d6e5b37d1fc2888802b1c020b9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a0117631e5acf7f94783cbdc2bd843a2"/></dir><dir name="Model"><dir name="Admin"><dir name="Checkout"><dir name="Options"><dir name="Transaction"><file name="Type.php" hash="81ae87b247bc6f64c93e813094106892"/></dir></dir></dir><dir name="Direct"><dir name="Options"><dir name="Transaction"><file name="Type.php" hash="9e3ee18be9459b20f645fb9d732f06af"/></dir></dir></dir><file name="Environment.php" hash="d49c0459884af6d14e1731c4ee9e593d"/></dir><file name="Checkout.php" hash="7dbae46ec6a6f8a8384621ed5843a9e0"/><file name="Direct.php" hash="fa4c323671fdec353449725be66635fb"/></dir><dir name="Observer"><file name="GenesisAutoLoader.php" hash="8dc769bfedd535b5f9daa530b79dd848"/></dir><dir name="controllers"><file name="CheckoutController.php" hash="592dbcaa98e7c2c1168ce0225b9e6a8b"/><file name="DirectController.php" hash="720df84338103b873dd0ddf760202886"/></dir><dir name="etc"><file name="config.xml" hash="2c866eb5fd8d3f052c68daf07c2b6538"/><file name="system.xml" hash="6735a2d7193fccb4409697173d62996f"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="info"><file name="checkout.phtml" hash="121f777049b801219f2792ca9aaedd3e"/><file name="direct.phtml" hash="121f777049b801219f2792ca9aaedd3e"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="form"><file name="checkout.phtml" hash="ba9d29a0bbf17e2898ea1eb78b7a1ab2"/><file name="direct.phtml" hash="d632828998036b99c05efbd55e85e3fd"/></dir><dir name="info"><file name="checkout.phtml" hash="939277e4db9bda19b6932775a03fbaac"/><file name="direct.phtml" hash="939277e4db9bda19b6932775a03fbaac"/></dir><dir name="redirect"><file name="checkout.phtml" hash="caee38fbfc90ebc340730b83066486d3"/><file name="direct.phtml" hash="caee38fbfc90ebc340730b83066486d3"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EMerchantPay_Genesis.xml" hash="83879cf40aba5587eecc86c162398e43"/></dir></target><target name="magelocale"><dir name="en_GB"><file name="EMerchantPay_Genesis.csv" hash="4bfb9000f103576377a939c945860e1c"/></dir><dir name="en_US"><file name="EMerchantPay_Genesis.csv" hash="4bfb9000f103576377a939c945860e1c"/></dir></target><target name="magelib"><dir name="Genesis"><dir name="src"><dir name="Genesis"><dir name="API"><dir name="Constants"><file name="Banks.php" hash="b7b1fc98be9aa2c0e2bd7c03086ca397"/><file name="Endpoints.php" hash="2036dc4c26f6e7418d5ce198170f96a1"/><file name="Environments.php" hash="4054e40a140cd9b4010a49e7928457f4"/><file name="Errors.php" hash="434b001eb137e74e654020d63b7c4f72"/><dir name="Payment"><file name="Methods.php" hash="f2c35f1c40452e1eff07182ce25c5154"/></dir><dir name="Transaction"><file name="States.php" hash="52a8c37ba2ab1597b928b5a4de89cdf3"/><file name="Types.php" hash="be445631c5502631115222549d995e97"/></dir><file name="i18n.php" hash="577058e53e7c935e3e883fd4792ee548"/></dir><file name="Notification.php" hash="dfa03ae89de997ef9ac98ec08b51a3b5"/><dir name="Request"><dir name="Financial"><dir name="Alternatives"><file name="ABNiDEAL.php" hash="9ad0d2f75fcdf5b2cb94c78b3b3d6ea3"/><file name="CashU.php" hash="f28471dfff04de6e8e0c7b47aa1c08da"/><file name="POLi.php" hash="31ef3c44fa6c367f207c0633950ec8f1"/><file name="PPRO.php" hash="48ba59d3f53d5b15720b0b4f4e5fbc26"/><file name="Paysafecard.php" hash="83a298fd99434d6c207f1e1f23905061"/><file name="Sofort.php" hash="6cf9bcb7a47eb0ea7c1fa1e97ca5887c"/></dir><file name="Capture.php" hash="4074b82a2cd3ace1e655316c4dcc8064"/><dir name="Cards"><file name="Authorize.php" hash="f8cd42657ba5655af03de32c829f65ea"/><file name="Authorize3D.php" hash="57a35302fa7e08d72ec577169b64fd3c"/><file name="Credit.php" hash="a24fb37241999072f55319baf5056415"/><file name="Payout.php" hash="dae3a6cb34dc29dc583a8958a82e3628"/><dir name="Recurring"><file name="InitRecurringSale.php" hash="5903a5d82a5eceee4ac266099b708894"/><file name="InitRecurringSale3D.php" hash="ec06f91acaf4ad5d79682ec61058eac2"/><file name="RecurringSale.php" hash="324d2bf186578303a0ad084a78013051"/></dir><file name="Sale.php" hash="84b08a879c9f10b2c766a34de9878207"/><file name="Sale3D.php" hash="f6517e874dc37d123808bfa0ee5a5a1d"/></dir><dir name="PayByVouchers"><file name="Sale.php" hash="ba15cac3f3df1d2a3a103565d653f240"/><file name="oBeP.php" hash="ca980d75f19dc97dc6943efc57607181"/></dir><file name="Refund.php" hash="399b75255fa787009e978053314a6925"/><file name="Void.php" hash="5d8d5744bb55bc4821a06f5b36ab29db"/><dir name="Wallets"><file name="Neteller.php" hash="404e7eb71cb655f9abbc0febb6783a1a"/><file name="WebMoney.php" hash="1a326d4502743c7c63c132e1911e9f78"/><file name="eZeeWallet.php" hash="6cb8d492a5ada59163f4cebad6b0d7dc"/></dir></dir><dir name="NonFinancial"><file name="AVS.php" hash="28c1506a04b88a6e0e3d19a27d00a335"/><file name="AccountVerification.php" hash="bc1e2775bef0a1f23345dac5b24b72f8"/><file name="Blacklist.php" hash="5da01bedc92c6979953d29901c3f113c"/><dir name="Fraud"><dir name="Chargeback"><file name="DateRange.php" hash="fb33c10f6375d145b5e159b883d37f3c"/><file name="Transaction.php" hash="eb8997ced7f9cc45b4df3056415dce3e"/></dir><dir name="Reports"><file name="DateRange.php" hash="53419659a6c5aff80edf0c7a31a31d31"/><file name="Transaction.php" hash="a8dd1ab07cca3537687c126572a39d25"/></dir><dir name="Retrieval"><file name="DateRange.php" hash="899f1bc77c47c6fde65451f2d2257a55"/><file name="Transaction.php" hash="73b7e9bfda8e385ea7dde1dab66bcb63"/></dir></dir><dir name="Reconcile"><file name="DateRange.php" hash="83d388eae9785c04ab2b961496faf490"/><file name="Transaction.php" hash="ed77990ff74e33faf4d26ba5e1cf7431"/></dir><dir name="Retrieve"><file name="AbniDealBanks.php" hash="0c0b187f29a20cf84550dc535e365a6b"/></dir></dir><dir name="WPF"><file name="Create.php" hash="0811c12f5d0c8e378adff45a47b4cacd"/><file name="Reconcile.php" hash="45aa4cd09b512b04a6b5a19c259d45ab"/></dir></dir><file name="Request.php" hash="590d63882937f1c558f1e31fe6add200"/><file name="Response.php" hash="59db1b505572d73f7ba5eb373eb18fde"/></dir><file name="Builder.php" hash="a1d259798cb8a118d59b2f3c5a313e3e"/><dir name="Builders"><file name="JSON.php" hash="387f44beabc6271d60cfdfa4de42b2b0"/><file name="XML.php" hash="c5dc6d4dcef1036c154e2833d21819c4"/></dir><dir name="Certificates"><file name="ca-bundle.pem" hash="1d4f036201f82a743da147db09a6d8ca"/></dir><file name="Config.php" hash="64dbe2e28f76856d2f60e3ba3f442d00"/><dir name="Exceptions"><file name="EnvironmentNotSet.php" hash="a6f425cd8922b3615fa79cc9885328e9"/><file name="ErrorAPI.php" hash="f437c2e2423397ceaee0491e5e43d136"/><file name="ErrorNetwork.php" hash="ef4686482899ebfa53a79dd470fb751c"/><file name="ErrorParameter.php" hash="c9518f203b97e168c7db12e091635946"/><file name="InvalidArgument.php" hash="6c0f4c620ec5fda8cb46e3ff9c61d07d"/><file name="InvalidMethod.php" hash="f90abed4eb6a22d6c77da9a2c60ad5c9"/><file name="InvalidResponse.php" hash="0bab84b8816d83418062dc960648ca30"/></dir><file name="Genesis.php" hash="c14b9c20cbc534f09e891332a2794ded"/><dir name="Interfaces"><file name="Builder.php" hash="ce3aaa42bf5be788488142c420e2160f"/><file name="Network.php" hash="97f13f574a31683fd25c69b930a4b39d"/><file name="Parser.php" hash="391f365d54bfd245e901f56071238c0f"/></dir><dir name="Network"><file name="Stream.php" hash="36b286e49b6b998a883511f9902f8a5a"/><file name="cURL.php" hash="e3534bf2e3254343b0cd344d9eca6b77"/></dir><file name="Network.php" hash="9a7152dd32fee74a103e08eef03c7bbf"/><file name="Parser.php" hash="b32834c751a57c9cc2e971792d125aa0"/><dir name="Parsers"><file name="XML.php" hash="7c8c64ea006668a25b0aa0cb882425d7"/></dir><dir name="Utils"><file name="Common.php" hash="93564ae823ffe4a1cc90c772484f567f"/><file name="Country.php" hash="53890c12438b00a5908d3a4f7f92c785"/><file name="Currency.php" hash="29fc4143a6ed046917fef3fd3286b811"/><file name="Requirements.php" hash="f2b8ab0a131e878ff35d30d7512dd133"/></dir></dir></dir><dir name="vendor"><file name="autoload.php" hash="59c384c9fd04a63a1609c0c507cdc384"/><dir name="composer"><file name="ClassLoader.php" hash="479613a7d15cfdf2bcdf0399a032ff9a"/><file name="LICENSE" hash="caa653f07bb161e830d67b0ab35dd642"/><file name="autoload_classmap.php" hash="8645d3a4e3ad87e7cf4d88a46717aab4"/><file name="autoload_namespaces.php" hash="af4fa780231e7182bbd1430a1973a21d"/><file name="autoload_psr4.php" hash="dd3a00f0d13eb29781edd8c77d4c5100"/><file name="autoload_real.php" hash="a80c290f6d5d3cc4b7d03108d55b36eb"/><file name="installed.json" hash="30a799458964967a17ca693a6b2d1c65"/></dir></dir></dir></target></contents>
|
22 |
+
<compatible/>
|
23 |
+
<dependencies><required><php><min>5.3.2</min><max>7.0.2</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max/></package><extension><name>bcmath</name><min/><max/></extension><extension><name>curl</name><min/><max/></extension><extension><name>filter</name><min/><max/></extension><extension><name>hash</name><min/><max/></extension><extension><name>xmlreader</name><min/><max/></extension><extension><name>xmlwriter</name><min/><max/></extension></required></dependencies>
|
24 |
+
</package>
|