Version Notes
Version 3.1.5
* Magento Code Standards Compliance
Version 3.1.4
* Implemented MobilePay Online payment method
Version 3.1.3
* Improved order lines and capture rounding issue workaround
Version 3.1.2
* Fixed install script bug
Version 3.1.1
* Implemented Gift Card Method
* Implemented Electronic Value Codes Method
Version 3.1.0
* Implemented PayEx Billing Agreement Method
* Removed PayEx AutoPay Method
Version 3.0.3
* Improvements of Social Security Number addon
* Improvements of Payment Fee feature
* Option: Perform validation of SSN before checkout
* Option: Discount calculation mode
* Option: Credit Check for Invoice method
* Removed unnecessary info that is presented to end user
* AutoPay frontend changes
* PartPayment fixes
* More descriptions for error codes
* Added Unit Tests
Version 3.0.2
* Social Security Number: Use secure base URL
* Added Missing Block: payex/invoice_totals_fee
* Fixed capturing
* Fixed invoicing
* Set to inactive status of payment methods by default
* Updated Px library
Version 3.0.1
* Implemented Swish Payment Method
* Financing Invoice: Invoice link
* Fixed payex account problem for multiple stores
Version 3.0.0
* Init release of PayEx Payments module
* Payment modules have been assembled in a single module
* Integrated "Social Security Number" module
* Implemented PayEx Faktura (Financing Invoice)
* Implemented PayEx Delbetala (PartPayment)
* Implemented PayEx Invoice (Ledger Service)
* Implemented MasterPass Payments
* Social Security Number: IWD_Opc support
* Taxable discounts
* Taxable fees
* Option: Send order lines and billing/delivery addresses to PayEx
* Option: Replace illegal characters of product names
* Tune: Use order_id instead customer_id for productNumber
* Improved Transaction Callback
* Install using modman
* Many various code changes and fixes
* Removed deprecated code
Version 2.0.31
* Fixed bug with wrong order state when capture via backend
Version 2.0.30
* Improved update checker
Version 2.0.29
* PayEx Payment Page 2.0 for 'Credit Card' and 'Direct Debit' views
Version 2.0.28
* Improved rounding issue workaround
Version 2.0.27
* Added Reward points support
Version 2.0.26
* Improved transaction processing
* Set correct order state
* Sending mail when failed payments
Version 2.0.25
* Fixed problem with handling of canceled transactions
Version 2.0.24
* Fixed problem "The transaction "xxx" (capture) is already closed"
* Removed unused functions
* Minor changes
Version 2.0.23
* Fixed problems with order state
* Small bugfixes
Version 2.0.22
* Fixed bug with empty invoice totals
* Updated Px library to 2.0.1
Version 2.0.21
* Fixed problem with empty TotalPaid value
* Fixed problem with empty tax for bundled product
* Small bugfixes
* Added version hint
Version 2.0.20
* Fixed problem with downloadable products
Version 2.0.19
* Fixed bug with multiple currencies setup
* Use Initialize8, Capture5, Credit5
* Updated Px library (moved to lib directory)
* Removed deprecated code
* Various bugfixes
Version 2.0.18
* Responsive Skinning
Version 2.0.17
* Fixed rounding issue
Version 2.0.16
* Added PayPal Payment View
* Saving the refunded/canceled/failed transactions.
* Verbose error messages
* Save cart when fails
* Updated translations
* Bugfixes
Version 2.0.15
* Fixed multi store support
Version 2.0.14
* Updated Payex Library
Version 2.0.13
* Enabled Partial Refund in Invoice
Version 2.0.12
* Fixed rounding error bug
Version 2.0.11
* Fixed CodeOrder_AmountNotEqualOrderLinesTotal
Version 2.0.10
* Fix amount bug in AddOrderLine function
* Fixed some bugs in order statuses
Version 2.0.9
* Fixed Tax Calc bug
* Fixed CodeOrder_AmountNotEqualOrderLinesTotal
Version 2.0.8
* Improved Order Info
* Added Order Info in PDF Invoice
Version 2.0.7
* Fixed bug with order (in sale mode the order is not finalized)
* Fixed bug with refund
* Moved design templates in base directory
Version 2.0.6
* Fixed bug with wrong capture/refund amount
Version 2.0.5
* Added options for cleaning time in Payment Config
Version 2.0.4
* Fixed Pending Order Cleaner bug
Version 2.0.3
* Many bugfixes
Version 2.0.2
* Division by zero fix (When Shipping is 0)
Version 2.0.1
* Rewrited API Helper
Version 2.0.0
* Changend namespace
* Rewrited payment engine
* Added Translations
* Bugfixes
Version 1.2.3-r20120329
* Added compatibility with AAIT PayEx Core
Version 1.2.3
* Small bugfixes
Version 1.2.2
* Fixed DirectDebit bug (Payment Cancel)
* Added option "Payment Type" in the settings panel.
* Small bugfixes
Version 1.2.1
* Small bugfixes
Version 1.2.0
* Required PayEx Core module v1.0.1
* Transaction fetching
* Bugfixes
Release Info
Developer | AAIT |
Extension | PayEx_Payments |
Version | 3.1.5 |
Comparing to | |
See all releases |
Code changes from version 3.1.1 to 3.1.5
- Changelog_payex.txt +12 -0
- app/code/community/PayEx/Payments/Block/Adminhtml/Config/Hint.php +2 -2
- app/code/community/PayEx/Payments/Block/Bankdebit/Banks.php +12 -6
- app/code/community/PayEx/Payments/Block/Form/Billing/Agreement.php +2 -0
- app/code/community/PayEx/Payments/Block/Form/CC.php +2 -2
- app/code/community/PayEx/Payments/Block/Form/Mobilepay.php +10 -0
- app/code/community/PayEx/Payments/Block/Info/Billing/Agreement.php +4 -2
- app/code/community/PayEx/Payments/Block/Info/Mobilepay.php +96 -0
- app/code/community/PayEx/Payments/Block/MasterPass/Button.php +2 -1
- app/code/community/PayEx/Payments/Helper/Api.php +11 -7
- app/code/community/PayEx/Payments/Helper/Order.php +244 -391
- app/code/community/PayEx/Payments/Helper/Tools.php +4 -2
- app/code/community/PayEx/Payments/Model/Observer.php +1 -0
- app/code/community/PayEx/Payments/Model/Payment/Bankdebit.php +2 -0
- app/code/community/PayEx/Payments/Model/Payment/CC.php +18 -8
- app/code/community/PayEx/Payments/Model/Payment/Financing.php +12 -6
- app/code/community/PayEx/Payments/Model/Payment/Invoice.php +14 -6
- app/code/community/PayEx/Payments/Model/Payment/MasterPass.php +16 -1
- app/code/community/PayEx/Payments/Model/Payment/Mobilepay.php +445 -0
- app/code/community/PayEx/Payments/Model/Payment/PartPayment.php +12 -6
- app/code/community/PayEx/Payments/Model/Payment/Swish.php +2 -0
- app/code/community/PayEx/Payments/Model/Payment/Wywallet.php +15 -1
- app/code/community/PayEx/Payments/Model/Quote/Tax.php +5 -2
- app/code/community/PayEx/Payments/Model/Quote/Total.php +4 -2
- app/code/community/PayEx/Payments/Model/Source/PaymentAction.php +18 -1
- app/code/community/PayEx/Payments/Model/Source/ShippingMethod.php +1 -1
- app/code/community/PayEx/Payments/Test/Helper/Order.php +2 -2
- app/code/community/PayEx/Payments/Test/Helper/Tools.php +1 -0
- app/code/community/PayEx/Payments/controllers/BankdebitController.php +39 -7
- app/code/community/PayEx/Payments/controllers/EvcController.php +2 -2
- app/code/community/PayEx/Payments/controllers/FinancingController.php +1 -0
- app/code/community/PayEx/Payments/controllers/GcController.php +2 -2
- app/code/community/PayEx/Payments/controllers/InvoiceController.php +34 -3
- app/code/community/PayEx/Payments/controllers/MasterpassController.php +21 -20
- app/code/community/PayEx/Payments/controllers/MobilepayController.php +104 -0
- app/code/community/PayEx/Payments/controllers/PartpaymentController.php +1 -0
- app/code/community/PayEx/Payments/controllers/PaymentController.php +38 -6
- app/code/community/PayEx/Payments/controllers/SwishController.php +39 -7
- app/code/community/PayEx/Payments/controllers/TransactionController.php +66 -38
- app/code/community/PayEx/Payments/controllers/WywalletController.php +38 -6
- app/code/community/PayEx/Payments/data/payex_setup/data-upgrade-3.0.3-3.1.0.php +81 -79
- app/code/community/PayEx/Payments/etc/config.xml +18 -1
- app/code/community/PayEx/Payments/etc/system.xml +146 -0
- app/code/community/PayEx/Payments/sql/payex_setup/install-3.0.0.php +4 -2
- app/design/adminhtml/default/default/template/payex/mobilepay/form.phtml +18 -0
- app/design/adminhtml/default/default/template/payex/mobilepay/info.phtml +19 -0
- app/design/adminhtml/default/default/template/payex/mobilepay/pdf/info.phtml +16 -0
- app/design/adminhtml/default/default/template/payex/mobilepay/title.phtml +1 -0
- app/design/frontend/base/default/template/payex/mobilepay/form.phtml +18 -0
- app/design/frontend/base/default/template/payex/mobilepay/info.phtml +19 -0
- app/design/frontend/base/default/template/payex/mobilepay/pdf/info.phtml +16 -0
- app/design/frontend/base/default/template/payex/mobilepay/title.phtml +1 -0
- app/etc/modules/PayEx_Payments.xml +1 -1
- js/payex/iwd_opc/social_security_number.js +1 -0
- js/payex/social_security_number.js +1 -0
- lib/PHP-Name-Parser/README.md +47 -47
- lib/PHP-Name-Parser/examples.php +0 -283
- lib/PHP-Name-Parser/parser.php +559 -453
- lib/PHP-Name-Parser/tests/FullNameParserTest.php +0 -477
- lib/PHP-Name-Parser/tests/phpunit.xml +0 -27
- lib/PHP-Name-Parser/tests/style.css +0 -21
- lib/PayEx.Ecommerce.Php/README.md +2 -2
- lib/PayEx.Ecommerce.Php/src/PayEx/Px.php +29 -29
- lib/PayEx.Ecommerce.Php/tests/.gitignore +0 -1
- lib/PayEx.Ecommerce.Php/tests/ExceptionTest.php +0 -48
- lib/PayEx.Ecommerce.Php/tests/PaymentTest.php +0 -42
- lib/PayEx.Ecommerce.Php/tests/SocialSecurityNumberTest.php +0 -60
- lib/PayEx.Ecommerce.Php/tests/TestCase.php +0 -27
- lib/PayEx.Ecommerce.Php/tests/bootstrap.php +0 -15
- lib/PayEx.Ecommerce.Php/tests/config.ini +0 -4
- lib/PayEx.Ecommerce.Php/tests/phpunit.xml +0 -2
- package.xml +18 -6
- skin/adminhtml/base/default/images/payex/mobilepay_online.png +0 -0
- skin/frontend/base/default/images/payex/mobilepay_online.png +0 -0
@@ -1,3 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
Version 3.1.1
|
2 |
* Implemented Gift Card Method
|
3 |
* Implemented Electronic Value Codes Method
|
1 |
+
Version 3.1.5
|
2 |
+
* Magento Code Standards Compliance
|
3 |
+
|
4 |
+
Version 3.1.4
|
5 |
+
* Implemented MobilePay Online payment method
|
6 |
+
|
7 |
+
Version 3.1.3
|
8 |
+
* Improved order lines and capture rounding issue workaround
|
9 |
+
|
10 |
+
Version 3.1.2
|
11 |
+
* Fixed install script bug
|
12 |
+
|
13 |
Version 3.1.1
|
14 |
* Implemented Gift Card Method
|
15 |
* Implemented Electronic Value Codes Method
|
@@ -22,8 +22,8 @@ class PayEx_Payments_Block_Adminhtml_Config_Hint extends Mage_Adminhtml_Block_Ab
|
|
22 |
$last_version = $availableVersions['PayEx_Payments']['version'];
|
23 |
}
|
24 |
|
25 |
-
$this->assign('current_version',
|
26 |
-
$this->assign('last_version',
|
27 |
Mage::getSingleton('adminhtml/session')->setIsPayexHintShowed(true);
|
28 |
return $this->toHtml();
|
29 |
}
|
22 |
$last_version = $availableVersions['PayEx_Payments']['version'];
|
23 |
}
|
24 |
|
25 |
+
$this->assign('current_version', $current_version);
|
26 |
+
$this->assign('last_version', $last_version);
|
27 |
Mage::getSingleton('adminhtml/session')->setIsPayexHintShowed(true);
|
28 |
return $this->toHtml();
|
29 |
}
|
@@ -8,7 +8,8 @@ class PayEx_Payments_Block_Bankdebit_Banks extends Mage_Core_Block_Abstract impl
|
|
8 |
* Get Block Html
|
9 |
* @return mixed
|
10 |
*/
|
11 |
-
protected function _toHtml()
|
|
|
12 |
$options = $this->getOptions();
|
13 |
|
14 |
$select = Mage::app()->getLayout()->createBlock('core/html_select')
|
@@ -25,7 +26,8 @@ class PayEx_Payments_Block_Bankdebit_Banks extends Mage_Core_Block_Abstract impl
|
|
25 |
* Set Options
|
26 |
* @param $options
|
27 |
*/
|
28 |
-
public function setOptions($options)
|
|
|
29 |
$this->_options = $options;
|
30 |
}
|
31 |
|
@@ -33,10 +35,12 @@ class PayEx_Payments_Block_Bankdebit_Banks extends Mage_Core_Block_Abstract impl
|
|
33 |
* Get Options
|
34 |
* @return array|null
|
35 |
*/
|
36 |
-
public function getOptions()
|
37 |
-
|
|
|
38 |
return $this->getAvailableBanks();
|
39 |
}
|
|
|
40 |
return $this->_options;
|
41 |
}
|
42 |
|
@@ -44,17 +48,19 @@ class PayEx_Payments_Block_Bankdebit_Banks extends Mage_Core_Block_Abstract impl
|
|
44 |
* Get Available Banks
|
45 |
* @return array
|
46 |
*/
|
47 |
-
public function getAvailableBanks()
|
|
|
48 |
$selected_banks = Mage::getStoreConfig('payment/payex_bankdebit/banks');
|
49 |
$selected_banks = explode(',', $selected_banks);
|
50 |
$banks = Mage::getModel('payex/source_banks')->toOptionArray();
|
51 |
|
52 |
$result = array();
|
53 |
foreach($banks as $current) {
|
54 |
-
if (
|
55 |
$result[] = $current;
|
56 |
}
|
57 |
}
|
|
|
58 |
return $result;
|
59 |
}
|
60 |
}
|
8 |
* Get Block Html
|
9 |
* @return mixed
|
10 |
*/
|
11 |
+
protected function _toHtml()
|
12 |
+
{
|
13 |
$options = $this->getOptions();
|
14 |
|
15 |
$select = Mage::app()->getLayout()->createBlock('core/html_select')
|
26 |
* Set Options
|
27 |
* @param $options
|
28 |
*/
|
29 |
+
public function setOptions($options)
|
30 |
+
{
|
31 |
$this->_options = $options;
|
32 |
}
|
33 |
|
35 |
* Get Options
|
36 |
* @return array|null
|
37 |
*/
|
38 |
+
public function getOptions()
|
39 |
+
{
|
40 |
+
if (count($this->_options) === 0) {
|
41 |
return $this->getAvailableBanks();
|
42 |
}
|
43 |
+
|
44 |
return $this->_options;
|
45 |
}
|
46 |
|
48 |
* Get Available Banks
|
49 |
* @return array
|
50 |
*/
|
51 |
+
public function getAvailableBanks()
|
52 |
+
{
|
53 |
$selected_banks = Mage::getStoreConfig('payment/payex_bankdebit/banks');
|
54 |
$selected_banks = explode(',', $selected_banks);
|
55 |
$banks = Mage::getModel('payex/source_banks')->toOptionArray();
|
56 |
|
57 |
$result = array();
|
58 |
foreach($banks as $current) {
|
59 |
+
if (in_array($current['value'], $selected_banks)) {
|
60 |
$result[] = $current;
|
61 |
}
|
62 |
}
|
63 |
+
|
64 |
return $result;
|
65 |
}
|
66 |
}
|
@@ -25,6 +25,7 @@ class PayEx_Payments_Block_Form_Billing_Agreement extends Mage_Payment_Block_For
|
|
25 |
if (!$quote || !$quote->getCustomer()) {
|
26 |
return $data;
|
27 |
}
|
|
|
28 |
$collection = Mage::getModel('sales/billing_agreement')->getAvailableCustomerBillingAgreements(
|
29 |
$quote->getCustomer()->getId()
|
30 |
);
|
@@ -32,6 +33,7 @@ class PayEx_Payments_Block_Form_Billing_Agreement extends Mage_Payment_Block_For
|
|
32 |
foreach ($collection as $item) {
|
33 |
$data[$item->getId()] = $item->getAgreementLabel();
|
34 |
}
|
|
|
35 |
return $data;
|
36 |
}
|
37 |
}
|
25 |
if (!$quote || !$quote->getCustomer()) {
|
26 |
return $data;
|
27 |
}
|
28 |
+
|
29 |
$collection = Mage::getModel('sales/billing_agreement')->getAvailableCustomerBillingAgreements(
|
30 |
$quote->getCustomer()->getId()
|
31 |
);
|
33 |
foreach ($collection as $item) {
|
34 |
$data[$item->getId()] = $item->getAgreementLabel();
|
35 |
}
|
36 |
+
|
37 |
return $data;
|
38 |
}
|
39 |
}
|
@@ -16,13 +16,13 @@ class PayEx_Payments_Block_Form_CC extends Mage_Payment_Block_Form
|
|
16 |
protected function _beforeToHtml()
|
17 |
{
|
18 |
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
19 |
-
if (
|
20 |
-
$customerId > 0 &&
|
21 |
Mage::helper('payex')->isBillingAgreementAvailable() &&
|
22 |
$this->canCreateBillingAgreement()
|
23 |
) {
|
24 |
$this->setCreateBACode(PayEx_Payments_Model_Payment_Agreement::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
|
25 |
}
|
|
|
26 |
return parent::_beforeToHtml();
|
27 |
}
|
28 |
}
|
16 |
protected function _beforeToHtml()
|
17 |
{
|
18 |
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
19 |
+
if ($customerId > 0 &&
|
|
|
20 |
Mage::helper('payex')->isBillingAgreementAvailable() &&
|
21 |
$this->canCreateBillingAgreement()
|
22 |
) {
|
23 |
$this->setCreateBACode(PayEx_Payments_Model_Payment_Agreement::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
|
24 |
}
|
25 |
+
|
26 |
return parent::_beforeToHtml();
|
27 |
}
|
28 |
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PayEx_Payments_Block_Form_Mobilepay extends Mage_Payment_Block_Form
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->setTemplate('payex/mobilepay/form.phtml');
|
9 |
+
}
|
10 |
+
}
|
@@ -23,9 +23,11 @@ class PayEx_Payments_Block_Info_Billing_Agreement extends Mage_Payment_Block_Inf
|
|
23 |
$referenceID = $info->getAdditionalInformation(
|
24 |
Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID
|
25 |
);
|
26 |
-
$transport = new Varien_Object(
|
|
|
27 |
$this->__('Reference ID') => $referenceID,
|
28 |
-
|
|
|
29 |
if (!empty($referenceID)) {
|
30 |
/** @var Mage_Sales_Model_Billing_Agreement $billing_agreement */
|
31 |
$billing_agreement = Mage::getModel('sales/billing_agreement')->load($referenceID, 'reference_id');
|
23 |
$referenceID = $info->getAdditionalInformation(
|
24 |
Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID
|
25 |
);
|
26 |
+
$transport = new Varien_Object(
|
27 |
+
array(
|
28 |
$this->__('Reference ID') => $referenceID,
|
29 |
+
)
|
30 |
+
);
|
31 |
if (!empty($referenceID)) {
|
32 |
/** @var Mage_Sales_Model_Billing_Agreement $billing_agreement */
|
33 |
$billing_agreement = Mage::getModel('sales/billing_agreement')->load($referenceID, 'reference_id');
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PayEx_Payments_Block_Info_Mobilepay extends Mage_Payment_Block_Info
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
|
9 |
+
$this->setTemplate('payex/mobilepay/info.phtml');
|
10 |
+
// Template for Checkout page
|
11 |
+
if ($this->getRequest()->getRequestedActionName() === 'progress') {
|
12 |
+
$this->setTemplate('payex/mobilepay/title.phtml');
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Returns code of payment method
|
19 |
+
*
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public function getMethodCode()
|
23 |
+
{
|
24 |
+
return $this->getInfo()->getMethodInstance()->getCode();
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Get some specific information in format of array($label => $value)
|
29 |
+
*
|
30 |
+
* @return array
|
31 |
+
*/
|
32 |
+
public function getSpecificInformation()
|
33 |
+
{
|
34 |
+
// Get Payment Info
|
35 |
+
$_info = $this->getInfo();
|
36 |
+
|
37 |
+
// Transaction Fields
|
38 |
+
$fields = array(
|
39 |
+
'PayEx Payment Method' => array('paymentMethod', 'cardProduct'),
|
40 |
+
//'Masked Number' => array('maskedNumber', 'maskedCard'),
|
41 |
+
//'Bank Hash' => array('BankHash', 'csId', 'panId'),
|
42 |
+
//'Bank Reference' => array('bankReference'),
|
43 |
+
'Authenticated Status' => array('AuthenticatedStatus', 'authenticatedStatus'),
|
44 |
+
'Transaction Ref' => array('transactionRef'),
|
45 |
+
'PayEx Transaction Number' => array('transactionNumber'),
|
46 |
+
'PayEx Transaction Status' => array('transactionStatus'),
|
47 |
+
'Transaction Error Code' => array('transactionErrorCode'),
|
48 |
+
'Transaction Error Description' => array('transactionErrorDescription'),
|
49 |
+
'Transaction ThirdParty Error' => array('transactionThirdPartyError')
|
50 |
+
);
|
51 |
+
|
52 |
+
if ($_info) {
|
53 |
+
$transactionId = $_info->getLastTransId();
|
54 |
+
|
55 |
+
if ($transactionId) {
|
56 |
+
// Load transaction
|
57 |
+
$transaction = $_info->getTransaction($transactionId);
|
58 |
+
if ($transaction) {
|
59 |
+
$transaction_data = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
60 |
+
if (!$transaction_data) {
|
61 |
+
$payment = $_info->getOrder()->getPayment();
|
62 |
+
$transaction_data = $payment->getMethodInstance()->fetchTransactionInfo($payment, $transactionId);
|
63 |
+
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $transaction_data);
|
64 |
+
$transaction->save();
|
65 |
+
}
|
66 |
+
|
67 |
+
$result = array();
|
68 |
+
foreach ($fields as $description => $list) {
|
69 |
+
foreach ($list as $key => $value) {
|
70 |
+
if (!empty($transaction_data[$value])) {
|
71 |
+
$result[$description] = $transaction_data[$value];
|
72 |
+
break;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
return $result;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
// @todo Info in email when invoicing
|
83 |
+
return $this->_prepareSpecificInformation()->getData();
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Build PDF content of info block
|
88 |
+
*
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
public function toPdf()
|
92 |
+
{
|
93 |
+
$this->setTemplate('payex/mobilepay/pdf/info.phtml');
|
94 |
+
return $this->toHtml();
|
95 |
+
}
|
96 |
+
}
|
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class PayEx_Payments_Block_MasterPass_Button extends Mage_Core_Block_Template
|
|
|
4 |
/**
|
5 |
* Get MasterPass Checkout URL
|
6 |
* @return string
|
1 |
<?php
|
2 |
|
3 |
+
class PayEx_Payments_Block_MasterPass_Button extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
/**
|
6 |
* Get MasterPass Checkout URL
|
7 |
* @return string
|
@@ -20,14 +20,18 @@ class PayEx_Payments_Helper_Api extends Mage_Core_Helper_Abstract
|
|
20 |
// Set User Agent
|
21 |
$modules = Mage::getConfig()->getNode('modules')->children();
|
22 |
$modulesArray = (array)$modules;
|
23 |
-
self::$_px->setUserAgent(
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
30 |
}
|
|
|
31 |
return self::$_px;
|
32 |
}
|
33 |
}
|
20 |
// Set User Agent
|
21 |
$modules = Mage::getConfig()->getNode('modules')->children();
|
22 |
$modulesArray = (array)$modules;
|
23 |
+
self::$_px->setUserAgent(
|
24 |
+
sprintf(
|
25 |
+
"PayEx.Ecommerce.Php/%s PHP/%s Magento%s/%s PayEx.Magento/%s",
|
26 |
+
\PayEx\Px::VERSION,
|
27 |
+
phpversion(),
|
28 |
+
Mage::getEdition(),
|
29 |
+
Mage::getVersion(),
|
30 |
+
(string)$modulesArray['PayEx_Payments']->version
|
31 |
+
)
|
32 |
+
);
|
33 |
}
|
34 |
+
|
35 |
return self::$_px;
|
36 |
}
|
37 |
}
|
@@ -3,30 +3,30 @@
|
|
3 |
class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
public function processPaymentTransaction(Mage_Sales_Model_Order $order, array $fields)
|
15 |
{
|
16 |
// Lookup Transaction
|
17 |
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
18 |
->addAttributeToFilter('txn_id', $fields['transactionNumber']);
|
19 |
if (count($collection) > 0) {
|
20 |
-
|
21 |
return $collection->getFirstItem();
|
22 |
}
|
23 |
|
24 |
-
|
25 |
$payment = $order->getPayment();
|
26 |
$payment->setTransactionId($fields['transactionNumber']);
|
27 |
|
28 |
/* Transaction statuses: 0=Sale, 1=Initialize, 2=Credit, 3=Authorize, 4=Cancel, 5=Failure, 6=Capture */
|
29 |
-
|
30 |
switch ($transaction_status) {
|
31 |
case 1:
|
32 |
// From PayEx PIM:
|
@@ -38,11 +38,11 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
38 |
$transaction->setIsClosed(0);
|
39 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
40 |
$transaction->setMessage($message);
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
|
45 |
-
|
46 |
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT, null, true, $message);
|
47 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
48 |
$transaction->setMessage($message);
|
@@ -54,7 +54,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
54 |
$transaction->setIsClosed(0);
|
55 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
56 |
$transaction->setMessage($message);
|
57 |
-
|
58 |
break;
|
59 |
case 0;
|
60 |
case 6:
|
@@ -63,14 +63,14 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
63 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
64 |
$transaction->isFailsafe(true)->close(false);
|
65 |
$transaction->setMessage($message);
|
66 |
-
|
67 |
break;
|
68 |
case 2:
|
69 |
$message = Mage::helper('payex')->__('Detected an abnormal payment process (Transaction Status: %s).', $transaction_status);
|
70 |
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT, null, true, $message);
|
71 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
72 |
$transaction->setMessage($message);
|
73 |
-
|
74 |
$transaction->save();
|
75 |
break;
|
76 |
case 4;
|
@@ -78,7 +78,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
78 |
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT, null, true);
|
79 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
80 |
$transaction->setMessage($message);
|
81 |
-
|
82 |
$transaction->save();
|
83 |
break;
|
84 |
case 5;
|
@@ -87,7 +87,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
87 |
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT, null, true);
|
88 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
89 |
$transaction->setMessage($message);
|
90 |
-
|
91 |
$transaction->save();
|
92 |
break;
|
93 |
default:
|
@@ -98,12 +98,12 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
98 |
break;
|
99 |
}
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
|
108 |
return $transaction;
|
109 |
}
|
@@ -163,6 +163,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
163 |
if (!$order_id) {
|
164 |
return false;
|
165 |
}
|
|
|
166 |
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
167 |
->addOrderIdFilter($order_id)
|
168 |
->setOrder('transaction_id', 'ASC')
|
@@ -190,12 +191,14 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
190 |
} else {
|
191 |
$creditmemo = $service->prepareCreditmemo();
|
192 |
}
|
|
|
193 |
$creditmemo->addComment(Mage::helper('payex')->__('Auto-generated from PayEx module'));
|
194 |
|
195 |
// Refund
|
196 |
if (!$online) {
|
197 |
$creditmemo->setPaymentRefundDisallowed(true);
|
198 |
}
|
|
|
199 |
//$creditmemo->setRefundRequested(true);
|
200 |
$invoice->getOrder()->setBaseTotalRefunded(0);
|
201 |
$creditmemo->setBaseGrandTotal($amount);
|
@@ -206,6 +209,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
206 |
if ($transactionId) {
|
207 |
$creditmemo->setTransactionId($transactionId);
|
208 |
}
|
|
|
209 |
// Save CreditMemo
|
210 |
$transactionSave = Mage::getModel('core/resource_transaction')
|
211 |
->addObject($creditmemo)
|
@@ -213,6 +217,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
213 |
if ($creditmemo->getInvoice()) {
|
214 |
$transactionSave->addObject($creditmemo->getInvoice());
|
215 |
}
|
|
|
216 |
$transactionSave->save();
|
217 |
|
218 |
return $creditmemo;
|
@@ -235,35 +240,9 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
235 |
// Order amount calculated manually
|
236 |
$amount = 0;
|
237 |
|
238 |
-
|
239 |
-
$
|
240 |
-
|
241 |
-
foreach ($items as $item) {
|
242 |
-
if ($item->getParentItem()) {
|
243 |
-
continue;
|
244 |
-
}
|
245 |
-
|
246 |
-
$amount += (int)(100 * $item->getRowTotalInclTax());
|
247 |
-
}
|
248 |
-
|
249 |
-
// add Shipping
|
250 |
-
if (!$order->getIsVirtual()) {
|
251 |
-
$shippingIncTax = $order->getShippingInclTax();
|
252 |
-
$amount += (int)(100 * $shippingIncTax);
|
253 |
-
}
|
254 |
-
|
255 |
-
// add Discount
|
256 |
-
$discountData = Mage::helper('payex/discount')->getOrderDiscountData($order);
|
257 |
-
$discountInclTax = (int) (100 * $discountData->getDiscountInclTax());
|
258 |
-
$amount += -1 * $discountInclTax;
|
259 |
-
|
260 |
-
// Add reward points
|
261 |
-
$amount += -1 * (int)(100 * $order->getBaseRewardCurrencyAmount());
|
262 |
-
|
263 |
-
// add Fee
|
264 |
-
$fee = $order->getPayexPaymentFee() + $order->getPayexPaymentFeeTax();
|
265 |
-
if ($fee > 0) {
|
266 |
-
$amount += (int)(100 * $fee);
|
267 |
}
|
268 |
|
269 |
// Detect Rounding Issue
|
@@ -276,6 +255,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
276 |
} else {
|
277 |
$rounding = -1 * ($rounded_control_amount - $rounded_total);
|
278 |
}
|
|
|
279 |
$rounding = sprintf("%.2f", $rounding);
|
280 |
}
|
281 |
|
@@ -283,239 +263,6 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
283 |
return $result->setAmount($rounded_control_amount)->setRounding($rounding);
|
284 |
}
|
285 |
|
286 |
-
/**
|
287 |
-
* Add PayEx Single Order Line
|
288 |
-
* @param string $orderRef
|
289 |
-
* @param Mage_Sales_Model_Order $order
|
290 |
-
* @return bool
|
291 |
-
*/
|
292 |
-
public function addOrderLine($orderRef, $order)
|
293 |
-
{
|
294 |
-
// add Order Items
|
295 |
-
$items = $order->getAllVisibleItems();
|
296 |
-
$i = 1;
|
297 |
-
/** @var $item Mage_Sales_Model_Order_Item */
|
298 |
-
foreach ($items as $item) {
|
299 |
-
$itemQty = (int)$item->getQtyOrdered();
|
300 |
-
$priceWithTax = $item->getRowTotalInclTax();
|
301 |
-
$priceWithoutTax = $item->getRowTotal();
|
302 |
-
$taxPercent = (($priceWithTax / $priceWithoutTax) - 1) * 100; // works for all types
|
303 |
-
$taxPrice = $priceWithTax - $priceWithoutTax;
|
304 |
-
|
305 |
-
$params = array(
|
306 |
-
'accountNumber' => '',
|
307 |
-
'orderRef' => $orderRef,
|
308 |
-
'itemNumber' => $i,
|
309 |
-
'itemDescription1' => $item->getName(),
|
310 |
-
'itemDescription2' => '',
|
311 |
-
'itemDescription3' => '',
|
312 |
-
'itemDescription4' => '',
|
313 |
-
'itemDescription5' => '',
|
314 |
-
'quantity' => $itemQty,
|
315 |
-
'amount' => (int)(100 * $priceWithTax), //must include tax
|
316 |
-
'vatPrice' => (int)(100 * $taxPrice),
|
317 |
-
'vatPercent' => (int)(100 * $taxPercent)
|
318 |
-
);
|
319 |
-
|
320 |
-
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
321 |
-
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
322 |
-
$i++;
|
323 |
-
}
|
324 |
-
|
325 |
-
// add Shipping
|
326 |
-
if (!$order->getIsVirtual()) {
|
327 |
-
$shippingExclTax = (int) (100 * $order->getShippingAmount());
|
328 |
-
$shippingIncTax = (int) (100 * $order->getShippingInclTax());
|
329 |
-
$shippingTax = $shippingIncTax - $shippingExclTax;
|
330 |
-
|
331 |
-
// find out tax-rate for the shipping
|
332 |
-
if ((float) $shippingIncTax && (float) $shippingExclTax) {
|
333 |
-
$shippingTaxRate = (($shippingIncTax / $shippingExclTax) - 1) * 100;
|
334 |
-
} else {
|
335 |
-
$shippingTaxRate = 0;
|
336 |
-
}
|
337 |
-
|
338 |
-
$params = array(
|
339 |
-
'accountNumber' => '',
|
340 |
-
'orderRef' => $orderRef,
|
341 |
-
'itemNumber' => $i,
|
342 |
-
'itemDescription1' => $order->getShippingDescription(),
|
343 |
-
'itemDescription2' => '',
|
344 |
-
'itemDescription3' => '',
|
345 |
-
'itemDescription4' => '',
|
346 |
-
'itemDescription5' => '',
|
347 |
-
'quantity' => 1,
|
348 |
-
'amount' => (int)($shippingIncTax),
|
349 |
-
'vatPrice' => (int)($shippingTax),
|
350 |
-
'vatPercent' => (int)(100 * $shippingTaxRate)
|
351 |
-
);
|
352 |
-
|
353 |
-
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
354 |
-
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
355 |
-
$i++;
|
356 |
-
}
|
357 |
-
|
358 |
-
// add Discount
|
359 |
-
$discountData = Mage::helper('payex/discount')->getOrderDiscountData($order);
|
360 |
-
if (abs($discountData->getDiscountInclTax()) > 0) {
|
361 |
-
$discountInclTax = (int) (100 * $discountData->getDiscountInclTax());
|
362 |
-
$discountExclTax = (int) (100 * $discountData->getDiscountExclTax());
|
363 |
-
$discountVatAmount = $discountInclTax - $discountExclTax;
|
364 |
-
$discountVatPercent = (($discountInclTax / $discountExclTax) - 1) * 100;
|
365 |
-
|
366 |
-
$params = array(
|
367 |
-
'accountNumber' => '',
|
368 |
-
'orderRef' => $orderRef,
|
369 |
-
'itemNumber' => $i,
|
370 |
-
'itemDescription1' => ($order->getDiscountDescription() !== null) ? Mage::helper('sales')->__('Discount (%s)', $order->getDiscountDescription()) : Mage::helper('sales')->__('Discount'),
|
371 |
-
'itemDescription2' => '',
|
372 |
-
'itemDescription3' => '',
|
373 |
-
'itemDescription4' => '',
|
374 |
-
'itemDescription5' => '',
|
375 |
-
'quantity' => 1,
|
376 |
-
'amount' => -1 * (int)($discountInclTax),
|
377 |
-
'vatPrice' => -1 * (int) ($discountVatAmount),
|
378 |
-
'vatPercent' => (int) (100 * $discountVatPercent)
|
379 |
-
);
|
380 |
-
|
381 |
-
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
382 |
-
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
383 |
-
$i++;
|
384 |
-
}
|
385 |
-
|
386 |
-
// add Payment Fee
|
387 |
-
if ((float)$order->getPayexPaymentFee() > 0) {
|
388 |
-
$feeExclTax = $order->getPayexPaymentFee();
|
389 |
-
$feeTax = $order->getPayexPaymentFeeTax();
|
390 |
-
$feeIncTax = $feeExclTax + $feeTax;
|
391 |
-
|
392 |
-
// find out tax-rate for the fee
|
393 |
-
if ($feeIncTax > 0 && $feeExclTax > 0) {
|
394 |
-
$feeTaxRate = Mage::app()->getStore()->roundPrice((($feeIncTax / $feeExclTax) - 1) * 100);
|
395 |
-
} else {
|
396 |
-
$feeTaxRate = 0;
|
397 |
-
}
|
398 |
-
|
399 |
-
$params = array(
|
400 |
-
'accountNumber' => '',
|
401 |
-
'orderRef' => $orderRef,
|
402 |
-
'itemNumber' => $i,
|
403 |
-
'itemDescription1' => Mage::helper('payex')->__('Payment fee'),
|
404 |
-
'itemDescription2' => '',
|
405 |
-
'itemDescription3' => '',
|
406 |
-
'itemDescription4' => '',
|
407 |
-
'itemDescription5' => '',
|
408 |
-
'quantity' => 1,
|
409 |
-
'amount' => (int)(100 * $feeIncTax), //must include tax
|
410 |
-
'vatPrice' => (int) (100 * $feeTax),
|
411 |
-
'vatPercent' => (int) (100 * $feeTaxRate)
|
412 |
-
);
|
413 |
-
|
414 |
-
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
415 |
-
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
416 |
-
$i++;
|
417 |
-
}
|
418 |
-
|
419 |
-
// Add reward points
|
420 |
-
if ((float)$order->getBaseRewardCurrencyAmount() > 0) {
|
421 |
-
$params = array(
|
422 |
-
'accountNumber' => '',
|
423 |
-
'orderRef' => $orderRef,
|
424 |
-
'itemNumber' => $i,
|
425 |
-
'itemDescription1' => Mage::helper('payex')->__('Reward points'),
|
426 |
-
'itemDescription2' => '',
|
427 |
-
'itemDescription3' => '',
|
428 |
-
'itemDescription4' => '',
|
429 |
-
'itemDescription5' => '',
|
430 |
-
'quantity' => 1,
|
431 |
-
'amount' => -1 * (int)(100 * $order->getBaseRewardCurrencyAmount()), //must include tax
|
432 |
-
'vatPrice' => 0,
|
433 |
-
'vatPercent' => 0
|
434 |
-
);
|
435 |
-
|
436 |
-
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
437 |
-
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
438 |
-
$i++;
|
439 |
-
}
|
440 |
-
|
441 |
-
return true;
|
442 |
-
}
|
443 |
-
|
444 |
-
/**
|
445 |
-
* Add Payex Order Address
|
446 |
-
* @param $orderRef
|
447 |
-
* @param Mage_Sales_Model_Order $order
|
448 |
-
* @return bool
|
449 |
-
*/
|
450 |
-
public function addOrderAddress($orderRef, $order)
|
451 |
-
{
|
452 |
-
$billingAddress = $order->getBillingAddress()->getStreet();
|
453 |
-
$billingCountryCode = $order->getBillingAddress()->getCountry();
|
454 |
-
$billingCountry = Mage::getModel('directory/country')->load($billingCountryCode)->getName();
|
455 |
-
|
456 |
-
$params = array(
|
457 |
-
'accountNumber' => '',
|
458 |
-
'orderRef' => $orderRef,
|
459 |
-
'billingFirstName' => $order->getBillingAddress()->getFirstname(),
|
460 |
-
'billingLastName' => $order->getBillingAddress()->getLastname(),
|
461 |
-
'billingAddress1' => $billingAddress[0],
|
462 |
-
'billingAddress2' => (isset($billingAddress[1])) ? $billingAddress[1] : '',
|
463 |
-
'billingAddress3' => '',
|
464 |
-
'billingPostNumber' => (string)$order->getBillingAddress()->getPostcode(),
|
465 |
-
'billingCity' => (string)$order->getBillingAddress()->getCity(),
|
466 |
-
'billingState' => (string)$order->getBillingAddress()->getRegion(),
|
467 |
-
'billingCountry' => $billingCountry,
|
468 |
-
'billingCountryCode' => $billingCountryCode,
|
469 |
-
'billingEmail' => (string)$order->getBillingAddress()->getEmail(),
|
470 |
-
'billingPhone' => (string)$order->getBillingAddress()->getTelephone(),
|
471 |
-
'billingGsm' => '',
|
472 |
-
);
|
473 |
-
|
474 |
-
// add Shipping
|
475 |
-
$shipping_params = array(
|
476 |
-
'deliveryFirstName' => '',
|
477 |
-
'deliveryLastName' => '',
|
478 |
-
'deliveryAddress1' => '',
|
479 |
-
'deliveryAddress2' => '',
|
480 |
-
'deliveryAddress3' => '',
|
481 |
-
'deliveryPostNumber' => '',
|
482 |
-
'deliveryCity' => '',
|
483 |
-
'deliveryState' => '',
|
484 |
-
'deliveryCountry' => '',
|
485 |
-
'deliveryCountryCode' => '',
|
486 |
-
'deliveryEmail' => '',
|
487 |
-
'deliveryPhone' => '',
|
488 |
-
'deliveryGsm' => '',
|
489 |
-
);
|
490 |
-
|
491 |
-
if (!$order->getIsVirtual()) {
|
492 |
-
$deliveryAddress = $order->getShippingAddress()->getStreet();
|
493 |
-
$deliveryCountryCode = $order->getShippingAddress()->getCountry();
|
494 |
-
$deliveryCountry = Mage::getModel('directory/country')->load($deliveryCountryCode)->getName();
|
495 |
-
|
496 |
-
$shipping_params = array(
|
497 |
-
'deliveryFirstName' => $order->getShippingAddress()->getFirstname(),
|
498 |
-
'deliveryLastName' => $order->getShippingAddress()->getLastname(),
|
499 |
-
'deliveryAddress1' => $deliveryAddress[0],
|
500 |
-
'deliveryAddress2' => (isset($deliveryAddress[1])) ? $deliveryAddress[1] : '',
|
501 |
-
'deliveryAddress3' => '',
|
502 |
-
'deliveryPostNumber' => (string)$order->getShippingAddress()->getPostcode(),
|
503 |
-
'deliveryCity' => (string)$order->getShippingAddress()->getCity(),
|
504 |
-
'deliveryState' => (string)$order->getShippingAddress()->getRegion(),
|
505 |
-
'deliveryCountry' => $deliveryCountry,
|
506 |
-
'deliveryCountryCode' => $deliveryCountryCode,
|
507 |
-
'deliveryEmail' => (string)$order->getShippingAddress()->getEmail(),
|
508 |
-
'deliveryPhone' => (string)$order->getShippingAddress()->getTelephone(),
|
509 |
-
'deliveryGsm' => '',
|
510 |
-
);
|
511 |
-
}
|
512 |
-
$params += $shipping_params;
|
513 |
-
|
514 |
-
$result = Mage::helper('payex/api')->getPx()->AddOrderAddress2($params);
|
515 |
-
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddOrderAddress2');
|
516 |
-
return true;
|
517 |
-
}
|
518 |
-
|
519 |
/**
|
520 |
* Get Shopping Cart XML for MasterPass
|
521 |
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quote
|
@@ -548,7 +295,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
548 |
}
|
549 |
|
550 |
$ShoppingCartItem = $dom->createElement('ShoppingCartItem');
|
551 |
-
$ShoppingCartItem->appendChild($dom->createElement('Description', $item->getName()));
|
552 |
$ShoppingCartItem->appendChild($dom->createElement('Quantity', (float)$qty));
|
553 |
$ShoppingCartItem->appendChild($dom->createElement('Value', (int)bcmul($product->getFinalPrice(), 100)));
|
554 |
$ShoppingCartItem->appendChild($dom->createElement('ImageURL', $product->getThumbnailUrl()));
|
@@ -566,11 +313,28 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
566 |
*/
|
567 |
public function getInvoiceExtraPrintBlocksXML($order)
|
568 |
{
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
}
|
575 |
|
576 |
$dom = new DOMDocument('1.0', 'utf-8');
|
@@ -583,100 +347,14 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
583 |
$OnlineInvoice->appendChild($OrderLines);
|
584 |
|
585 |
// Add Order Lines
|
586 |
-
$
|
587 |
-
/** @var $item Mage_Sales_Model_Order_Item */
|
588 |
-
foreach ($items as $item) {
|
589 |
-
$itemQty = (int)$item->getQtyOrdered();
|
590 |
-
$priceWithTax = $item->getRowTotalInclTax();
|
591 |
-
$priceWithoutTax = $item->getRowTotal();
|
592 |
-
$taxPercent = round((($priceWithTax / $priceWithoutTax) - 1) * 100); // works for all types
|
593 |
-
$taxPrice = $priceWithTax - $priceWithoutTax;
|
594 |
-
|
595 |
-
$OrderLine = $dom->createElement('OrderLine');
|
596 |
-
$OrderLine->appendChild($dom->createElement('Product', trim(!$replace_illegal ? $item->getName() : mb_ereg_replace('[^a-zA-Z0-9_:!#=?\[\]@{}´ %-\/À-ÖØ-öø-ú]', $replacement_char, $item->getName()))));
|
597 |
-
$OrderLine->appendChild($dom->createElement('Qty', $itemQty));
|
598 |
-
$OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $priceWithoutTax / $itemQty)));
|
599 |
-
$OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $taxPercent)));
|
600 |
-
$OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", $taxPrice)));
|
601 |
-
$OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $priceWithTax)));
|
602 |
-
$OrderLines->appendChild($OrderLine);
|
603 |
-
}
|
604 |
-
|
605 |
-
// Add Shipping Line
|
606 |
-
if (!$order->getIsVirtual()) {
|
607 |
-
$shippingExclTax = $order->getShippingAmount();
|
608 |
-
$shippingIncTax = $order->getShippingInclTax();
|
609 |
-
$shippingTax = $shippingIncTax - $shippingExclTax;
|
610 |
-
|
611 |
-
// find out tax-rate for the shipping
|
612 |
-
if ((float) $shippingIncTax && (float) $shippingExclTax) {
|
613 |
-
$shippingTaxRate = round((($shippingIncTax / $shippingExclTax) - 1) * 100);
|
614 |
-
} else {
|
615 |
-
$shippingTaxRate = 0;
|
616 |
-
}
|
617 |
-
|
618 |
-
$OrderLine = $dom->createElement('OrderLine');
|
619 |
-
$OrderLine->appendChild($dom->createElement('Product', trim(!$replace_illegal ? $order->getShippingDescription() : mb_ereg_replace('[^a-zA-Z0-9_:!#=?\[\]@{}´ %-\/À-ÖØ-öø-ú]', $replacement_char, $order->getShippingDescription()))));
|
620 |
-
$OrderLine->appendChild($dom->createElement('Qty', 1));
|
621 |
-
$OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $shippingExclTax)));
|
622 |
-
$OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $shippingTaxRate)));
|
623 |
-
$OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", $shippingTax)));
|
624 |
-
$OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $shippingIncTax)));
|
625 |
-
$OrderLines->appendChild($OrderLine);
|
626 |
-
}
|
627 |
-
|
628 |
-
// add Payment Fee
|
629 |
-
$fee = $order->getPayexPaymentFee();
|
630 |
-
if ($fee > 0) {
|
631 |
-
$feeExclTax = $order->getPayexPaymentFee();
|
632 |
-
$feeTax = $order->getPayexPaymentFeeTax();
|
633 |
-
$feeIncTax = $feeExclTax + $feeTax;
|
634 |
-
|
635 |
-
// find out tax-rate for the fee
|
636 |
-
if ($feeIncTax > 0 && $feeExclTax > 0) {
|
637 |
-
$feeTaxRate = round((($feeIncTax / $feeExclTax) - 1) * 100);
|
638 |
-
} else {
|
639 |
-
$feeTaxRate = 0;
|
640 |
-
}
|
641 |
-
|
642 |
$OrderLine = $dom->createElement('OrderLine');
|
643 |
-
$OrderLine->appendChild($dom->createElement('Product',
|
644 |
-
$OrderLine->appendChild($dom->createElement('Qty',
|
645 |
-
$OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $
|
646 |
-
$OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $
|
647 |
-
$OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", $
|
648 |
-
$OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $
|
649 |
-
$OrderLines->appendChild($OrderLine);
|
650 |
-
}
|
651 |
-
|
652 |
-
// add Discount
|
653 |
-
$discountData = Mage::helper('payex/discount')->getOrderDiscountData($order);
|
654 |
-
if (abs($discountData->getDiscountInclTax()) > 0) {
|
655 |
-
$discountInclTax = $discountData->getDiscountInclTax();
|
656 |
-
$discountExclTax = $discountData->getDiscountExclTax();
|
657 |
-
$discountVatAmount = $discountInclTax - $discountExclTax;
|
658 |
-
$discountVatPercent = round((($discountInclTax / $discountExclTax) - 1) * 100);
|
659 |
-
$discount_description = ($order->getDiscountDescription() !== null) ? Mage::helper('sales')->__('Discount (%s)', $order->getDiscountDescription()) : Mage::helper('sales')->__('Discount');
|
660 |
-
|
661 |
-
$OrderLine = $dom->createElement('OrderLine');
|
662 |
-
$OrderLine->appendChild($dom->createElement('Product', trim(!$replace_illegal ? $discount_description : mb_ereg_replace('[^a-zA-Z0-9_:!#=?\[\]@{}´ %-\/À-ÖØ-öø-ú]', $replacement_char, $discount_description))));
|
663 |
-
$OrderLine->appendChild($dom->createElement('Qty', 1));
|
664 |
-
$OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", -1 * $discountExclTax)));
|
665 |
-
$OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $discountVatPercent)));
|
666 |
-
$OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", -1 * $discountVatAmount)));
|
667 |
-
$OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", -1 * $discountInclTax)));
|
668 |
-
$OrderLines->appendChild($OrderLine);
|
669 |
-
}
|
670 |
-
|
671 |
-
// Add reward points
|
672 |
-
if ((float)$order->getBaseRewardCurrencyAmount() > 0) {
|
673 |
-
$OrderLine = $dom->createElement('OrderLine');
|
674 |
-
$OrderLine->appendChild($dom->createElement('Product', Mage::helper('payex')->__('Reward points')));
|
675 |
-
$OrderLine->appendChild($dom->createElement('Qty', 1));
|
676 |
-
$OrderLine->appendChild($dom->createElement('UnitPrice', -1 * $order->getBaseRewardCurrencyAmount()));
|
677 |
-
$OrderLine->appendChild($dom->createElement('VatRate', 0));
|
678 |
-
$OrderLine->appendChild($dom->createElement('VatAmount', 0));
|
679 |
-
$OrderLine->appendChild($dom->createElement('Amount', -1 * $order->getBaseRewardCurrencyAmount()));
|
680 |
$OrderLines->appendChild($OrderLine);
|
681 |
}
|
682 |
|
@@ -688,7 +366,8 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
688 |
* @param $status
|
689 |
* @return Mage_Sales_Model_Order_Status
|
690 |
*/
|
691 |
-
public function getAssignedStatus($status)
|
|
|
692 |
$status = Mage::getModel('sales/order_status')
|
693 |
->getCollection()
|
694 |
->joinStates()
|
@@ -702,7 +381,8 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
702 |
* @param string|int $transaction_id
|
703 |
* @return array
|
704 |
*/
|
705 |
-
public function getInvoiceLink($transaction_id)
|
|
|
706 |
// Call PxOrder.InvoiceLinkGet
|
707 |
$params = array (
|
708 |
'accountNumber' => '',
|
@@ -731,7 +411,7 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
731 |
$card_type = '';
|
732 |
if (!empty($transaction['cardProduct'])) {
|
733 |
$card_type = $transaction['cardProduct'];
|
734 |
-
} elseif (!empty(
|
735 |
$card_type = $transaction['paymentMethod'];
|
736 |
}
|
737 |
|
@@ -766,10 +446,183 @@ class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
|
766 |
public function getFormattedCC(array $transaction)
|
767 |
{
|
768 |
$details = $this->getCCDetails($transaction);
|
769 |
-
return sprintf(
|
770 |
-
|
|
|
|
|
771 |
$details->getMaskedNumber(),
|
772 |
date('Y/m', strtotime($details->getExpireDate()))
|
773 |
);
|
774 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
775 |
}
|
3 |
class PayEx_Payments_Helper_Order extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
|
6 |
+
/**
|
7 |
+
* Process Payment Transaction
|
8 |
+
* @param Mage_Sales_Model_Order $order
|
9 |
+
* @param array $fields
|
10 |
+
*
|
11 |
+
* @return Mage_Sales_Model_Order_Payment_Transaction|null
|
12 |
+
* @throws Exception
|
13 |
+
*/
|
14 |
public function processPaymentTransaction(Mage_Sales_Model_Order $order, array $fields)
|
15 |
{
|
16 |
// Lookup Transaction
|
17 |
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
18 |
->addAttributeToFilter('txn_id', $fields['transactionNumber']);
|
19 |
if (count($collection) > 0) {
|
20 |
+
Mage::helper('payex/tools')->addToDebug(sprintf('Transaction %s already processed.', $fields['transactionNumber']), $order->getIncrementId());
|
21 |
return $collection->getFirstItem();
|
22 |
}
|
23 |
|
24 |
+
// Set Payment Transaction Id
|
25 |
$payment = $order->getPayment();
|
26 |
$payment->setTransactionId($fields['transactionNumber']);
|
27 |
|
28 |
/* Transaction statuses: 0=Sale, 1=Initialize, 2=Credit, 3=Authorize, 4=Cancel, 5=Failure, 6=Capture */
|
29 |
+
$transaction_status = isset($fields['transactionStatus']) ? (int)$fields['transactionStatus'] : null;
|
30 |
switch ($transaction_status) {
|
31 |
case 1:
|
32 |
// From PayEx PIM:
|
38 |
$transaction->setIsClosed(0);
|
39 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
40 |
$transaction->setMessage($message);
|
41 |
+
$transaction->save();
|
42 |
+
break;
|
43 |
}
|
44 |
|
45 |
+
$message = Mage::helper('payex')->__('Transaction Status: %s.', $transaction_status);
|
46 |
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT, null, true, $message);
|
47 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
48 |
$transaction->setMessage($message);
|
54 |
$transaction->setIsClosed(0);
|
55 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
56 |
$transaction->setMessage($message);
|
57 |
+
$transaction->save();
|
58 |
break;
|
59 |
case 0;
|
60 |
case 6:
|
63 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
64 |
$transaction->isFailsafe(true)->close(false);
|
65 |
$transaction->setMessage($message);
|
66 |
+
$transaction->save();
|
67 |
break;
|
68 |
case 2:
|
69 |
$message = Mage::helper('payex')->__('Detected an abnormal payment process (Transaction Status: %s).', $transaction_status);
|
70 |
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT, null, true, $message);
|
71 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
72 |
$transaction->setMessage($message);
|
73 |
+
$transaction->setIsCancel(true);
|
74 |
$transaction->save();
|
75 |
break;
|
76 |
case 4;
|
78 |
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT, null, true);
|
79 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
80 |
$transaction->setMessage($message);
|
81 |
+
$transaction->setIsCancel(true);
|
82 |
$transaction->save();
|
83 |
break;
|
84 |
case 5;
|
87 |
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT, null, true);
|
88 |
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $fields);
|
89 |
$transaction->setMessage($message);
|
90 |
+
$transaction->setIsCancel(true);
|
91 |
$transaction->save();
|
92 |
break;
|
93 |
default:
|
98 |
break;
|
99 |
}
|
100 |
|
101 |
+
try {
|
102 |
+
$order->save();
|
103 |
+
Mage::helper('payex/tools')->addToDebug($message, $order->getIncrementId());
|
104 |
+
} catch (Exception $e) {
|
105 |
+
Mage::helper('payex/tools')->addToDebug('Error: ' . $e->getMessage(), $order->getIncrementId());
|
106 |
+
}
|
107 |
|
108 |
return $transaction;
|
109 |
}
|
163 |
if (!$order_id) {
|
164 |
return false;
|
165 |
}
|
166 |
+
|
167 |
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
168 |
->addOrderIdFilter($order_id)
|
169 |
->setOrder('transaction_id', 'ASC')
|
191 |
} else {
|
192 |
$creditmemo = $service->prepareCreditmemo();
|
193 |
}
|
194 |
+
|
195 |
$creditmemo->addComment(Mage::helper('payex')->__('Auto-generated from PayEx module'));
|
196 |
|
197 |
// Refund
|
198 |
if (!$online) {
|
199 |
$creditmemo->setPaymentRefundDisallowed(true);
|
200 |
}
|
201 |
+
|
202 |
//$creditmemo->setRefundRequested(true);
|
203 |
$invoice->getOrder()->setBaseTotalRefunded(0);
|
204 |
$creditmemo->setBaseGrandTotal($amount);
|
209 |
if ($transactionId) {
|
210 |
$creditmemo->setTransactionId($transactionId);
|
211 |
}
|
212 |
+
|
213 |
// Save CreditMemo
|
214 |
$transactionSave = Mage::getModel('core/resource_transaction')
|
215 |
->addObject($creditmemo)
|
217 |
if ($creditmemo->getInvoice()) {
|
218 |
$transactionSave->addObject($creditmemo->getInvoice());
|
219 |
}
|
220 |
+
|
221 |
$transactionSave->save();
|
222 |
|
223 |
return $creditmemo;
|
240 |
// Order amount calculated manually
|
241 |
$amount = 0;
|
242 |
|
243 |
+
$lines = $this->getOrderItems($order);
|
244 |
+
foreach ($lines as $line) {
|
245 |
+
$amount += (int)(100 * $line['price_with_tax']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
}
|
247 |
|
248 |
// Detect Rounding Issue
|
255 |
} else {
|
256 |
$rounding = -1 * ($rounded_control_amount - $rounded_total);
|
257 |
}
|
258 |
+
|
259 |
$rounding = sprintf("%.2f", $rounding);
|
260 |
}
|
261 |
|
263 |
return $result->setAmount($rounded_control_amount)->setRounding($rounding);
|
264 |
}
|
265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
/**
|
267 |
* Get Shopping Cart XML for MasterPass
|
268 |
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quote
|
295 |
}
|
296 |
|
297 |
$ShoppingCartItem = $dom->createElement('ShoppingCartItem');
|
298 |
+
$ShoppingCartItem->appendChild($dom->createElement('Description', htmlentities($item->getName())));
|
299 |
$ShoppingCartItem->appendChild($dom->createElement('Quantity', (float)$qty));
|
300 |
$ShoppingCartItem->appendChild($dom->createElement('Value', (int)bcmul($product->getFinalPrice(), 100)));
|
301 |
$ShoppingCartItem->appendChild($dom->createElement('ImageURL', $product->getThumbnailUrl()));
|
313 |
*/
|
314 |
public function getInvoiceExtraPrintBlocksXML($order)
|
315 |
{
|
316 |
+
$lines = $this->getOrderItems($order);
|
317 |
+
|
318 |
+
// Replace illegal characters of product names
|
319 |
+
$replace_illegal = $order->getPayment()->getMethodInstance()
|
320 |
+
->getConfigData('replace_illegal', $order->getStoreId());
|
321 |
+
if ($replace_illegal) {
|
322 |
+
$replacement_char = $order->getPayment()->getMethodInstance()
|
323 |
+
->getConfigData('replacement_char', $order->getStoreId());
|
324 |
+
if (empty($replacement_char)) {
|
325 |
+
$replacement_char = '-';
|
326 |
+
}
|
327 |
+
|
328 |
+
$lines = array_map(
|
329 |
+
function ($value) use ($replacement_char) {
|
330 |
+
if (isset($value['name'])) {
|
331 |
+
mb_regex_encoding('utf-8');
|
332 |
+
$value['name'] = mb_ereg_replace('[^a-zA-Z0-9_:!#=?\[\]@{}´ %-\/À-ÖØ-öø-ú]', $replacement_char, $value['name']);
|
333 |
+
}
|
334 |
+
|
335 |
+
return $value;
|
336 |
+
}, $lines
|
337 |
+
);
|
338 |
}
|
339 |
|
340 |
$dom = new DOMDocument('1.0', 'utf-8');
|
347 |
$OnlineInvoice->appendChild($OrderLines);
|
348 |
|
349 |
// Add Order Lines
|
350 |
+
foreach ($lines as $line) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
$OrderLine = $dom->createElement('OrderLine');
|
352 |
+
$OrderLine->appendChild($dom->createElement('Product', htmlentities($line['name'])));
|
353 |
+
$OrderLine->appendChild($dom->createElement('Qty', $line['qty']));
|
354 |
+
$OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $line['price_without_tax'] / $line['qty'])));
|
355 |
+
$OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $line['tax_percent'])));
|
356 |
+
$OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", $line['tax_price'])));
|
357 |
+
$OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $line['price_with_tax'])));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
$OrderLines->appendChild($OrderLine);
|
359 |
}
|
360 |
|
366 |
* @param $status
|
367 |
* @return Mage_Sales_Model_Order_Status
|
368 |
*/
|
369 |
+
public function getAssignedStatus($status)
|
370 |
+
{
|
371 |
$status = Mage::getModel('sales/order_status')
|
372 |
->getCollection()
|
373 |
->joinStates()
|
381 |
* @param string|int $transaction_id
|
382 |
* @return array
|
383 |
*/
|
384 |
+
public function getInvoiceLink($transaction_id)
|
385 |
+
{
|
386 |
// Call PxOrder.InvoiceLinkGet
|
387 |
$params = array (
|
388 |
'accountNumber' => '',
|
411 |
$card_type = '';
|
412 |
if (!empty($transaction['cardProduct'])) {
|
413 |
$card_type = $transaction['cardProduct'];
|
414 |
+
} elseif (!empty($transaction['paymentMethod'])) {
|
415 |
$card_type = $transaction['paymentMethod'];
|
416 |
}
|
417 |
|
446 |
public function getFormattedCC(array $transaction)
|
447 |
{
|
448 |
$details = $this->getCCDetails($transaction);
|
449 |
+
return sprintf(
|
450 |
+
'%s %s %s', strtoupper(
|
451 |
+
$details->getType()
|
452 |
+
),
|
453 |
$details->getMaskedNumber(),
|
454 |
date('Y/m', strtotime($details->getExpireDate()))
|
455 |
);
|
456 |
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Get Order Items
|
460 |
+
* @param Mage_Sales_Model_Order $order
|
461 |
+
* @return array
|
462 |
+
*/
|
463 |
+
public function getOrderItems($order)
|
464 |
+
{
|
465 |
+
$lines = array();
|
466 |
+
$items = $order->getAllVisibleItems();
|
467 |
+
foreach ($items as $item) {
|
468 |
+
/** @var Mage_Sales_Model_Order_Item $item */
|
469 |
+
$itemQty = (int)$item->getQtyOrdered();
|
470 |
+
$priceWithTax = $item->getRowTotalInclTax();
|
471 |
+
$priceWithoutTax = $item->getRowTotal();
|
472 |
+
$taxPercent = $priceWithoutTax > 0 ? (($priceWithTax / $priceWithoutTax) - 1) * 100 : 0; // works for all types
|
473 |
+
$taxPrice = $priceWithTax - $priceWithoutTax;
|
474 |
+
$lines[] = array(
|
475 |
+
'type' => 'product',
|
476 |
+
'name' => $item->getName(),
|
477 |
+
'qty' => $itemQty,
|
478 |
+
'price_with_tax' => $priceWithTax,
|
479 |
+
'price_without_tax' => $priceWithoutTax,
|
480 |
+
'tax_price' => $taxPrice,
|
481 |
+
'tax_percent' => $taxPercent
|
482 |
+
);
|
483 |
+
}
|
484 |
+
|
485 |
+
// add Shipping
|
486 |
+
if (!$order->getIsVirtual()) {
|
487 |
+
$shippingExclTax = $order->getShippingAmount();
|
488 |
+
$shippingIncTax = $order->getShippingInclTax();
|
489 |
+
$shippingTax = $shippingIncTax - $shippingExclTax;
|
490 |
+
$shippingTaxRate = $shippingExclTax > 0 ? (($shippingIncTax / $shippingExclTax) - 1) * 100 : 0;
|
491 |
+
$lines[] = array(
|
492 |
+
'type' => 'shipping',
|
493 |
+
'name' => $order->getShippingDescription(),
|
494 |
+
'qty' => 1,
|
495 |
+
'price_with_tax' => $shippingIncTax,
|
496 |
+
'price_without_tax' => $shippingExclTax,
|
497 |
+
'tax_price' => $shippingTax,
|
498 |
+
'tax_percent' => $shippingTaxRate
|
499 |
+
);
|
500 |
+
}
|
501 |
+
|
502 |
+
// add Discount
|
503 |
+
$discountData = Mage::helper('payex/discount')->getOrderDiscountData($order);
|
504 |
+
if (abs($discountData->getDiscountInclTax()) > 0) {
|
505 |
+
$discountInclTax = $discountData->getDiscountInclTax();
|
506 |
+
$discountExclTax = $discountData->getDiscountExclTax();
|
507 |
+
$discountVatAmount = $discountInclTax - $discountExclTax;
|
508 |
+
$discountVatPercent = round((($discountInclTax / $discountExclTax) - 1) * 100);
|
509 |
+
$lines[] = array(
|
510 |
+
'type' => 'discount',
|
511 |
+
'name' => Mage::helper('sales')->__('Discount (%s)', $order->getDiscountDescription()),
|
512 |
+
'qty' => 1,
|
513 |
+
'price_with_tax' => -1 * $discountInclTax,
|
514 |
+
'price_without_tax' => -1 * $discountExclTax,
|
515 |
+
'tax_price' => -1 * $discountVatAmount,
|
516 |
+
'tax_percent' => $discountVatPercent
|
517 |
+
);
|
518 |
+
}
|
519 |
+
|
520 |
+
// Add reward points
|
521 |
+
if ((float)$order->getBaseRewardCurrencyAmount() > 0) {
|
522 |
+
$lines[] = array(
|
523 |
+
'type' => 'reward_points',
|
524 |
+
'name' => Mage::helper('payex')->__('Reward points'),
|
525 |
+
'qty' => 1,
|
526 |
+
'price_with_tax' => -1 * $order->getBaseRewardCurrencyAmount(),
|
527 |
+
'price_without_tax' => -1 * $order->getBaseRewardCurrencyAmount(),
|
528 |
+
'tax_price' => 0,
|
529 |
+
'tax_percent' => 0
|
530 |
+
);
|
531 |
+
}
|
532 |
+
|
533 |
+
// add Payment Fee
|
534 |
+
if ($order->getPayexPaymentFee() > 0 &&
|
535 |
+
in_array(
|
536 |
+
$order->getPayment()->getMethod(), array(
|
537 |
+
'payex_financing',
|
538 |
+
'payex_partpayment',
|
539 |
+
'payex_invoice'
|
540 |
+
)
|
541 |
+
)) {
|
542 |
+
$feeExclTax = $order->getPayexPaymentFee();
|
543 |
+
$feeTax = $order->getPayexPaymentFeeTax();
|
544 |
+
$feeIncTax = $feeExclTax + $feeTax;
|
545 |
+
$feeTaxRate = $feeExclTax > 0 ? (($feeIncTax / $feeExclTax) - 1) * 100 : 0;
|
546 |
+
|
547 |
+
$lines[] = array(
|
548 |
+
'type' => 'fee',
|
549 |
+
'name' => Mage::helper('payex')->__('Payment Fee'),
|
550 |
+
'qty' => 1,
|
551 |
+
'price_with_tax' => $feeIncTax,
|
552 |
+
'price_without_tax' => $feeExclTax,
|
553 |
+
'tax_price' => $feeTax,
|
554 |
+
'tax_percent' => $feeTaxRate
|
555 |
+
);
|
556 |
+
}
|
557 |
+
|
558 |
+
return $lines;
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Prepare Address Info
|
563 |
+
* @param Mage_Sales_Model_Order $order
|
564 |
+
* @return array
|
565 |
+
*/
|
566 |
+
public function getAddressInfo($order)
|
567 |
+
{
|
568 |
+
$billingAddress = $order->getBillingAddress()->getStreet();
|
569 |
+
$billingCountryCode = $order->getBillingAddress()->getCountry();
|
570 |
+
$billingCountry = Mage::getModel('directory/country')->load($billingCountryCode)->getName();
|
571 |
+
|
572 |
+
$params = array(
|
573 |
+
'billingFirstName' => $order->getBillingAddress()->getFirstname(),
|
574 |
+
'billingLastName' => $order->getBillingAddress()->getLastname(),
|
575 |
+
'billingAddress1' => $billingAddress[0],
|
576 |
+
'billingAddress2' => (isset($billingAddress[1])) ? $billingAddress[1] : '',
|
577 |
+
'billingAddress3' => '',
|
578 |
+
'billingPostNumber' => (string)$order->getBillingAddress()->getPostcode(),
|
579 |
+
'billingCity' => (string)$order->getBillingAddress()->getCity(),
|
580 |
+
'billingState' => (string)$order->getBillingAddress()->getRegion(),
|
581 |
+
'billingCountry' => $billingCountry,
|
582 |
+
'billingCountryCode' => $billingCountryCode,
|
583 |
+
'billingEmail' => (string)$order->getBillingAddress()->getEmail(),
|
584 |
+
'billingPhone' => (string)$order->getBillingAddress()->getTelephone(),
|
585 |
+
'billingGsm' => '',
|
586 |
+
'deliveryFirstName' => '',
|
587 |
+
'deliveryLastName' => '',
|
588 |
+
'deliveryAddress1' => '',
|
589 |
+
'deliveryAddress2' => '',
|
590 |
+
'deliveryAddress3' => '',
|
591 |
+
'deliveryPostNumber' => '',
|
592 |
+
'deliveryCity' => '',
|
593 |
+
'deliveryState' => '',
|
594 |
+
'deliveryCountry' => '',
|
595 |
+
'deliveryCountryCode' => '',
|
596 |
+
'deliveryEmail' => '',
|
597 |
+
'deliveryPhone' => '',
|
598 |
+
'deliveryGsm' => '',
|
599 |
+
);
|
600 |
+
|
601 |
+
// add Shipping
|
602 |
+
if (!$order->getIsVirtual()) {
|
603 |
+
$deliveryAddress = $order->getShippingAddress()->getStreet();
|
604 |
+
$deliveryCountryCode = $order->getShippingAddress()->getCountry();
|
605 |
+
$deliveryCountry = Mage::getModel('directory/country')->load($deliveryCountryCode)->getName();
|
606 |
+
|
607 |
+
$params = array_merge(
|
608 |
+
$params, array(
|
609 |
+
'deliveryFirstName' => $order->getShippingAddress()->getFirstname(),
|
610 |
+
'deliveryLastName' => $order->getShippingAddress()->getLastname(),
|
611 |
+
'deliveryAddress1' => $deliveryAddress[0],
|
612 |
+
'deliveryAddress2' => (isset($deliveryAddress[1])) ? $deliveryAddress[1] : '',
|
613 |
+
'deliveryAddress3' => '',
|
614 |
+
'deliveryPostNumber' => (string)$order->getShippingAddress()->getPostcode(),
|
615 |
+
'deliveryCity' => (string)$order->getShippingAddress()->getCity(),
|
616 |
+
'deliveryState' => (string)$order->getShippingAddress()->getRegion(),
|
617 |
+
'deliveryCountry' => $deliveryCountry,
|
618 |
+
'deliveryCountryCode' => $deliveryCountryCode,
|
619 |
+
'deliveryEmail' => (string)$order->getShippingAddress()->getEmail(),
|
620 |
+
'deliveryPhone' => (string)$order->getShippingAddress()->getTelephone(),
|
621 |
+
'deliveryGsm' => '',
|
622 |
+
)
|
623 |
+
);
|
624 |
+
}
|
625 |
+
|
626 |
+
return $params;
|
627 |
+
}
|
628 |
}
|
@@ -26,7 +26,6 @@ class PayEx_Payments_Helper_Tools extends Mage_Core_Helper_Abstract
|
|
26 |
if (is_array($message)) {
|
27 |
if (isset($message['code']) && isset($message['description'])) {
|
28 |
$error_message = Mage::helper('payex')->__($message['code']) . ' (' . Mage::helper('payex')->__($message['description']) . ')';
|
29 |
-
|
30 |
} else {
|
31 |
$error_message = Mage::helper('payex')->__('Unknown error');
|
32 |
}
|
@@ -34,6 +33,7 @@ class PayEx_Payments_Helper_Tools extends Mage_Core_Helper_Abstract
|
|
34 |
if (!empty($message['thirdPartyError'])) {
|
35 |
$error_message .= ' Third Party Error: ' . Mage::helper('payex')->__($message['thirdPartyError']);
|
36 |
}
|
|
|
37 |
if (!empty($message['transactionErrorCode']) && !empty($message['transactionErrorDescription'])) {
|
38 |
$error_message .= ' Transaction Error: ' . Mage::helper('payex')->__($message['transactionErrorCode']) . ' (' . $message['transactionErrorDescription'] . ')';
|
39 |
}
|
@@ -56,6 +56,7 @@ class PayEx_Payments_Helper_Tools extends Mage_Core_Helper_Abstract
|
|
56 |
if (!empty($order_id)) {
|
57 |
$message .= ' OrderId: ' . $order_id;
|
58 |
}
|
|
|
59 |
Mage::log($message, null, 'payment_payex.log');
|
60 |
}
|
61 |
|
@@ -144,7 +145,8 @@ class PayEx_Payments_Helper_Tools extends Mage_Core_Helper_Abstract
|
|
144 |
*
|
145 |
* @return string|bool
|
146 |
*/
|
147 |
-
public function getCountryCodeBySSN($ssn)
|
|
|
148 |
$rules = array(
|
149 |
'NO' => '/^[0-9]{6,6}((-[0-9]{5,5})|([0-9]{2,2}((-[0-9]{5,5})|([0-9]{1,1})|([0-9]{3,3})|([0-9]{5,5))))$/',
|
150 |
'SE' => '/^[0-9]{6,6}(([0-9]{2,2}[-\+]{1,1}[0-9]{4,4})|([-\+]{1,1}[0-9]{4,4})|([0-9]{4,6}))$/',
|
26 |
if (is_array($message)) {
|
27 |
if (isset($message['code']) && isset($message['description'])) {
|
28 |
$error_message = Mage::helper('payex')->__($message['code']) . ' (' . Mage::helper('payex')->__($message['description']) . ')';
|
|
|
29 |
} else {
|
30 |
$error_message = Mage::helper('payex')->__('Unknown error');
|
31 |
}
|
33 |
if (!empty($message['thirdPartyError'])) {
|
34 |
$error_message .= ' Third Party Error: ' . Mage::helper('payex')->__($message['thirdPartyError']);
|
35 |
}
|
36 |
+
|
37 |
if (!empty($message['transactionErrorCode']) && !empty($message['transactionErrorDescription'])) {
|
38 |
$error_message .= ' Transaction Error: ' . Mage::helper('payex')->__($message['transactionErrorCode']) . ' (' . $message['transactionErrorDescription'] . ')';
|
39 |
}
|
56 |
if (!empty($order_id)) {
|
57 |
$message .= ' OrderId: ' . $order_id;
|
58 |
}
|
59 |
+
|
60 |
Mage::log($message, null, 'payment_payex.log');
|
61 |
}
|
62 |
|
145 |
*
|
146 |
* @return string|bool
|
147 |
*/
|
148 |
+
public function getCountryCodeBySSN($ssn)
|
149 |
+
{
|
150 |
$rules = array(
|
151 |
'NO' => '/^[0-9]{6,6}((-[0-9]{5,5})|([0-9]{2,2}((-[0-9]{5,5})|([0-9]{1,1})|([0-9]{3,3})|([0-9]{5,5))))$/',
|
152 |
'SE' => '/^[0-9]{6,6}(([0-9]{2,2}[-\+]{1,1}[0-9]{4,4})|([-\+]{1,1}[0-9]{4,4})|([0-9]{4,6}))$/',
|
@@ -98,6 +98,7 @@ class PayEx_Payments_Model_Observer extends Mage_Core_Model_Abstract
|
|
98 |
$order->addStatusHistoryComment(Mage::helper('payex')->__('Order has been paid'), $new_status);
|
99 |
$order->save();
|
100 |
}
|
|
|
101 |
return $this;
|
102 |
}
|
103 |
|
98 |
$order->addStatusHistoryComment(Mage::helper('payex')->__('Order has been paid'), $new_status);
|
99 |
$order->save();
|
100 |
}
|
101 |
+
|
102 |
return $this;
|
103 |
}
|
104 |
|
@@ -266,6 +266,7 @@ class PayEx_Payments_Model_Payment_Bankdebit extends PayEx_Payments_Model_Paymen
|
|
266 |
unset($details[$key]);
|
267 |
}
|
268 |
}
|
|
|
269 |
return $details;
|
270 |
}
|
271 |
|
@@ -290,6 +291,7 @@ class PayEx_Payments_Model_Payment_Bankdebit extends PayEx_Payments_Model_Paymen
|
|
290 |
) {
|
291 |
return false;
|
292 |
}
|
|
|
293 |
return $this->_canVoid;
|
294 |
}
|
295 |
|
266 |
unset($details[$key]);
|
267 |
}
|
268 |
}
|
269 |
+
|
270 |
return $details;
|
271 |
}
|
272 |
|
291 |
) {
|
292 |
return false;
|
293 |
}
|
294 |
+
|
295 |
return $this->_canVoid;
|
296 |
}
|
297 |
|
@@ -85,6 +85,7 @@ class PayEx_Payments_Model_Payment_CC extends PayEx_Payments_Model_Payment_Abstr
|
|
85 |
} elseif ($data instanceof Varien_Object) {
|
86 |
$this->getInfoInstance()->setAdditionalInformation($key, $data->getData($key));
|
87 |
}
|
|
|
88 |
return $result;
|
89 |
}
|
90 |
|
@@ -150,10 +151,12 @@ class PayEx_Payments_Model_Payment_CC extends PayEx_Payments_Model_Payment_Abstr
|
|
150 |
);
|
151 |
|
152 |
// Set Billing Agreement Data
|
153 |
-
$payment->setBillingAgreementData(
|
|
|
154 |
'billing_agreement_id' => $agreement_reference,
|
155 |
'method_code' => PayEx_Payments_Model_Payment_Agreement::METHOD_BILLING_AGREEMENT,
|
156 |
-
|
|
|
157 |
}
|
158 |
}
|
159 |
|
@@ -211,7 +214,12 @@ class PayEx_Payments_Model_Payment_CC extends PayEx_Payments_Model_Payment_Abstr
|
|
211 |
}
|
212 |
|
213 |
// Get Transaction Details
|
214 |
-
$details = $
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
// Not to execute for Sale transactions
|
217 |
if ((int)$details['transactionStatus'] !== 3) {
|
@@ -221,16 +229,16 @@ class PayEx_Payments_Model_Payment_CC extends PayEx_Payments_Model_Payment_Abstr
|
|
221 |
|
222 |
$transactionNumber = $details['transactionNumber'];
|
223 |
$order_id = $details['orderId'];
|
|
|
224 |
if (!$order_id) {
|
225 |
$order_id = $payment->getOrder()->getIncrementId();
|
226 |
}
|
227 |
|
228 |
// Prevent Rounding Issue
|
229 |
-
|
230 |
-
$
|
231 |
-
|
232 |
-
|
233 |
-
$amount = $order_amount;
|
234 |
}
|
235 |
|
236 |
// Call PxOrder.Capture5
|
@@ -435,6 +443,7 @@ class PayEx_Payments_Model_Payment_CC extends PayEx_Payments_Model_Payment_Abstr
|
|
435 |
unset($details[$key]);
|
436 |
}
|
437 |
}
|
|
|
438 |
return $details;
|
439 |
}
|
440 |
|
@@ -473,6 +482,7 @@ class PayEx_Payments_Model_Payment_CC extends PayEx_Payments_Model_Payment_Abstr
|
|
473 |
) {
|
474 |
return false;
|
475 |
}
|
|
|
476 |
return $this->_canVoid;
|
477 |
}
|
478 |
|
85 |
} elseif ($data instanceof Varien_Object) {
|
86 |
$this->getInfoInstance()->setAdditionalInformation($key, $data->getData($key));
|
87 |
}
|
88 |
+
|
89 |
return $result;
|
90 |
}
|
91 |
|
151 |
);
|
152 |
|
153 |
// Set Billing Agreement Data
|
154 |
+
$payment->setBillingAgreementData(
|
155 |
+
array(
|
156 |
'billing_agreement_id' => $agreement_reference,
|
157 |
'method_code' => PayEx_Payments_Model_Payment_Agreement::METHOD_BILLING_AGREEMENT,
|
158 |
+
)
|
159 |
+
);
|
160 |
}
|
161 |
}
|
162 |
|
214 |
}
|
215 |
|
216 |
// Get Transaction Details
|
217 |
+
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
218 |
+
if (!is_array($details) || count($details) === 0) {
|
219 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
220 |
+
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $details);
|
221 |
+
$transaction->save();
|
222 |
+
}
|
223 |
|
224 |
// Not to execute for Sale transactions
|
225 |
if ((int)$details['transactionStatus'] !== 3) {
|
229 |
|
230 |
$transactionNumber = $details['transactionNumber'];
|
231 |
$order_id = $details['orderId'];
|
232 |
+
$available = $details['amount'];
|
233 |
if (!$order_id) {
|
234 |
$order_id = $payment->getOrder()->getIncrementId();
|
235 |
}
|
236 |
|
237 |
// Prevent Rounding Issue
|
238 |
+
$value = abs(sprintf("%.2f", $amount) - sprintf("%.2f", $available));
|
239 |
+
if ($value > 0 && $value < 0.2) {
|
240 |
+
$amount = $available;
|
241 |
+
$payment->setAmount($amount);
|
|
|
242 |
}
|
243 |
|
244 |
// Call PxOrder.Capture5
|
443 |
unset($details[$key]);
|
444 |
}
|
445 |
}
|
446 |
+
|
447 |
return $details;
|
448 |
}
|
449 |
|
482 |
) {
|
483 |
return false;
|
484 |
}
|
485 |
+
|
486 |
return $this->_canVoid;
|
487 |
}
|
488 |
|
@@ -215,8 +215,12 @@ class PayEx_Payments_Model_Payment_Financing extends PayEx_Payments_Model_Paymen
|
|
215 |
}
|
216 |
|
217 |
// Get Transaction Details
|
218 |
-
$this->fetchTransactionInfo($payment, $transactionId);
|
219 |
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
// Not to execute for Sale transactions
|
222 |
if ((int)$details['transactionStatus'] !== 3) {
|
@@ -226,13 +230,13 @@ class PayEx_Payments_Model_Payment_Financing extends PayEx_Payments_Model_Paymen
|
|
226 |
|
227 |
$transactionNumber = $details['transactionNumber'];
|
228 |
$order_id = $payment->getOrder()->getIncrementId();
|
|
|
229 |
|
230 |
// Prevent Rounding Issue
|
231 |
-
|
232 |
-
$
|
233 |
-
|
234 |
-
|
235 |
-
$amount = $order_amount;
|
236 |
}
|
237 |
|
238 |
$xml = Mage::helper('payex/order')->getInvoiceExtraPrintBlocksXML($payment->getOrder());
|
@@ -441,6 +445,7 @@ class PayEx_Payments_Model_Payment_Financing extends PayEx_Payments_Model_Paymen
|
|
441 |
unset($details[$key]);
|
442 |
}
|
443 |
}
|
|
|
444 |
return $details;
|
445 |
}
|
446 |
|
@@ -465,6 +470,7 @@ class PayEx_Payments_Model_Payment_Financing extends PayEx_Payments_Model_Paymen
|
|
465 |
) {
|
466 |
return false;
|
467 |
}
|
|
|
468 |
return $this->_canVoid;
|
469 |
}
|
470 |
|
215 |
}
|
216 |
|
217 |
// Get Transaction Details
|
|
|
218 |
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
219 |
+
if (!is_array($details) || count($details) === 0) {
|
220 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
221 |
+
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $details);
|
222 |
+
$transaction->save();
|
223 |
+
}
|
224 |
|
225 |
// Not to execute for Sale transactions
|
226 |
if ((int)$details['transactionStatus'] !== 3) {
|
230 |
|
231 |
$transactionNumber = $details['transactionNumber'];
|
232 |
$order_id = $payment->getOrder()->getIncrementId();
|
233 |
+
$available = $details['amount'];
|
234 |
|
235 |
// Prevent Rounding Issue
|
236 |
+
$value = abs(sprintf("%.2f", $amount) - sprintf("%.2f", $available));
|
237 |
+
if ($value > 0 && $value < 0.2) {
|
238 |
+
$amount = $available;
|
239 |
+
$payment->setAmount($amount);
|
|
|
240 |
}
|
241 |
|
242 |
$xml = Mage::helper('payex/order')->getInvoiceExtraPrintBlocksXML($payment->getOrder());
|
445 |
unset($details[$key]);
|
446 |
}
|
447 |
}
|
448 |
+
|
449 |
return $details;
|
450 |
}
|
451 |
|
470 |
) {
|
471 |
return false;
|
472 |
}
|
473 |
+
|
474 |
return $this->_canVoid;
|
475 |
}
|
476 |
|
@@ -153,6 +153,7 @@ class PayEx_Payments_Model_Payment_Invoice extends PayEx_Payments_Model_Payment_
|
|
153 |
Mage::throwException('Unfortunately PayEx did not grant you Invoice credit. Please try other means of payment');
|
154 |
}
|
155 |
}
|
|
|
156 |
// Show Error Message
|
157 |
Mage::helper('payex/tools')->throwPayExException($status, 'PxVerification.CreditCheck');
|
158 |
return false;
|
@@ -206,7 +207,12 @@ class PayEx_Payments_Model_Payment_Invoice extends PayEx_Payments_Model_Payment_
|
|
206 |
}
|
207 |
|
208 |
// Get Transaction Details
|
209 |
-
$details = $
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
// Not to execute for Sale transactions
|
212 |
if ((int)$details['transactionStatus'] !== 3) {
|
@@ -216,16 +222,16 @@ class PayEx_Payments_Model_Payment_Invoice extends PayEx_Payments_Model_Payment_
|
|
216 |
|
217 |
$transactionNumber = $details['transactionNumber'];
|
218 |
$order_id = $details['orderId'];
|
|
|
219 |
if (!$order_id) {
|
220 |
$order_id = $payment->getOrder()->getIncrementId();
|
221 |
}
|
222 |
|
223 |
// Prevent Rounding Issue
|
224 |
-
|
225 |
-
$
|
226 |
-
|
227 |
-
|
228 |
-
$amount = $order_amount;
|
229 |
}
|
230 |
|
231 |
// Call PxOrder.Capture5
|
@@ -430,6 +436,7 @@ class PayEx_Payments_Model_Payment_Invoice extends PayEx_Payments_Model_Payment_
|
|
430 |
unset($details[$key]);
|
431 |
}
|
432 |
}
|
|
|
433 |
return $details;
|
434 |
}
|
435 |
|
@@ -454,6 +461,7 @@ class PayEx_Payments_Model_Payment_Invoice extends PayEx_Payments_Model_Payment_
|
|
454 |
) {
|
455 |
return false;
|
456 |
}
|
|
|
457 |
return $this->_canVoid;
|
458 |
}
|
459 |
|
153 |
Mage::throwException('Unfortunately PayEx did not grant you Invoice credit. Please try other means of payment');
|
154 |
}
|
155 |
}
|
156 |
+
|
157 |
// Show Error Message
|
158 |
Mage::helper('payex/tools')->throwPayExException($status, 'PxVerification.CreditCheck');
|
159 |
return false;
|
207 |
}
|
208 |
|
209 |
// Get Transaction Details
|
210 |
+
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
211 |
+
if (!is_array($details) || count($details) === 0) {
|
212 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
213 |
+
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $details);
|
214 |
+
$transaction->save();
|
215 |
+
}
|
216 |
|
217 |
// Not to execute for Sale transactions
|
218 |
if ((int)$details['transactionStatus'] !== 3) {
|
222 |
|
223 |
$transactionNumber = $details['transactionNumber'];
|
224 |
$order_id = $details['orderId'];
|
225 |
+
$available = $details['amount'];
|
226 |
if (!$order_id) {
|
227 |
$order_id = $payment->getOrder()->getIncrementId();
|
228 |
}
|
229 |
|
230 |
// Prevent Rounding Issue
|
231 |
+
$value = abs(sprintf("%.2f", $amount) - sprintf("%.2f", $available));
|
232 |
+
if ($value > 0 && $value < 0.2) {
|
233 |
+
$amount = $available;
|
234 |
+
$payment->setAmount($amount);
|
|
|
235 |
}
|
236 |
|
237 |
// Call PxOrder.Capture5
|
436 |
unset($details[$key]);
|
437 |
}
|
438 |
}
|
439 |
+
|
440 |
return $details;
|
441 |
}
|
442 |
|
461 |
) {
|
462 |
return false;
|
463 |
}
|
464 |
+
|
465 |
return $this->_canVoid;
|
466 |
}
|
467 |
|
@@ -132,7 +132,12 @@ class PayEx_Payments_Model_Payment_MasterPass extends PayEx_Payments_Model_Payme
|
|
132 |
}
|
133 |
|
134 |
// Get Transaction Details
|
135 |
-
$details = $
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
// Not to execute for Sale transactions
|
138 |
if ((int)$details['transactionStatus'] !== 3) {
|
@@ -142,10 +147,18 @@ class PayEx_Payments_Model_Payment_MasterPass extends PayEx_Payments_Model_Payme
|
|
142 |
|
143 |
$transactionNumber = $details['transactionNumber'];
|
144 |
$order_id = $details['orderId'];
|
|
|
145 |
if (!$order_id) {
|
146 |
$order_id = $payment->getOrder()->getIncrementId();
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
// Call PxOrder.Capture5
|
150 |
$params = array(
|
151 |
'accountNumber' => '',
|
@@ -348,6 +361,7 @@ class PayEx_Payments_Model_Payment_MasterPass extends PayEx_Payments_Model_Payme
|
|
348 |
unset($details[$key]);
|
349 |
}
|
350 |
}
|
|
|
351 |
return $details;
|
352 |
}
|
353 |
|
@@ -372,6 +386,7 @@ class PayEx_Payments_Model_Payment_MasterPass extends PayEx_Payments_Model_Payme
|
|
372 |
) {
|
373 |
return false;
|
374 |
}
|
|
|
375 |
return $this->_canVoid;
|
376 |
}
|
377 |
|
132 |
}
|
133 |
|
134 |
// Get Transaction Details
|
135 |
+
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
136 |
+
if (!is_array($details) || count($details) === 0) {
|
137 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
138 |
+
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $details);
|
139 |
+
$transaction->save();
|
140 |
+
}
|
141 |
|
142 |
// Not to execute for Sale transactions
|
143 |
if ((int)$details['transactionStatus'] !== 3) {
|
147 |
|
148 |
$transactionNumber = $details['transactionNumber'];
|
149 |
$order_id = $details['orderId'];
|
150 |
+
$available = $details['amount'];
|
151 |
if (!$order_id) {
|
152 |
$order_id = $payment->getOrder()->getIncrementId();
|
153 |
}
|
154 |
|
155 |
+
// Prevent Rounding Issue
|
156 |
+
$value = abs(sprintf("%.2f", $amount) - sprintf("%.2f", $available));
|
157 |
+
if ($value > 0 && $value < 0.2) {
|
158 |
+
$amount = $available;
|
159 |
+
$payment->setAmount($amount);
|
160 |
+
}
|
161 |
+
|
162 |
// Call PxOrder.Capture5
|
163 |
$params = array(
|
164 |
'accountNumber' => '',
|
361 |
unset($details[$key]);
|
362 |
}
|
363 |
}
|
364 |
+
|
365 |
return $details;
|
366 |
}
|
367 |
|
386 |
) {
|
387 |
return false;
|
388 |
}
|
389 |
+
|
390 |
return $this->_canVoid;
|
391 |
}
|
392 |
|
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PayEx_Payments_Model_Payment_Mobilepay extends PayEx_Payments_Model_Payment_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Payment Method Code
|
7 |
+
*/
|
8 |
+
const METHOD_CODE = 'payex_mobilepay';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Payment method code
|
12 |
+
*/
|
13 |
+
public $_code = self::METHOD_CODE;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Availability options
|
17 |
+
*/
|
18 |
+
protected $_isGateway = true;
|
19 |
+
protected $_canOrder = true;
|
20 |
+
protected $_canAuthorize = true;
|
21 |
+
protected $_canCapture = true;
|
22 |
+
protected $_canCapturePartial = false;
|
23 |
+
protected $_canRefund = true;
|
24 |
+
protected $_canRefundInvoicePartial = true;
|
25 |
+
protected $_canVoid = true;
|
26 |
+
protected $_canUseInternal = true;
|
27 |
+
protected $_canUseCheckout = true;
|
28 |
+
protected $_canUseForMultishipping = false;
|
29 |
+
protected $_isInitializeNeeded = false;
|
30 |
+
protected $_canFetchTransactionInfo = true;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Payment method blocks
|
34 |
+
*/
|
35 |
+
protected $_infoBlockType = 'payex/info_mobilepay';
|
36 |
+
protected $_formBlockType = 'payex/form_mobilepay';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get config action to process initialization
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function getConfigPaymentAction()
|
43 |
+
{
|
44 |
+
return Mage_Payment_Model_Method_Abstract::ACTION_ORDER;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Check whether payment method can be used
|
49 |
+
* @param Mage_Sales_Model_Quote $quote
|
50 |
+
* @return bool
|
51 |
+
*/
|
52 |
+
public function isAvailable($quote = null)
|
53 |
+
{
|
54 |
+
if (parent::isAvailable($quote) === false) {
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
|
58 |
+
if (!$quote) {
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
+
// Check currency
|
63 |
+
$allowedCurrency = array('DKK', 'EUR', 'GBP', 'NOK', 'SEK', 'USD');
|
64 |
+
return in_array($quote->getQuoteCurrencyCode(), $allowedCurrency);
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Order payment method
|
69 |
+
*
|
70 |
+
* @param Varien_Object $payment
|
71 |
+
* @param float $amount
|
72 |
+
*
|
73 |
+
* @return $this
|
74 |
+
*/
|
75 |
+
public function order(Varien_Object $payment, $amount)
|
76 |
+
{
|
77 |
+
Mage::helper('payex/tools')->addToDebug('Action: Order');
|
78 |
+
parent::order($payment, $amount);
|
79 |
+
|
80 |
+
// Set state
|
81 |
+
/** @var Mage_Sales_Model_Order $order */
|
82 |
+
$order = $payment->getOrder();
|
83 |
+
$order->setState(Mage_Sales_Model_Order::STATE_NEW, true);
|
84 |
+
|
85 |
+
$payment->setSkipOrderProcessing(true);
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Validate
|
91 |
+
* @return bool
|
92 |
+
*/
|
93 |
+
public function validate()
|
94 |
+
{
|
95 |
+
Mage::helper('payex/tools')->addToDebug('Action: Validate');
|
96 |
+
return parent::validate();
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get the redirect url
|
101 |
+
* @return string
|
102 |
+
*/
|
103 |
+
public function getOrderPlaceRedirectUrl()
|
104 |
+
{
|
105 |
+
Mage::helper('payex/tools')->addToDebug('Action: getOrderPlaceRedirectUrl');
|
106 |
+
return Mage::getUrl('payex/mobilepay/redirect', array('_secure' => true));
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Capture payment
|
111 |
+
* @param Varien_Object $payment
|
112 |
+
* @param $amount
|
113 |
+
* @return $this
|
114 |
+
*/
|
115 |
+
public function capture(Varien_Object $payment, $amount)
|
116 |
+
{
|
117 |
+
Mage::helper('payex/tools')->addToDebug('Action: Capture');
|
118 |
+
|
119 |
+
parent::capture($payment, $amount);
|
120 |
+
|
121 |
+
if ($amount <= 0) {
|
122 |
+
Mage::throwException(Mage::helper('paygate')->__('Invalid amount for capture.'));
|
123 |
+
}
|
124 |
+
|
125 |
+
if (!$payment->getLastTransId()) {
|
126 |
+
Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
|
127 |
+
}
|
128 |
+
|
129 |
+
$payment->setAmount($amount);
|
130 |
+
|
131 |
+
// Load transaction Data
|
132 |
+
$transactionId = $payment->getLastTransId();
|
133 |
+
$transaction = $payment->getTransaction($transactionId);
|
134 |
+
if (!$transaction) {
|
135 |
+
Mage::throwException(Mage::helper('payex')->__('Can\'t load last transaction.'));
|
136 |
+
}
|
137 |
+
|
138 |
+
// Get Transaction Details
|
139 |
+
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
140 |
+
if (!is_array($details) || count($details) === 0) {
|
141 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
142 |
+
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $details);
|
143 |
+
$transaction->save();
|
144 |
+
}
|
145 |
+
|
146 |
+
// Not to execute for Sale transactions
|
147 |
+
if ((int)$details['transactionStatus'] !== 3) {
|
148 |
+
Mage::throwException(Mage::helper('payex')->__('Can\'t capture captured order.'));
|
149 |
+
//return $this;
|
150 |
+
}
|
151 |
+
|
152 |
+
$transactionNumber = $details['transactionNumber'];
|
153 |
+
$order_id = $details['orderId'];
|
154 |
+
$available = $details['amount'];
|
155 |
+
if (!$order_id) {
|
156 |
+
$order_id = $payment->getOrder()->getIncrementId();
|
157 |
+
}
|
158 |
+
|
159 |
+
// Prevent Rounding Issue
|
160 |
+
$value = abs(sprintf("%.2f", $amount) - sprintf("%.2f", $available));
|
161 |
+
if ($value > 0 && $value < 0.2) {
|
162 |
+
$amount = $available;
|
163 |
+
$payment->setAmount($amount);
|
164 |
+
}
|
165 |
+
|
166 |
+
// Call PxOrder.Capture5
|
167 |
+
$params = array(
|
168 |
+
'accountNumber' => '',
|
169 |
+
'transactionNumber' => $transactionNumber,
|
170 |
+
'amount' => round(100 * $amount),
|
171 |
+
'orderId' => $order_id,
|
172 |
+
'vatAmount' => 0,
|
173 |
+
'additionalValues' => ''
|
174 |
+
);
|
175 |
+
$result = Mage::helper('payex/api')->getPx()->Capture5($params);
|
176 |
+
Mage::helper('payex/tools')->addToDebug('PXOrder.Capture5:' . $result['description'], $order_id);
|
177 |
+
|
178 |
+
// Check Results
|
179 |
+
if ($result['code'] === 'OK' && $result['errorCode'] === 'OK' && $result['description'] === 'OK') {
|
180 |
+
// Note: Order Status will be changed in Observer
|
181 |
+
|
182 |
+
// Add Capture Transaction
|
183 |
+
$payment->setStatus(self::STATUS_APPROVED)
|
184 |
+
->setTransactionId($result['transactionNumber'])
|
185 |
+
->setIsTransactionClosed(0);
|
186 |
+
|
187 |
+
// Add Transaction fields
|
188 |
+
$payment->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $result);
|
189 |
+
return $this;
|
190 |
+
}
|
191 |
+
|
192 |
+
// Show Error
|
193 |
+
Mage::helper('payex/tools')->throwPayExException($result, 'PxOrder.Capture5');
|
194 |
+
return $this;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Cancel payment
|
199 |
+
* @param Varien_Object $payment
|
200 |
+
* @return $this
|
201 |
+
*/
|
202 |
+
public function cancel(Varien_Object $payment)
|
203 |
+
{
|
204 |
+
Mage::helper('payex/tools')->addToDebug('Action: Cancel');
|
205 |
+
|
206 |
+
if (!$payment->getLastTransId()) {
|
207 |
+
Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
|
208 |
+
}
|
209 |
+
|
210 |
+
// Load transaction Data
|
211 |
+
$transactionId = $payment->getLastTransId();
|
212 |
+
$transaction = $payment->getTransaction($transactionId);
|
213 |
+
if (!$transaction) {
|
214 |
+
Mage::throwException(Mage::helper('payex')->__('Can\'t load last transaction.'));
|
215 |
+
}
|
216 |
+
|
217 |
+
// Get Transaction Details
|
218 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
219 |
+
|
220 |
+
// Not to execute for Sale transactions
|
221 |
+
if ((int)$details['transactionStatus'] !== 3) {
|
222 |
+
Mage::throwException(Mage::helper('payex')->__('Unable to execute cancel.'));
|
223 |
+
}
|
224 |
+
|
225 |
+
$transactionNumber = $details['transactionNumber'];
|
226 |
+
$order_id = $details['orderId'];
|
227 |
+
if (!$order_id) {
|
228 |
+
$order_id = $payment->getOrder()->getId();
|
229 |
+
}
|
230 |
+
|
231 |
+
// Call PXOrder.Cancel2
|
232 |
+
$params = array(
|
233 |
+
'accountNumber' => '',
|
234 |
+
'transactionNumber' => $transactionNumber
|
235 |
+
);
|
236 |
+
$result = Mage::helper('payex/api')->getPx()->Cancel2($params);
|
237 |
+
Mage::helper('payex/tools')->addToDebug('PxOrder.Cancel2:' . $result['description'], $order_id);
|
238 |
+
|
239 |
+
// Check Results
|
240 |
+
if ($result['code'] === 'OK' && $result['errorCode'] === 'OK' && $result['description'] === 'OK') {
|
241 |
+
// Add Cancel Transaction
|
242 |
+
$payment->setStatus(self::STATUS_DECLINED)
|
243 |
+
->setTransactionId($result['transactionNumber'])
|
244 |
+
->setIsTransactionClosed(1); // Closed
|
245 |
+
|
246 |
+
// Add Transaction fields
|
247 |
+
$payment->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $result);
|
248 |
+
return $this;
|
249 |
+
}
|
250 |
+
|
251 |
+
// Show Error
|
252 |
+
Mage::helper('payex/tools')->throwPayExException($result, 'PxOrder.Cancel2');
|
253 |
+
return $this;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Refund capture
|
258 |
+
* @param Varien_Object $payment
|
259 |
+
* @param $amount
|
260 |
+
* @return $this
|
261 |
+
*/
|
262 |
+
public function refund(Varien_Object $payment, $amount)
|
263 |
+
{
|
264 |
+
Mage::helper('payex/tools')->addToDebug('Action: Refund');
|
265 |
+
|
266 |
+
parent::refund($payment, $amount);
|
267 |
+
|
268 |
+
if ($amount <= 0) {
|
269 |
+
Mage::throwException(Mage::helper('paygate')->__('Invalid amount for refund.'));
|
270 |
+
}
|
271 |
+
|
272 |
+
if (!$payment->getLastTransId()) {
|
273 |
+
Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
|
274 |
+
}
|
275 |
+
|
276 |
+
// Load transaction Data
|
277 |
+
$transactionId = $payment->getLastTransId();
|
278 |
+
$transaction = $payment->getTransaction($transactionId);
|
279 |
+
if (!$transaction) {
|
280 |
+
Mage::throwException(Mage::helper('payex')->__('Can\'t load last transaction.'));
|
281 |
+
}
|
282 |
+
|
283 |
+
// Get Transaction Details
|
284 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
285 |
+
|
286 |
+
// Check for Capture and Authorize transaction only
|
287 |
+
if ((int)$details['transactionStatus'] !== 6 && (int)$details['transactionStatus'] !== 0) {
|
288 |
+
Mage::throwException(Mage::helper('payex')->__('This payment has not yet captured.'));
|
289 |
+
}
|
290 |
+
|
291 |
+
$transactionNumber = $details['transactionNumber'];
|
292 |
+
$order_id = $details['orderId'];
|
293 |
+
if (!$order_id) {
|
294 |
+
$order_id = $payment->getOrder()->getId();
|
295 |
+
}
|
296 |
+
|
297 |
+
// Call PXOrder.PXOrder.Credit5
|
298 |
+
$params = array(
|
299 |
+
'accountNumber' => '',
|
300 |
+
'transactionNumber' => $transactionNumber,
|
301 |
+
'amount' => round(100 * $amount),
|
302 |
+
'orderId' => $order_id,
|
303 |
+
'vatAmount' => 0,
|
304 |
+
'additionalValues' => ''
|
305 |
+
);
|
306 |
+
$result = Mage::helper('payex/api')->getPx()->Credit5($params);
|
307 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Credit');
|
308 |
+
|
309 |
+
// Check Results
|
310 |
+
if ($result['code'] === 'OK' && $result['errorCode'] === 'OK' && $result['description'] === 'OK') {
|
311 |
+
// Add Credit Transaction
|
312 |
+
$payment->setAnetTransType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
|
313 |
+
$payment->setAmount($amount);
|
314 |
+
|
315 |
+
$payment->setStatus(self::STATUS_APPROVED)
|
316 |
+
->setTransactionId($result['transactionNumber'])
|
317 |
+
->setIsTransactionClosed(0); // No-Closed
|
318 |
+
|
319 |
+
// Add Transaction fields
|
320 |
+
$payment->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $result);
|
321 |
+
return $this;
|
322 |
+
}
|
323 |
+
|
324 |
+
// Show Error
|
325 |
+
Mage::helper('payex/tools')->throwPayExException($result, 'PxOrder.Credit5');
|
326 |
+
return $this;
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Void payment
|
331 |
+
* @param Varien_Object $payment
|
332 |
+
* @return $this
|
333 |
+
*/
|
334 |
+
public function void(Varien_Object $payment)
|
335 |
+
{
|
336 |
+
Mage::helper('payex/tools')->addToDebug('Action: Void');
|
337 |
+
return $this->cancel($payment);
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Fetch transaction details info
|
342 |
+
* @param Mage_Payment_Model_Info $payment
|
343 |
+
* @param string $transactionId
|
344 |
+
* @return array
|
345 |
+
*/
|
346 |
+
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
|
347 |
+
{
|
348 |
+
Mage::helper('payex/tools')->addToDebug('Action: fetchTransactionInfo. ID ' . $transactionId);
|
349 |
+
|
350 |
+
parent::fetchTransactionInfo($payment, $transactionId);
|
351 |
+
|
352 |
+
// Get Transaction Details
|
353 |
+
$params = array(
|
354 |
+
'accountNumber' => '',
|
355 |
+
'transactionNumber' => $transactionId,
|
356 |
+
);
|
357 |
+
$details = Mage::helper('payex/api')->getPx()->GetTransactionDetails2($params);
|
358 |
+
Mage::helper('payex/tools')->debugApi($details, 'PxOrder.GetTransactionDetails2');
|
359 |
+
|
360 |
+
// Check Results
|
361 |
+
if ($details['code'] === 'OK' && $details['errorCode'] === 'OK' && $details['description'] === 'OK') {
|
362 |
+
// Filter details
|
363 |
+
foreach ($details as $key => $value) {
|
364 |
+
if (empty($value)) {
|
365 |
+
unset($details[$key]);
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
return $details;
|
370 |
+
}
|
371 |
+
|
372 |
+
// Show Error
|
373 |
+
Mage::helper('payex/tools')->throwPayExException($details, 'GetTransactionDetails2');
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Create Payment Block
|
378 |
+
* @param $name
|
379 |
+
* @return mixed
|
380 |
+
*/
|
381 |
+
/* public function createFormBlock($name)
|
382 |
+
{
|
383 |
+
$block = $this->getLayout()->createBlock('payex/form', $name)
|
384 |
+
->setMethod('payex')
|
385 |
+
->setPayment($this->getPayment())
|
386 |
+
->setTemplate('payex/form.phtml');
|
387 |
+
return $block;
|
388 |
+
} */
|
389 |
+
|
390 |
+
public function getStandardCheckoutFormFields()
|
391 |
+
{
|
392 |
+
return array();
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Check void availability
|
397 |
+
* @param Varien_Object $payment
|
398 |
+
* @return bool
|
399 |
+
*/
|
400 |
+
public function canVoid(Varien_Object $payment)
|
401 |
+
{
|
402 |
+
if ($payment instanceof Mage_Sales_Model_Order_Invoice
|
403 |
+
|| $payment instanceof Mage_Sales_Model_Order_Creditmemo
|
404 |
+
) {
|
405 |
+
return false;
|
406 |
+
}
|
407 |
+
|
408 |
+
return $this->_canVoid;
|
409 |
+
}
|
410 |
+
|
411 |
+
public function canEdit()
|
412 |
+
{
|
413 |
+
return false;
|
414 |
+
}
|
415 |
+
|
416 |
+
public function canUseInternal()
|
417 |
+
{
|
418 |
+
return $this->_canUseInternal;
|
419 |
+
}
|
420 |
+
|
421 |
+
public function canUseForMultishipping()
|
422 |
+
{
|
423 |
+
return $this->_canUseForMultishipping;
|
424 |
+
}
|
425 |
+
|
426 |
+
public function onOrderValidate(Mage_Sales_Model_Order_Payment $payment)
|
427 |
+
{
|
428 |
+
return $this;
|
429 |
+
}
|
430 |
+
|
431 |
+
public function onInvoiceCreate(Mage_Sales_Model_Order_Invoice $payment)
|
432 |
+
{
|
433 |
+
}
|
434 |
+
|
435 |
+
public function canCapture()
|
436 |
+
{
|
437 |
+
return $this->_canCapture;
|
438 |
+
}
|
439 |
+
|
440 |
+
|
441 |
+
public function canFetchTransactionInfo()
|
442 |
+
{
|
443 |
+
return $this->_canFetchTransactionInfo;
|
444 |
+
}
|
445 |
+
}
|
@@ -207,8 +207,12 @@ class PayEx_Payments_Model_Payment_PartPayment extends PayEx_Payments_Model_Paym
|
|
207 |
}
|
208 |
|
209 |
// Get Transaction Details
|
210 |
-
$this->fetchTransactionInfo($payment, $transactionId);
|
211 |
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
// Not to execute for Sale transactions
|
214 |
if ((int)$details['transactionStatus'] !== 3) {
|
@@ -218,13 +222,13 @@ class PayEx_Payments_Model_Payment_PartPayment extends PayEx_Payments_Model_Paym
|
|
218 |
|
219 |
$transactionNumber = $details['transactionNumber'];
|
220 |
$order_id = $payment->getOrder()->getIncrementId();
|
|
|
221 |
|
222 |
// Prevent Rounding Issue
|
223 |
-
|
224 |
-
$
|
225 |
-
|
226 |
-
|
227 |
-
$amount = $order_amount;
|
228 |
}
|
229 |
|
230 |
$xml = Mage::helper('payex/order')->getInvoiceExtraPrintBlocksXML($payment->getOrder());
|
@@ -433,6 +437,7 @@ class PayEx_Payments_Model_Payment_PartPayment extends PayEx_Payments_Model_Paym
|
|
433 |
unset($details[$key]);
|
434 |
}
|
435 |
}
|
|
|
436 |
return $details;
|
437 |
}
|
438 |
|
@@ -457,6 +462,7 @@ class PayEx_Payments_Model_Payment_PartPayment extends PayEx_Payments_Model_Paym
|
|
457 |
) {
|
458 |
return false;
|
459 |
}
|
|
|
460 |
return $this->_canVoid;
|
461 |
}
|
462 |
|
207 |
}
|
208 |
|
209 |
// Get Transaction Details
|
|
|
210 |
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
211 |
+
if (!is_array($details) || count($details) === 0) {
|
212 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
213 |
+
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $details);
|
214 |
+
$transaction->save();
|
215 |
+
}
|
216 |
|
217 |
// Not to execute for Sale transactions
|
218 |
if ((int)$details['transactionStatus'] !== 3) {
|
222 |
|
223 |
$transactionNumber = $details['transactionNumber'];
|
224 |
$order_id = $payment->getOrder()->getIncrementId();
|
225 |
+
$available = $details['amount'];
|
226 |
|
227 |
// Prevent Rounding Issue
|
228 |
+
$value = abs(sprintf("%.2f", $amount) - sprintf("%.2f", $available));
|
229 |
+
if ($value > 0 && $value < 0.2) {
|
230 |
+
$amount = $available;
|
231 |
+
$payment->setAmount($amount);
|
|
|
232 |
}
|
233 |
|
234 |
$xml = Mage::helper('payex/order')->getInvoiceExtraPrintBlocksXML($payment->getOrder());
|
437 |
unset($details[$key]);
|
438 |
}
|
439 |
}
|
440 |
+
|
441 |
return $details;
|
442 |
}
|
443 |
|
462 |
) {
|
463 |
return false;
|
464 |
}
|
465 |
+
|
466 |
return $this->_canVoid;
|
467 |
}
|
468 |
|
@@ -259,6 +259,7 @@ class PayEx_Payments_Model_Payment_Swish extends PayEx_Payments_Model_Payment_Ab
|
|
259 |
unset($details[$key]);
|
260 |
}
|
261 |
}
|
|
|
262 |
return $details;
|
263 |
}
|
264 |
|
@@ -283,6 +284,7 @@ class PayEx_Payments_Model_Payment_Swish extends PayEx_Payments_Model_Payment_Ab
|
|
283 |
) {
|
284 |
return false;
|
285 |
}
|
|
|
286 |
return $this->_canVoid;
|
287 |
}
|
288 |
|
259 |
unset($details[$key]);
|
260 |
}
|
261 |
}
|
262 |
+
|
263 |
return $details;
|
264 |
}
|
265 |
|
284 |
) {
|
285 |
return false;
|
286 |
}
|
287 |
+
|
288 |
return $this->_canVoid;
|
289 |
}
|
290 |
|
@@ -154,8 +154,12 @@ class PayEx_Payments_Model_Payment_Wywallet extends PayEx_Payments_Model_Payment
|
|
154 |
}
|
155 |
|
156 |
// Get Transaction Details
|
157 |
-
$this->fetchTransactionInfo($payment, $transactionId);
|
158 |
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
// Not to execute for Sale transactions
|
161 |
if ((int)$details['transactionStatus'] !== 3) {
|
@@ -165,10 +169,18 @@ class PayEx_Payments_Model_Payment_Wywallet extends PayEx_Payments_Model_Payment
|
|
165 |
|
166 |
$transactionNumber = $details['transactionNumber'];
|
167 |
$order_id = $details['orderId'];
|
|
|
168 |
if (!$order_id) {
|
169 |
$order_id = $payment->getOrder()->getIncrementId();
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
// Call PxOrder.Capture5
|
173 |
$params = array(
|
174 |
'accountNumber' => '',
|
@@ -373,6 +385,7 @@ class PayEx_Payments_Model_Payment_Wywallet extends PayEx_Payments_Model_Payment
|
|
373 |
unset($details[$key]);
|
374 |
}
|
375 |
}
|
|
|
376 |
return $details;
|
377 |
}
|
378 |
|
@@ -397,6 +410,7 @@ class PayEx_Payments_Model_Payment_Wywallet extends PayEx_Payments_Model_Payment
|
|
397 |
) {
|
398 |
return false;
|
399 |
}
|
|
|
400 |
return $this->_canVoid;
|
401 |
}
|
402 |
|
154 |
}
|
155 |
|
156 |
// Get Transaction Details
|
|
|
157 |
$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
|
158 |
+
if (!is_array($details) || count($details) === 0) {
|
159 |
+
$details = $this->fetchTransactionInfo($payment, $transactionId);
|
160 |
+
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $details);
|
161 |
+
$transaction->save();
|
162 |
+
}
|
163 |
|
164 |
// Not to execute for Sale transactions
|
165 |
if ((int)$details['transactionStatus'] !== 3) {
|
169 |
|
170 |
$transactionNumber = $details['transactionNumber'];
|
171 |
$order_id = $details['orderId'];
|
172 |
+
$available = $details['amount'];
|
173 |
if (!$order_id) {
|
174 |
$order_id = $payment->getOrder()->getIncrementId();
|
175 |
}
|
176 |
|
177 |
+
// Prevent Rounding Issue
|
178 |
+
$value = abs(sprintf("%.2f", $amount) - sprintf("%.2f", $available));
|
179 |
+
if ($value > 0 && $value < 0.2) {
|
180 |
+
$amount = $available;
|
181 |
+
$payment->setAmount($amount);
|
182 |
+
}
|
183 |
+
|
184 |
// Call PxOrder.Capture5
|
185 |
$params = array(
|
186 |
'accountNumber' => '',
|
385 |
unset($details[$key]);
|
386 |
}
|
387 |
}
|
388 |
+
|
389 |
return $details;
|
390 |
}
|
391 |
|
410 |
) {
|
411 |
return false;
|
412 |
}
|
413 |
+
|
414 |
return $this->_canVoid;
|
415 |
}
|
416 |
|
@@ -77,14 +77,17 @@ class PayEx_Payments_Model_Quote_Tax extends Mage_Sales_Model_Quote_Address_Tota
|
|
77 |
$subtotalInclTax = $address->getSubtotal()+$address->getTaxAmount()-$address->getShippingTaxAmount()-$address->getPaymentFeeTax();
|
78 |
}
|
79 |
|
80 |
-
$address->addTotal(
|
|
|
81 |
'code' => 'subtotal',
|
82 |
'title' => Mage::helper('sales')->__('Subtotal'),
|
83 |
'value' => $subtotalInclTax,
|
84 |
'value_incl_tax' => $subtotalInclTax,
|
85 |
'value_excl_tax' => $address->getSubtotal(),
|
86 |
-
|
|
|
87 |
}
|
|
|
88 |
return $this;
|
89 |
}
|
90 |
}
|
77 |
$subtotalInclTax = $address->getSubtotal()+$address->getTaxAmount()-$address->getShippingTaxAmount()-$address->getPaymentFeeTax();
|
78 |
}
|
79 |
|
80 |
+
$address->addTotal(
|
81 |
+
array(
|
82 |
'code' => 'subtotal',
|
83 |
'title' => Mage::helper('sales')->__('Subtotal'),
|
84 |
'value' => $subtotalInclTax,
|
85 |
'value_incl_tax' => $subtotalInclTax,
|
86 |
'value_excl_tax' => $address->getSubtotal(),
|
87 |
+
)
|
88 |
+
);
|
89 |
}
|
90 |
+
|
91 |
return $this;
|
92 |
}
|
93 |
}
|
@@ -67,11 +67,13 @@ class PayEx_Payments_Model_Quote_Total extends Mage_Sales_Model_Quote_Address_To
|
|
67 |
{
|
68 |
$fee = $address->getPayexPaymentFee();
|
69 |
if ($fee > 0) {
|
70 |
-
$address->addTotal(
|
|
|
71 |
'code' => $this->getCode(),
|
72 |
'title' => Mage::helper('payex')->__('Payment fee'),
|
73 |
'value' => $fee,
|
74 |
-
|
|
|
75 |
}
|
76 |
|
77 |
return $this;
|
67 |
{
|
68 |
$fee = $address->getPayexPaymentFee();
|
69 |
if ($fee > 0) {
|
70 |
+
$address->addTotal(
|
71 |
+
array(
|
72 |
'code' => $this->getCode(),
|
73 |
'title' => Mage::helper('payex')->__('Payment fee'),
|
74 |
'value' => $fee,
|
75 |
+
)
|
76 |
+
);
|
77 |
}
|
78 |
|
79 |
return $this;
|
@@ -1 +1,18 @@
|
|
1 |
-
<?php
|
2 |
public function toOptionArray()
|
3 |
{
|
4 |
return array(
|
5 |
array(
|
6 |
'value' => 0,
|
7 |
'label' => Mage::helper('payex')->__('Authorize')
|
8 |
),
|
9 |
array(
|
10 |
'value' => 1,
|
11 |
'label' => Mage::helper('payex')->__('Sale')
|
12 |
),
|
13 |
);
|
14 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
public function toOptionArray()
|
2 |
{
|
3 |
return array(
|
4 |
array(
|
5 |
'value' => 0,
|
6 |
'label' => Mage::helper('payex')->__('Authorize')
|
7 |
),
|
8 |
array(
|
9 |
'value' => 1,
|
10 |
'label' => Mage::helper('payex')->__('Sale')
|
11 |
),
|
12 |
);
|
13 |
}
|
14 |
+
<?php
|
15 |
+
|
16 |
+
class PayEx_Payments_Model_Source_PaymentAction
|
17 |
+
{
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return array(
|
21 |
+
array(
|
22 |
+
'value' => 0,
|
23 |
+
'label' => Mage::helper('payex')->__('Authorize')
|
24 |
+
),
|
25 |
+
array(
|
26 |
+
'value' => 1,
|
27 |
+
'label' => Mage::helper('payex')->__('Sale')
|
28 |
+
),
|
29 |
+
);
|
30 |
+
}
|
31 |
+
}
|
@@ -20,8 +20,8 @@ class PayEx_Payments_Model_Source_ShippingMethod
|
|
20 |
foreach ($carrierMethods as $methodCode => $method) {
|
21 |
$code = $carrierCode . '_' . $methodCode;
|
22 |
$options[] = array('value' => $code, 'label' => $method);
|
23 |
-
|
24 |
}
|
|
|
25 |
$carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/title');
|
26 |
}
|
27 |
|
20 |
foreach ($carrierMethods as $methodCode => $method) {
|
21 |
$code = $carrierCode . '_' . $methodCode;
|
22 |
$options[] = array('value' => $code, 'label' => $method);
|
|
|
23 |
}
|
24 |
+
|
25 |
$carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/title');
|
26 |
}
|
27 |
|
@@ -19,8 +19,8 @@ class PayEx_Payments_Test_Helper_Order extends EcomDev_PHPUnit_Test_Case
|
|
19 |
public function testMethods()
|
20 |
{
|
21 |
$methods = array(
|
22 |
-
'processPaymentTransaction', 'makeInvoice', 'makeCreditMemo', 'getCalculatedOrderAmount', '
|
23 |
-
'
|
24 |
'getInvoiceLink'
|
25 |
);
|
26 |
foreach ($methods as $method) {
|
19 |
public function testMethods()
|
20 |
{
|
21 |
$methods = array(
|
22 |
+
'processPaymentTransaction', 'makeInvoice', 'makeCreditMemo', 'getCalculatedOrderAmount', 'getOrderItems',
|
23 |
+
'getAddressInfo', 'getShoppingCartXML', 'getInvoiceExtraPrintBlocksXML', 'getAssignedStatus',
|
24 |
'getInvoiceLink'
|
25 |
);
|
26 |
foreach ($methods as $method) {
|
@@ -36,6 +36,7 @@ class PayEx_Payments_Test_Helper_Tools extends EcomDev_PHPUnit_Test_Case
|
|
36 |
if (file_exists($log_file)) {
|
37 |
unlink($log_file);
|
38 |
}
|
|
|
39 |
$this->object->addToDebug('Log test');
|
40 |
//$this->assertFileExists($log_file);
|
41 |
//$this->assertContains('Log test', file_get_contents($log_file));
|
36 |
if (file_exists($log_file)) {
|
37 |
unlink($log_file);
|
38 |
}
|
39 |
+
|
40 |
$this->object->addToDebug('Log test');
|
41 |
//$this->assertFileExists($log_file);
|
42 |
//$this->assertContains('Log test', file_get_contents($log_file));
|
@@ -97,13 +97,45 @@ class PayEx_Payments_BankdebitController extends Mage_Core_Controller_Front_Acti
|
|
97 |
$this->_redirect('checkout/cart');
|
98 |
return;
|
99 |
}
|
|
|
100 |
Mage::helper('payex/tools')->addToDebug('Redirect URL: ' . $result['redirectUrl']);
|
101 |
$order_ref = $result['orderRef'];
|
102 |
|
103 |
// Add Order Lines and Orders Address
|
104 |
if ($method->getConfigData('checkoutinfo')) {
|
105 |
-
|
106 |
-
Mage::helper('payex/order')->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
|
109 |
// Call PxOrder.PrepareSaleDD2
|
@@ -141,12 +173,11 @@ class PayEx_Payments_BankdebitController extends Mage_Core_Controller_Front_Acti
|
|
141 |
}
|
142 |
|
143 |
// Set Pending Payment status
|
144 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
145 |
$order->save();
|
146 |
|
147 |
// Redirect to Bank
|
148 |
-
|
149 |
-
exit();
|
150 |
}
|
151 |
|
152 |
public function successAction()
|
@@ -154,7 +185,8 @@ class PayEx_Payments_BankdebitController extends Mage_Core_Controller_Front_Acti
|
|
154 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
155 |
|
156 |
// Check OrderRef
|
157 |
-
|
|
|
158 |
$this->_redirect('checkout/cart');
|
159 |
}
|
160 |
|
@@ -174,7 +206,7 @@ class PayEx_Payments_BankdebitController extends Mage_Core_Controller_Front_Acti
|
|
174 |
// Call PxOrder.Complete
|
175 |
$params = array(
|
176 |
'accountNumber' => '',
|
177 |
-
'orderRef' => $
|
178 |
);
|
179 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
180 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
97 |
$this->_redirect('checkout/cart');
|
98 |
return;
|
99 |
}
|
100 |
+
|
101 |
Mage::helper('payex/tools')->addToDebug('Redirect URL: ' . $result['redirectUrl']);
|
102 |
$order_ref = $result['orderRef'];
|
103 |
|
104 |
// Add Order Lines and Orders Address
|
105 |
if ($method->getConfigData('checkoutinfo')) {
|
106 |
+
// Add Order Items
|
107 |
+
$items = Mage::helper('payex/order')->getOrderItems($order);
|
108 |
+
foreach ($items as $index => $item) {
|
109 |
+
// Call PxOrder.AddSingleOrderLine2
|
110 |
+
$params = array(
|
111 |
+
'accountNumber' => '',
|
112 |
+
'orderRef' => $order_ref,
|
113 |
+
'itemNumber' => ($index + 1),
|
114 |
+
'itemDescription1' => $item['name'],
|
115 |
+
'itemDescription2' => '',
|
116 |
+
'itemDescription3' => '',
|
117 |
+
'itemDescription4' => '',
|
118 |
+
'itemDescription5' => '',
|
119 |
+
'quantity' => $item['qty'],
|
120 |
+
'amount' => (int)(100 * $item['price_with_tax']), //must include tax
|
121 |
+
'vatPrice' => (int)(100 * $item['tax_price']),
|
122 |
+
'vatPercent' => (int)(100 * $item['tax_percent'])
|
123 |
+
);
|
124 |
+
|
125 |
+
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
126 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
127 |
+
}
|
128 |
+
|
129 |
+
// Add Order Address Info
|
130 |
+
$params = array_merge(
|
131 |
+
array(
|
132 |
+
'accountNumber' => '',
|
133 |
+
'orderRef' => $order_ref
|
134 |
+
), Mage::helper('payex/order')->getAddressInfo($order)
|
135 |
+
);
|
136 |
+
|
137 |
+
$result = Mage::helper('payex/api')->getPx()->AddOrderAddress2($params);
|
138 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddOrderAddress2');
|
139 |
}
|
140 |
|
141 |
// Call PxOrder.PrepareSaleDD2
|
173 |
}
|
174 |
|
175 |
// Set Pending Payment status
|
176 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage::helper('payex')->__('The customer was redirected to PayEx.'));
|
177 |
$order->save();
|
178 |
|
179 |
// Redirect to Bank
|
180 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($result['redirectUrl'])->sendResponse();
|
|
|
181 |
}
|
182 |
|
183 |
public function successAction()
|
185 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
186 |
|
187 |
// Check OrderRef
|
188 |
+
$orderRef = $this->getRequest()->getParam('orderRef');
|
189 |
+
if (empty($orderRef)) {
|
190 |
$this->_redirect('checkout/cart');
|
191 |
}
|
192 |
|
206 |
// Call PxOrder.Complete
|
207 |
$params = array(
|
208 |
'accountNumber' => '',
|
209 |
+
'orderRef' => $orderRef
|
210 |
);
|
211 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
212 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
@@ -88,6 +88,7 @@ class PayEx_Payments_EvcController extends Mage_Core_Controller_Front_Action
|
|
88 |
$this->_redirect('checkout/cart');
|
89 |
return;
|
90 |
}
|
|
|
91 |
$order_ref = $result['orderRef'];
|
92 |
$redirectUrl = $result['redirectUrl'];
|
93 |
|
@@ -102,7 +103,6 @@ class PayEx_Payments_EvcController extends Mage_Core_Controller_Front_Action
|
|
102 |
$order->save();
|
103 |
|
104 |
// Redirect to PayEx
|
105 |
-
|
106 |
-
exit();
|
107 |
}
|
108 |
}
|
88 |
$this->_redirect('checkout/cart');
|
89 |
return;
|
90 |
}
|
91 |
+
|
92 |
$order_ref = $result['orderRef'];
|
93 |
$redirectUrl = $result['redirectUrl'];
|
94 |
|
103 |
$order->save();
|
104 |
|
105 |
// Redirect to PayEx
|
106 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
|
|
107 |
}
|
108 |
}
|
@@ -88,6 +88,7 @@ class PayEx_Payments_FinancingController extends Mage_Core_Controller_Front_Acti
|
|
88 |
$this->_redirect('checkout/cart');
|
89 |
return;
|
90 |
}
|
|
|
91 |
$order_ref = $result['orderRef'];
|
92 |
|
93 |
// Call PxOrder.PurchaseFinancingInvoice
|
88 |
$this->_redirect('checkout/cart');
|
89 |
return;
|
90 |
}
|
91 |
+
|
92 |
$order_ref = $result['orderRef'];
|
93 |
|
94 |
// Call PxOrder.PurchaseFinancingInvoice
|
@@ -88,6 +88,7 @@ class PayEx_Payments_GcController extends Mage_Core_Controller_Front_Action
|
|
88 |
$this->_redirect('checkout/cart');
|
89 |
return;
|
90 |
}
|
|
|
91 |
$order_ref = $result['orderRef'];
|
92 |
$redirectUrl = $result['redirectUrl'];
|
93 |
|
@@ -102,7 +103,6 @@ class PayEx_Payments_GcController extends Mage_Core_Controller_Front_Action
|
|
102 |
$order->save();
|
103 |
|
104 |
// Redirect to PayEx
|
105 |
-
|
106 |
-
exit();
|
107 |
}
|
108 |
}
|
88 |
$this->_redirect('checkout/cart');
|
89 |
return;
|
90 |
}
|
91 |
+
|
92 |
$order_ref = $result['orderRef'];
|
93 |
$redirectUrl = $result['redirectUrl'];
|
94 |
|
103 |
$order->save();
|
104 |
|
105 |
// Redirect to PayEx
|
106 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
|
|
107 |
}
|
108 |
}
|
@@ -115,11 +115,42 @@ class PayEx_Payments_InvoiceController extends Mage_Core_Controller_Front_Action
|
|
115 |
$this->_redirect('checkout/cart');
|
116 |
return;
|
117 |
}
|
|
|
118 |
$order_ref = $result['orderRef'];
|
119 |
|
120 |
-
// Add Order
|
121 |
-
Mage::helper('payex/order')->
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
$credit_data['full_name'] = trim($credit_data['firstName'] . ' ' . $credit_data['lastName']);
|
125 |
|
115 |
$this->_redirect('checkout/cart');
|
116 |
return;
|
117 |
}
|
118 |
+
|
119 |
$order_ref = $result['orderRef'];
|
120 |
|
121 |
+
// Add Order Items
|
122 |
+
$items = Mage::helper('payex/order')->getOrderItems($order);
|
123 |
+
foreach ($items as $index => $item) {
|
124 |
+
// Call PxOrder.AddSingleOrderLine2
|
125 |
+
$params = array(
|
126 |
+
'accountNumber' => '',
|
127 |
+
'orderRef' => $order_ref,
|
128 |
+
'itemNumber' => ($index + 1),
|
129 |
+
'itemDescription1' => $item['name'],
|
130 |
+
'itemDescription2' => '',
|
131 |
+
'itemDescription3' => '',
|
132 |
+
'itemDescription4' => '',
|
133 |
+
'itemDescription5' => '',
|
134 |
+
'quantity' => $item['qty'],
|
135 |
+
'amount' => (int)(100 * $item['price_with_tax']), //must include tax
|
136 |
+
'vatPrice' => (int)(100 * $item['tax_price']),
|
137 |
+
'vatPercent' => (int)(100 * $item['tax_percent'])
|
138 |
+
);
|
139 |
+
|
140 |
+
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
141 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
142 |
+
}
|
143 |
+
|
144 |
+
// Add Order Address Info
|
145 |
+
$params = array_merge(
|
146 |
+
array(
|
147 |
+
'accountNumber' => '',
|
148 |
+
'orderRef' => $order_ref
|
149 |
+
), Mage::helper('payex/order')->getAddressInfo($order)
|
150 |
+
);
|
151 |
+
|
152 |
+
$result = Mage::helper('payex/api')->getPx()->AddOrderAddress2($params);
|
153 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddOrderAddress2');
|
154 |
|
155 |
$credit_data['full_name'] = trim($credit_data['firstName'] . ' ' . $credit_data['lastName']);
|
156 |
|
@@ -40,7 +40,7 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
40 |
//$amount = $order->getGrandTotal();
|
41 |
$amount = Mage::helper('payex/order')->getCalculatedOrderAmount($order)->getAmount();
|
42 |
|
43 |
-
$additional = 'USEMASTERPASS=1&RESPONSIVE=1&SHOPPINGCARTXML=' . urlencode(
|
44 |
|
45 |
// Call PxOrder.Initialize8
|
46 |
$params = array(
|
@@ -88,6 +88,7 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
88 |
$this->_redirect('checkout/cart');
|
89 |
return;
|
90 |
}
|
|
|
91 |
//$order_ref = $result['orderRef'];
|
92 |
$redirectUrl = $result['redirectUrl'];
|
93 |
|
@@ -96,8 +97,7 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
96 |
$order->save();
|
97 |
|
98 |
// Redirect to PayEx
|
99 |
-
|
100 |
-
exit();
|
101 |
}
|
102 |
|
103 |
public function successAction()
|
@@ -105,7 +105,8 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
105 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
106 |
|
107 |
// Check OrderRef
|
108 |
-
|
|
|
109 |
$this->_redirect('checkout/cart');
|
110 |
return;
|
111 |
}
|
@@ -128,14 +129,14 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
128 |
// Call PxOrder.FinalizeTransaction
|
129 |
$params = array(
|
130 |
'accountNumber' => '',
|
131 |
-
'orderRef' => $
|
132 |
-
'amount' => round(
|
133 |
'vatAmount' => 0,
|
134 |
'clientIPAddress' => Mage::helper('core/http')->getRemoteAddr()
|
135 |
);
|
136 |
-
$result = Mage::helper('payex/api')->getPx()->FinalizeTransaction(
|
137 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.FinalizeTransaction');
|
138 |
-
if (
|
139 |
// Check order has already been purchased
|
140 |
//if ( $result['code'] === 'Order_AlreadyPerformed' ) {
|
141 |
// @todo
|
@@ -334,6 +335,7 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
334 |
if (!$quote->hasItems()) {
|
335 |
Mage::throwException(Mage::helper('payex')->__('You don\'t have any items in your cart'));
|
336 |
}
|
|
|
337 |
if (!$quote->getGrandTotal() && !$quote->hasNominalItems()) {
|
338 |
Mage::throwException(Mage::helper('payex')->__('Order total is too small'));
|
339 |
}
|
@@ -355,7 +357,7 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
355 |
$operation = (Mage::getSingleton('payex/payment_MasterPass')->getConfigData('transactiontype') == 0) ? 'AUTHORIZATION' : 'SALE';
|
356 |
|
357 |
// Get Additional Values
|
358 |
-
$additional = 'USEMASTERPASS=1&RESPONSIVE=1&SHOPPINGCARTXML=' . urlencode(
|
359 |
|
360 |
// Call PxOrder.Initialize8
|
361 |
$params = array(
|
@@ -407,19 +409,18 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
407 |
Mage::getSingleton('checkout/session')->clear();
|
408 |
|
409 |
// Redirect to PayEx
|
410 |
-
|
411 |
-
exit();
|
412 |
}
|
413 |
|
414 |
-
public function mp_successAction()
|
|
|
415 |
// Check OrderRef
|
416 |
-
|
|
|
417 |
$this->_redirect('checkout/cart');
|
418 |
return;
|
419 |
}
|
420 |
|
421 |
-
$orderRef = $_GET['orderRef'];
|
422 |
-
|
423 |
// Set quote to active
|
424 |
if ($quoteId = Mage::getSingleton('checkout/session')->getPayexQuoteId()) {
|
425 |
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
@@ -437,8 +438,8 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
437 |
'accountNumber' => '',
|
438 |
'orderRef' => $orderRef
|
439 |
);
|
440 |
-
$result = Mage::helper('payex/api')->getPx()->GetApprovedDeliveryAddress(
|
441 |
-
if (
|
442 |
$message = Mage::helper('payex/tools')->getVerboseErrorMessage($result);
|
443 |
|
444 |
Mage::getSingleton('checkout/session')->addError($message);
|
@@ -540,12 +541,12 @@ class PayEx_Payments_MasterpassController extends Mage_Core_Controller_Front_Act
|
|
540 |
$params = array(
|
541 |
'accountNumber' => '',
|
542 |
'orderRef' => $orderRef,
|
543 |
-
'amount' => round(
|
544 |
'vatAmount' => 0,
|
545 |
'clientIPAddress' => Mage::helper('core/http')->getRemoteAddr()
|
546 |
);
|
547 |
-
$result = Mage::helper('payex/api')->getPx()->FinalizeTransaction(
|
548 |
-
if (
|
549 |
$message = Mage::helper('payex/tools')->getVerboseErrorMessage($result);
|
550 |
|
551 |
// Cancel order
|
40 |
//$amount = $order->getGrandTotal();
|
41 |
$amount = Mage::helper('payex/order')->getCalculatedOrderAmount($order)->getAmount();
|
42 |
|
43 |
+
$additional = 'USEMASTERPASS=1&RESPONSIVE=1&SHOPPINGCARTXML=' . urlencode(Mage::helper('payex/order')->getShoppingCartXML($order));
|
44 |
|
45 |
// Call PxOrder.Initialize8
|
46 |
$params = array(
|
88 |
$this->_redirect('checkout/cart');
|
89 |
return;
|
90 |
}
|
91 |
+
|
92 |
//$order_ref = $result['orderRef'];
|
93 |
$redirectUrl = $result['redirectUrl'];
|
94 |
|
97 |
$order->save();
|
98 |
|
99 |
// Redirect to PayEx
|
100 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
|
|
101 |
}
|
102 |
|
103 |
public function successAction()
|
105 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
106 |
|
107 |
// Check OrderRef
|
108 |
+
$orderRef = $this->getRequest()->getParam('orderRef');
|
109 |
+
if (empty($orderRef)) {
|
110 |
$this->_redirect('checkout/cart');
|
111 |
return;
|
112 |
}
|
129 |
// Call PxOrder.FinalizeTransaction
|
130 |
$params = array(
|
131 |
'accountNumber' => '',
|
132 |
+
'orderRef' => $orderRef,
|
133 |
+
'amount' => round($amount * 100),
|
134 |
'vatAmount' => 0,
|
135 |
'clientIPAddress' => Mage::helper('core/http')->getRemoteAddr()
|
136 |
);
|
137 |
+
$result = Mage::helper('payex/api')->getPx()->FinalizeTransaction($params);
|
138 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.FinalizeTransaction');
|
139 |
+
if ($result['code'] !== 'OK' || $result['description'] !== 'OK' || $result['errorCode'] !== 'OK') {
|
140 |
// Check order has already been purchased
|
141 |
//if ( $result['code'] === 'Order_AlreadyPerformed' ) {
|
142 |
// @todo
|
335 |
if (!$quote->hasItems()) {
|
336 |
Mage::throwException(Mage::helper('payex')->__('You don\'t have any items in your cart'));
|
337 |
}
|
338 |
+
|
339 |
if (!$quote->getGrandTotal() && !$quote->hasNominalItems()) {
|
340 |
Mage::throwException(Mage::helper('payex')->__('Order total is too small'));
|
341 |
}
|
357 |
$operation = (Mage::getSingleton('payex/payment_MasterPass')->getConfigData('transactiontype') == 0) ? 'AUTHORIZATION' : 'SALE';
|
358 |
|
359 |
// Get Additional Values
|
360 |
+
$additional = 'USEMASTERPASS=1&RESPONSIVE=1&SHOPPINGCARTXML=' . urlencode(Mage::helper('payex/order')->getShoppingCartXML($quote));
|
361 |
|
362 |
// Call PxOrder.Initialize8
|
363 |
$params = array(
|
409 |
Mage::getSingleton('checkout/session')->clear();
|
410 |
|
411 |
// Redirect to PayEx
|
412 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
|
|
413 |
}
|
414 |
|
415 |
+
public function mp_successAction()
|
416 |
+
{
|
417 |
// Check OrderRef
|
418 |
+
$orderRef = $this->getRequest()->getParam('orderRef');
|
419 |
+
if (empty($orderRef)) {
|
420 |
$this->_redirect('checkout/cart');
|
421 |
return;
|
422 |
}
|
423 |
|
|
|
|
|
424 |
// Set quote to active
|
425 |
if ($quoteId = Mage::getSingleton('checkout/session')->getPayexQuoteId()) {
|
426 |
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
438 |
'accountNumber' => '',
|
439 |
'orderRef' => $orderRef
|
440 |
);
|
441 |
+
$result = Mage::helper('payex/api')->getPx()->GetApprovedDeliveryAddress($params);
|
442 |
+
if ($result['code'] !== 'OK' || $result['description'] !== 'OK' || $result['errorCode'] !== 'OK') {
|
443 |
$message = Mage::helper('payex/tools')->getVerboseErrorMessage($result);
|
444 |
|
445 |
Mage::getSingleton('checkout/session')->addError($message);
|
541 |
$params = array(
|
542 |
'accountNumber' => '',
|
543 |
'orderRef' => $orderRef,
|
544 |
+
'amount' => round($order->getGrandTotal() * 100),
|
545 |
'vatAmount' => 0,
|
546 |
'clientIPAddress' => Mage::helper('core/http')->getRemoteAddr()
|
547 |
);
|
548 |
+
$result = Mage::helper('payex/api')->getPx()->FinalizeTransaction($params);
|
549 |
+
if ($result['code'] !== 'OK' || $result['description'] !== 'OK' || $result['errorCode'] !== 'OK') {
|
550 |
$message = Mage::helper('payex/tools')->getVerboseErrorMessage($result);
|
551 |
|
552 |
// Cancel order
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PayEx_Payments_MobilepayController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Bootstrap PayEx Environment
|
8 |
+
Mage::getSingleton('payex/payment_mobilepay');
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @throws Exception
|
13 |
+
* @throws Mage_Core_Exception
|
14 |
+
*/
|
15 |
+
public function redirectAction()
|
16 |
+
{
|
17 |
+
Mage::helper('payex/tools')->addToDebug('Controller: redirect');
|
18 |
+
|
19 |
+
// Load Order
|
20 |
+
$order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
21 |
+
|
22 |
+
/** @var Mage_Sales_Model_Order $order */
|
23 |
+
$order = Mage::getModel('sales/order');
|
24 |
+
$order->loadByIncrementId($order_id);
|
25 |
+
if (!$order->getId()) {
|
26 |
+
Mage::throwException('No order for processing found');
|
27 |
+
}
|
28 |
+
|
29 |
+
// Set quote to inactive
|
30 |
+
Mage::getSingleton('checkout/session')->setPayexQuoteId(Mage::getSingleton('checkout/session')->getQuoteId());
|
31 |
+
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
32 |
+
Mage::getSingleton('checkout/session')->clear();
|
33 |
+
|
34 |
+
/** @var PayEx_Payments_Model_Payment_Abstract $method */
|
35 |
+
$method = $order->getPayment()->getMethodInstance();
|
36 |
+
|
37 |
+
// Get Currency code
|
38 |
+
$currency_code = $order->getOrderCurrency()->getCurrencyCode();
|
39 |
+
|
40 |
+
// Get Operation Type (AUTHORIZATION / SALE)
|
41 |
+
$operation = ($method->getConfigData('transactiontype') == 0) ? 'AUTHORIZATION' : 'SALE';
|
42 |
+
|
43 |
+
// Get Amount
|
44 |
+
//$amount = $order->getGrandTotal();
|
45 |
+
$amount = Mage::helper('payex/order')->getCalculatedOrderAmount($order)->getAmount();
|
46 |
+
|
47 |
+
// Call PxOrder.Initialize8
|
48 |
+
$params = array(
|
49 |
+
'accountNumber' => '',
|
50 |
+
'purchaseOperation' => $operation,
|
51 |
+
'price' => round($amount * 100),
|
52 |
+
'priceArgList' => '',
|
53 |
+
'currency' => $currency_code,
|
54 |
+
'vat' => 0,
|
55 |
+
'orderID' => $order_id,
|
56 |
+
'productNumber' => $order_id,
|
57 |
+
'description' => Mage::app()->getStore()->getName(),
|
58 |
+
'clientIPAddress' => Mage::helper('core/http')->getRemoteAddr(),
|
59 |
+
'clientIdentifier' => 'USERAGENT=' . Mage::helper('core/http')->getHttpUserAgent(),
|
60 |
+
'additionalValues' => 'RESPONSIVE=1&USEMOBILEPAY=True',
|
61 |
+
'externalID' => '',
|
62 |
+
'returnUrl' => Mage::getUrl('payex/payment/success', array('_secure' => true)),
|
63 |
+
'view' => 'CREDITCARD',
|
64 |
+
'agreementRef' => '',
|
65 |
+
'cancelUrl' => Mage::getUrl('payex/payment/cancel', array('_secure' => true)),
|
66 |
+
'clientLanguage' => $method->getConfigData('clientlanguage')
|
67 |
+
);
|
68 |
+
$result = Mage::helper('payex/api')->getPx()->Initialize8($params);
|
69 |
+
Mage::helper('payex/tools')->addToDebug('PxOrder.Initialize8:' . $result['description']);
|
70 |
+
|
71 |
+
// Check Errors
|
72 |
+
if ($result['code'] !== 'OK' || $result['description'] !== 'OK' || $result['errorCode'] !== 'OK') {
|
73 |
+
$message = Mage::helper('payex/tools')->getVerboseErrorMessage($result);
|
74 |
+
|
75 |
+
// Cancel order
|
76 |
+
$order->cancel();
|
77 |
+
$order->addStatusHistoryComment($message, Mage_Sales_Model_Order::STATE_CANCELED);
|
78 |
+
$order->save();
|
79 |
+
|
80 |
+
// Set quote to active
|
81 |
+
if ($quoteId = Mage::getSingleton('checkout/session')->getPayexQuoteId()) {
|
82 |
+
$quote = Mage::getModel('sales/quote')->load($quoteId);
|
83 |
+
if ($quote->getId()) {
|
84 |
+
$quote->setIsActive(true)->save();
|
85 |
+
Mage::getSingleton('checkout/session')->setQuoteId($quoteId);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
Mage::getSingleton('checkout/session')->addError($message);
|
90 |
+
$this->_redirect('checkout/cart');
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
|
94 |
+
$order_ref = $result['orderRef'];
|
95 |
+
$redirectUrl = $result['redirectUrl'];
|
96 |
+
|
97 |
+
// Set Pending Payment status
|
98 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage::helper('payex')->__('The customer was redirected to PayEx.'));
|
99 |
+
$order->save();
|
100 |
+
|
101 |
+
// Redirect to PayEx
|
102 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
103 |
+
}
|
104 |
+
}
|
@@ -86,6 +86,7 @@ class PayEx_Payments_PartpaymentController extends Mage_Core_Controller_Front_Ac
|
|
86 |
$this->_redirect('checkout/cart');
|
87 |
return;
|
88 |
}
|
|
|
89 |
$order_ref = $result['orderRef'];
|
90 |
|
91 |
// Call PxOrder.PurchaseCreditAccount
|
86 |
$this->_redirect('checkout/cart');
|
87 |
return;
|
88 |
}
|
89 |
+
|
90 |
$order_ref = $result['orderRef'];
|
91 |
|
92 |
// Call PxOrder.PurchaseCreditAccount
|
@@ -122,13 +122,45 @@ class PayEx_Payments_PaymentController extends Mage_Core_Controller_Front_Action
|
|
122 |
$this->_redirect('checkout/cart');
|
123 |
return;
|
124 |
}
|
|
|
125 |
$order_ref = $result['orderRef'];
|
126 |
$redirectUrl = $result['redirectUrl'];
|
127 |
|
128 |
// Add Order Lines and Orders Address
|
129 |
if ($method->getConfigData('checkoutinfo')) {
|
130 |
-
|
131 |
-
Mage::helper('payex/order')->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
// Set Pending Payment status
|
@@ -136,8 +168,7 @@ class PayEx_Payments_PaymentController extends Mage_Core_Controller_Front_Action
|
|
136 |
$order->save();
|
137 |
|
138 |
// Redirect to PayEx
|
139 |
-
|
140 |
-
exit();
|
141 |
}
|
142 |
|
143 |
/**
|
@@ -149,7 +180,8 @@ class PayEx_Payments_PaymentController extends Mage_Core_Controller_Front_Action
|
|
149 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
150 |
|
151 |
// Check OrderRef
|
152 |
-
|
|
|
153 |
$this->_redirect('checkout/cart');
|
154 |
return;
|
155 |
}
|
@@ -170,7 +202,7 @@ class PayEx_Payments_PaymentController extends Mage_Core_Controller_Front_Action
|
|
170 |
// Call PxOrder.Complete
|
171 |
$params = array(
|
172 |
'accountNumber' => '',
|
173 |
-
'orderRef' => $
|
174 |
);
|
175 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
176 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
122 |
$this->_redirect('checkout/cart');
|
123 |
return;
|
124 |
}
|
125 |
+
|
126 |
$order_ref = $result['orderRef'];
|
127 |
$redirectUrl = $result['redirectUrl'];
|
128 |
|
129 |
// Add Order Lines and Orders Address
|
130 |
if ($method->getConfigData('checkoutinfo')) {
|
131 |
+
// Add Order Items
|
132 |
+
$items = Mage::helper('payex/order')->getOrderItems($order);
|
133 |
+
foreach ($items as $index => $item) {
|
134 |
+
// Call PxOrder.AddSingleOrderLine2
|
135 |
+
$params = array(
|
136 |
+
'accountNumber' => '',
|
137 |
+
'orderRef' => $order_ref,
|
138 |
+
'itemNumber' => ($index + 1),
|
139 |
+
'itemDescription1' => $item['name'],
|
140 |
+
'itemDescription2' => '',
|
141 |
+
'itemDescription3' => '',
|
142 |
+
'itemDescription4' => '',
|
143 |
+
'itemDescription5' => '',
|
144 |
+
'quantity' => $item['qty'],
|
145 |
+
'amount' => (int)(100 * $item['price_with_tax']), //must include tax
|
146 |
+
'vatPrice' => (int)(100 * $item['tax_price']),
|
147 |
+
'vatPercent' => (int)(100 * $item['tax_percent'])
|
148 |
+
);
|
149 |
+
|
150 |
+
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
151 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
152 |
+
}
|
153 |
+
|
154 |
+
// Add Order Address Info
|
155 |
+
$params = array_merge(
|
156 |
+
array(
|
157 |
+
'accountNumber' => '',
|
158 |
+
'orderRef' => $order_ref
|
159 |
+
), Mage::helper('payex/order')->getAddressInfo($order)
|
160 |
+
);
|
161 |
+
|
162 |
+
$result = Mage::helper('payex/api')->getPx()->AddOrderAddress2($params);
|
163 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddOrderAddress2');
|
164 |
}
|
165 |
|
166 |
// Set Pending Payment status
|
168 |
$order->save();
|
169 |
|
170 |
// Redirect to PayEx
|
171 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
|
|
172 |
}
|
173 |
|
174 |
/**
|
180 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
181 |
|
182 |
// Check OrderRef
|
183 |
+
$orderRef = $this->getRequest()->getParam('orderRef');
|
184 |
+
if (empty($orderRef)) {
|
185 |
$this->_redirect('checkout/cart');
|
186 |
return;
|
187 |
}
|
202 |
// Call PxOrder.Complete
|
203 |
$params = array(
|
204 |
'accountNumber' => '',
|
205 |
+
'orderRef' => $orderRef
|
206 |
);
|
207 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
208 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
@@ -97,22 +97,53 @@ class PayEx_Payments_SwishController extends Mage_Core_Controller_Front_Action
|
|
97 |
$this->_redirect('checkout/cart');
|
98 |
return;
|
99 |
}
|
|
|
100 |
Mage::helper('payex/tools')->addToDebug('Redirect URL: ' . $result['redirectUrl']);
|
101 |
$order_ref = $result['orderRef'];
|
102 |
|
103 |
// Add Order Lines and Orders Address
|
104 |
if ($method->getConfigData('checkoutinfo')) {
|
105 |
-
|
106 |
-
Mage::helper('payex/order')->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
|
109 |
// Set Pending Payment status
|
110 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
111 |
$order->save();
|
112 |
|
113 |
// Redirect to Bank
|
114 |
-
|
115 |
-
exit();
|
116 |
}
|
117 |
|
118 |
public function successAction()
|
@@ -120,7 +151,8 @@ class PayEx_Payments_SwishController extends Mage_Core_Controller_Front_Action
|
|
120 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
121 |
|
122 |
// Check OrderRef
|
123 |
-
|
|
|
124 |
$this->_redirect('checkout/cart');
|
125 |
}
|
126 |
|
@@ -140,7 +172,7 @@ class PayEx_Payments_SwishController extends Mage_Core_Controller_Front_Action
|
|
140 |
// Call PxOrder.Complete
|
141 |
$params = array(
|
142 |
'accountNumber' => '',
|
143 |
-
'orderRef' => $
|
144 |
);
|
145 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
146 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
97 |
$this->_redirect('checkout/cart');
|
98 |
return;
|
99 |
}
|
100 |
+
|
101 |
Mage::helper('payex/tools')->addToDebug('Redirect URL: ' . $result['redirectUrl']);
|
102 |
$order_ref = $result['orderRef'];
|
103 |
|
104 |
// Add Order Lines and Orders Address
|
105 |
if ($method->getConfigData('checkoutinfo')) {
|
106 |
+
// Add Order Items
|
107 |
+
$items = Mage::helper('payex/order')->getOrderItems($order);
|
108 |
+
foreach ($items as $index => $item) {
|
109 |
+
// Call PxOrder.AddSingleOrderLine2
|
110 |
+
$params = array(
|
111 |
+
'accountNumber' => '',
|
112 |
+
'orderRef' => $order_ref,
|
113 |
+
'itemNumber' => ($index + 1),
|
114 |
+
'itemDescription1' => $item['name'],
|
115 |
+
'itemDescription2' => '',
|
116 |
+
'itemDescription3' => '',
|
117 |
+
'itemDescription4' => '',
|
118 |
+
'itemDescription5' => '',
|
119 |
+
'quantity' => $item['qty'],
|
120 |
+
'amount' => (int)(100 * $item['price_with_tax']), //must include tax
|
121 |
+
'vatPrice' => (int)(100 * $item['tax_price']),
|
122 |
+
'vatPercent' => (int)(100 * $item['tax_percent'])
|
123 |
+
);
|
124 |
+
|
125 |
+
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
126 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
127 |
+
}
|
128 |
+
|
129 |
+
// Add Order Address Info
|
130 |
+
$params = array_merge(
|
131 |
+
array(
|
132 |
+
'accountNumber' => '',
|
133 |
+
'orderRef' => $order_ref
|
134 |
+
), Mage::helper('payex/order')->getAddressInfo($order)
|
135 |
+
);
|
136 |
+
|
137 |
+
$result = Mage::helper('payex/api')->getPx()->AddOrderAddress2($params);
|
138 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddOrderAddress2');
|
139 |
}
|
140 |
|
141 |
// Set Pending Payment status
|
142 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage::helper('payex')->__('The customer was redirected to PayEx.'));
|
143 |
$order->save();
|
144 |
|
145 |
// Redirect to Bank
|
146 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
|
|
147 |
}
|
148 |
|
149 |
public function successAction()
|
151 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
152 |
|
153 |
// Check OrderRef
|
154 |
+
$orderRef = $this->getRequest()->getParam('orderRef');
|
155 |
+
if (empty($orderRef)) {
|
156 |
$this->_redirect('checkout/cart');
|
157 |
}
|
158 |
|
172 |
// Call PxOrder.Complete
|
173 |
$params = array(
|
174 |
'accountNumber' => '',
|
175 |
+
'orderRef' => $orderRef
|
176 |
);
|
177 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
178 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
@@ -25,22 +25,36 @@ class PayEx_Payments_TransactionController extends Mage_Core_Controller_Front_Ac
|
|
25 |
// Check is PayEx Request
|
26 |
if (!in_array($remote_addr, self::$_allowed_ips)) {
|
27 |
Mage::helper('payex/tools')->addToDebug('TC: Access denied for this request. It\'s not PayEx Spider.');
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
|
33 |
// Check Post Fields
|
34 |
-
|
35 |
-
|
36 |
Mage::helper('payex/tools')->addToDebug('TC: Error: Empty request received.');
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
40 |
}
|
41 |
|
42 |
// Detect Payment Method of Order
|
43 |
-
$order_id = $
|
44 |
|
45 |
/**
|
46 |
* @var Mage_Sales_Model_Order @order
|
@@ -49,17 +63,21 @@ class PayEx_Payments_TransactionController extends Mage_Core_Controller_Front_Ac
|
|
49 |
$order->loadByIncrementId($order_id);
|
50 |
if (!$order->getId()) {
|
51 |
Mage::helper('payex/tools')->addToDebug('TC: Error: OrderID ' . $order_id . ' not found on store.');
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
55 |
}
|
56 |
|
57 |
// Check Payment Method
|
58 |
if (strpos($order->getPayment()->getMethodInstance()->getCode(), 'payex_') === false) {
|
59 |
Mage::helper('payex/tools')->addToDebug('TC: Unsupported payment method: ' . $order->getPayment()->getMethodInstance()->getCode());
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
}
|
64 |
|
65 |
// Get Payment Method instance
|
@@ -71,27 +89,31 @@ class PayEx_Payments_TransactionController extends Mage_Core_Controller_Front_Ac
|
|
71 |
$debug = (bool)$payment_method->getConfigData('debug', $order->getStoreId());
|
72 |
|
73 |
// Check Requested Account Number
|
74 |
-
if ($
|
75 |
-
Mage::helper('payex/tools')->addToDebug('TC: Error: Can\'t to get account details of : ' . $
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
79 |
}
|
80 |
|
81 |
// Define PayEx Settings
|
82 |
Mage::helper('payex/api')->getPx()->setEnvironment($accountNumber, $encryptionKey, $debug);
|
83 |
|
84 |
// Get Transaction Details
|
85 |
-
$transactionId = $
|
86 |
|
87 |
// Lookup Transaction
|
88 |
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
89 |
->addAttributeToFilter('txn_id', $transactionId);
|
90 |
if (count($collection) > 0) {
|
91 |
Mage::helper('payex/tools')->addToDebug(sprintf('TC: Transaction %s already processed.', $transactionId));
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
95 |
}
|
96 |
|
97 |
// Call PxOrder.GetTransactionDetails2
|
@@ -143,23 +165,27 @@ class PayEx_Payments_TransactionController extends Mage_Core_Controller_Front_Ac
|
|
143 |
// Call PxOrder.Complete
|
144 |
$params = array(
|
145 |
'accountNumber' => '',
|
146 |
-
'orderRef' => $
|
147 |
);
|
148 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
149 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
150 |
if ($result['errorCodeSimple'] !== 'OK') {
|
151 |
Mage::helper('payex/tools')->addToDebug('TC: Failed to complete payment.');
|
152 |
-
|
153 |
-
|
154 |
-
|
|
|
|
|
155 |
}
|
156 |
|
157 |
// Verify transaction status
|
158 |
if ((int)$result['transactionStatus'] !== $transaction_status) {
|
159 |
Mage::helper('payex/tools')->addToDebug('TC: Failed to complete payment. Transaction status is different!');
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
163 |
}
|
164 |
|
165 |
// Select Order Status
|
@@ -257,16 +283,18 @@ class PayEx_Payments_TransactionController extends Mage_Core_Controller_Front_Ac
|
|
257 |
}
|
258 |
break;
|
259 |
default:
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
|
|
264 |
}
|
265 |
|
266 |
// Show "OK"
|
267 |
Mage::helper('payex/tools')->addToDebug('TC: Done.');
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
271 |
}
|
272 |
}
|
25 |
// Check is PayEx Request
|
26 |
if (!in_array($remote_addr, self::$_allowed_ips)) {
|
27 |
Mage::helper('payex/tools')->addToDebug('TC: Access denied for this request. It\'s not PayEx Spider.');
|
28 |
+
|
29 |
+
$this->getResponse()
|
30 |
+
->setHeader('HTTP/1.1', 403, true)
|
31 |
+
->setBody('Access denied. Accept PayEx Transaction Callback only.');
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
// is Post
|
36 |
+
if (!$this->getRequest()->isPost()) {
|
37 |
+
Mage::helper('payex/tools')->addToDebug('TC: Error: Empty request received.');
|
38 |
+
|
39 |
+
$this->getResponse()
|
40 |
+
->setHeader('HTTP/1.1', 500, true)
|
41 |
+
->setBody('FAILURE');
|
42 |
+
return;
|
43 |
}
|
44 |
|
45 |
// Check Post Fields
|
46 |
+
if (!$this->getRequest()->isPost() || count($this->getRequest()->getPost()) == 0) {
|
47 |
+
Mage::helper('payex/tools')->addToDebug('TC: Requested Params: ' . var_export($this->getRequest()->getPost(), true));
|
48 |
Mage::helper('payex/tools')->addToDebug('TC: Error: Empty request received.');
|
49 |
+
|
50 |
+
$this->getResponse()
|
51 |
+
->setHeader('HTTP/1.1', 500, true)
|
52 |
+
->setBody('FAILURE');
|
53 |
+
return;
|
54 |
}
|
55 |
|
56 |
// Detect Payment Method of Order
|
57 |
+
$order_id = $this->getRequest()->getPost('orderId');
|
58 |
|
59 |
/**
|
60 |
* @var Mage_Sales_Model_Order @order
|
63 |
$order->loadByIncrementId($order_id);
|
64 |
if (!$order->getId()) {
|
65 |
Mage::helper('payex/tools')->addToDebug('TC: Error: OrderID ' . $order_id . ' not found on store.');
|
66 |
+
|
67 |
+
$this->getResponse()
|
68 |
+
->setHeader('HTTP/1.1', 500, true)
|
69 |
+
->setBody('FAILURE');
|
70 |
+
return;
|
71 |
}
|
72 |
|
73 |
// Check Payment Method
|
74 |
if (strpos($order->getPayment()->getMethodInstance()->getCode(), 'payex_') === false) {
|
75 |
Mage::helper('payex/tools')->addToDebug('TC: Unsupported payment method: ' . $order->getPayment()->getMethodInstance()->getCode());
|
76 |
+
|
77 |
+
$this->getResponse()
|
78 |
+
->setHeader('HTTP/1.1', 500, true)
|
79 |
+
->setBody('FAILURE');
|
80 |
+
return;
|
81 |
}
|
82 |
|
83 |
// Get Payment Method instance
|
89 |
$debug = (bool)$payment_method->getConfigData('debug', $order->getStoreId());
|
90 |
|
91 |
// Check Requested Account Number
|
92 |
+
if ($this->getRequest()->getPost('accountNumber') !== $accountNumber) {
|
93 |
+
Mage::helper('payex/tools')->addToDebug('TC: Error: Can\'t to get account details of : ' . $this->getRequest()->getPost('accountNumber'));
|
94 |
+
|
95 |
+
$this->getResponse()
|
96 |
+
->setHeader('HTTP/1.1', 500, true)
|
97 |
+
->setBody('FAILURE');
|
98 |
+
return;
|
99 |
}
|
100 |
|
101 |
// Define PayEx Settings
|
102 |
Mage::helper('payex/api')->getPx()->setEnvironment($accountNumber, $encryptionKey, $debug);
|
103 |
|
104 |
// Get Transaction Details
|
105 |
+
$transactionId = $this->getRequest()->getPost('transactionNumber');
|
106 |
|
107 |
// Lookup Transaction
|
108 |
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
109 |
->addAttributeToFilter('txn_id', $transactionId);
|
110 |
if (count($collection) > 0) {
|
111 |
Mage::helper('payex/tools')->addToDebug(sprintf('TC: Transaction %s already processed.', $transactionId));
|
112 |
+
|
113 |
+
$this->getResponse()
|
114 |
+
->setHeader('HTTP/1.1', 500, true)
|
115 |
+
->setBody('FAILURE');
|
116 |
+
return;
|
117 |
}
|
118 |
|
119 |
// Call PxOrder.GetTransactionDetails2
|
165 |
// Call PxOrder.Complete
|
166 |
$params = array(
|
167 |
'accountNumber' => '',
|
168 |
+
'orderRef' => $this->getRequest()->getPost('orderRef'),
|
169 |
);
|
170 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
171 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
172 |
if ($result['errorCodeSimple'] !== 'OK') {
|
173 |
Mage::helper('payex/tools')->addToDebug('TC: Failed to complete payment.');
|
174 |
+
|
175 |
+
$this->getResponse()
|
176 |
+
->setHeader('HTTP/1.1', 500, true)
|
177 |
+
->setBody('FAILURE');
|
178 |
+
return;
|
179 |
}
|
180 |
|
181 |
// Verify transaction status
|
182 |
if ((int)$result['transactionStatus'] !== $transaction_status) {
|
183 |
Mage::helper('payex/tools')->addToDebug('TC: Failed to complete payment. Transaction status is different!');
|
184 |
+
|
185 |
+
$this->getResponse()
|
186 |
+
->setHeader('HTTP/1.1', 500, true)
|
187 |
+
->setBody('FAILURE');
|
188 |
+
return;
|
189 |
}
|
190 |
|
191 |
// Select Order Status
|
283 |
}
|
284 |
break;
|
285 |
default:
|
286 |
+
$this->getResponse()
|
287 |
+
->setHeader('HTTP/1.1', 500, true)
|
288 |
+
->setBody('FAILURE');
|
289 |
+
|
290 |
+
return;
|
291 |
}
|
292 |
|
293 |
// Show "OK"
|
294 |
Mage::helper('payex/tools')->addToDebug('TC: Done.');
|
295 |
+
|
296 |
+
$this->getResponse()
|
297 |
+
->setHeader('HTTP/1.1', 200, true)
|
298 |
+
->setBody('OK');
|
299 |
}
|
300 |
}
|
@@ -83,13 +83,45 @@ class PayEx_Payments_WywalletController extends Mage_Core_Controller_Front_Actio
|
|
83 |
$this->_redirect('checkout/cart');
|
84 |
return;
|
85 |
}
|
|
|
86 |
$order_ref = $result['orderRef'];
|
87 |
$redirectUrl = $result['redirectUrl'];
|
88 |
|
89 |
// Add Order Lines and Orders Address
|
90 |
if ($method->getConfigData('checkoutinfo')) {
|
91 |
-
|
92 |
-
Mage::helper('payex/order')->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
// Set Pending Payment status
|
@@ -97,8 +129,7 @@ class PayEx_Payments_WywalletController extends Mage_Core_Controller_Front_Actio
|
|
97 |
$order->save();
|
98 |
|
99 |
// Redirect to Bank
|
100 |
-
|
101 |
-
exit();
|
102 |
}
|
103 |
|
104 |
public function successAction()
|
@@ -106,7 +137,8 @@ class PayEx_Payments_WywalletController extends Mage_Core_Controller_Front_Actio
|
|
106 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
107 |
|
108 |
// Check OrderRef
|
109 |
-
|
|
|
110 |
$this->_redirect('checkout/cart');
|
111 |
}
|
112 |
|
@@ -126,7 +158,7 @@ class PayEx_Payments_WywalletController extends Mage_Core_Controller_Front_Actio
|
|
126 |
// Call PxOrder.Complete
|
127 |
$params = array(
|
128 |
'accountNumber' => '',
|
129 |
-
'orderRef' => $
|
130 |
);
|
131 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
132 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
83 |
$this->_redirect('checkout/cart');
|
84 |
return;
|
85 |
}
|
86 |
+
|
87 |
$order_ref = $result['orderRef'];
|
88 |
$redirectUrl = $result['redirectUrl'];
|
89 |
|
90 |
// Add Order Lines and Orders Address
|
91 |
if ($method->getConfigData('checkoutinfo')) {
|
92 |
+
// Add Order Items
|
93 |
+
$items = Mage::helper('payex/order')->getOrderItems($order);
|
94 |
+
foreach ($items as $index => $item) {
|
95 |
+
// Call PxOrder.AddSingleOrderLine2
|
96 |
+
$params = array(
|
97 |
+
'accountNumber' => '',
|
98 |
+
'orderRef' => $order_ref,
|
99 |
+
'itemNumber' => ($index + 1),
|
100 |
+
'itemDescription1' => $item['name'],
|
101 |
+
'itemDescription2' => '',
|
102 |
+
'itemDescription3' => '',
|
103 |
+
'itemDescription4' => '',
|
104 |
+
'itemDescription5' => '',
|
105 |
+
'quantity' => $item['qty'],
|
106 |
+
'amount' => (int)(100 * $item['price_with_tax']), //must include tax
|
107 |
+
'vatPrice' => (int)(100 * $item['tax_price']),
|
108 |
+
'vatPercent' => (int)(100 * $item['tax_percent'])
|
109 |
+
);
|
110 |
+
|
111 |
+
$result = Mage::helper('payex/api')->getPx()->AddSingleOrderLine2($params);
|
112 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddSingleOrderLine2');
|
113 |
+
}
|
114 |
+
|
115 |
+
// Add Order Address Info
|
116 |
+
$params = array_merge(
|
117 |
+
array(
|
118 |
+
'accountNumber' => '',
|
119 |
+
'orderRef' => $order_ref
|
120 |
+
), Mage::helper('payex/order')->getAddressInfo($order)
|
121 |
+
);
|
122 |
+
|
123 |
+
$result = Mage::helper('payex/api')->getPx()->AddOrderAddress2($params);
|
124 |
+
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.AddOrderAddress2');
|
125 |
}
|
126 |
|
127 |
// Set Pending Payment status
|
129 |
$order->save();
|
130 |
|
131 |
// Redirect to Bank
|
132 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
|
|
133 |
}
|
134 |
|
135 |
public function successAction()
|
137 |
Mage::helper('payex/tools')->addToDebug('Controller: success');
|
138 |
|
139 |
// Check OrderRef
|
140 |
+
$orderRef = $this->getRequest()->getParam('orderRef');
|
141 |
+
if (empty($orderRef)) {
|
142 |
$this->_redirect('checkout/cart');
|
143 |
}
|
144 |
|
158 |
// Call PxOrder.Complete
|
159 |
$params = array(
|
160 |
'accountNumber' => '',
|
161 |
+
'orderRef' => $orderRef
|
162 |
);
|
163 |
$result = Mage::helper('payex/api')->getPx()->Complete($params);
|
164 |
Mage::helper('payex/tools')->debugApi($result, 'PxOrder.Complete');
|
@@ -12,105 +12,107 @@ $readConnection = $resource->getConnection('core_read');
|
|
12 |
// Convert Agreements to PayEx Billing Agreement
|
13 |
$default_label = Mage::helper('payex')->__('Untitled Credit Card');
|
14 |
$payexautopay_agreement_table = $resource->getTableName('payexautopay_agreement');
|
15 |
-
|
16 |
-
|
17 |
-
$
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
// Check Billing Agreement is already exists
|
27 |
-
/** @var Mage_Sales_Model_Billing_Agreement $billing_agreement */
|
28 |
-
$billing_agreement = Mage::getModel('sales/billing_agreement')->load($agreement_ref, 'reference_id');
|
29 |
-
if ($billing_agreement->getId()) {
|
30 |
-
continue;
|
31 |
-
}
|
32 |
-
|
33 |
-
// Create Billing Agreement
|
34 |
-
$billing_agreement = Mage::getModel('sales/billing_agreement');
|
35 |
-
$billing_agreement->setCustomerId($customer_id)
|
36 |
-
->setMethodCode(PayEx_Payments_Model_Payment_Agreement::METHOD_BILLING_AGREEMENT)
|
37 |
-
->setReferenceId($agreement_ref)
|
38 |
-
->setStatus(Mage_Sales_Model_Billing_Agreement::STATUS_ACTIVE)
|
39 |
-
->setCreatedAt($created_at)
|
40 |
-
->setAgreementLabel($default_label)
|
41 |
-
->save();
|
42 |
-
}
|
43 |
-
|
44 |
-
// Update AutoPay Orders to use Billing Agreement
|
45 |
-
$orders = Mage::getModel('sales/order')->getCollection();
|
46 |
-
$orders->getSelect()->join(
|
47 |
-
array('p' => $orders->getResource()->getTable('sales/order_payment')),
|
48 |
-
'p.parent_id = main_table.entity_id',
|
49 |
-
array()
|
50 |
-
);
|
51 |
-
$orders->addFieldToFilter('method', 'payex_autopay');
|
52 |
-
foreach ($orders as $order) {
|
53 |
-
/** @var Mage_Sales_Model_Order $order */
|
54 |
-
$customer_id = (int) $order->getCustomerId();
|
55 |
-
if ($customer_id > 0) {
|
56 |
-
$payexautopay_agreement_table = $resource->getTableName('payexautopay_agreement');
|
57 |
-
$agreement_ref = $readConnection->fetchOne("SELECT agreement_ref FROM {$payexautopay_agreement_table} WHERE customer_id = {$customer_id} LIMIT 1;");
|
58 |
|
|
|
59 |
/** @var Mage_Sales_Model_Billing_Agreement $billing_agreement */
|
60 |
$billing_agreement = Mage::getModel('sales/billing_agreement')->load($agreement_ref, 'reference_id');
|
61 |
if ($billing_agreement->getId()) {
|
62 |
-
|
63 |
-
|
64 |
-
$billing_agreement->getResource()->addOrderRelation($billing_agreement->getId(), $order->getId());
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
-
|
82 |
-
$
|
|
|
|
|
|
|
|
|
83 |
|
84 |
-
|
85 |
-
$quote = Mage::getModel('sales/quote')->setStore($order->getStore())->load($quoteId);
|
86 |
-
if ($quote) {
|
87 |
-
// Set Agreement Reference for Quote
|
88 |
try {
|
89 |
-
$
|
90 |
Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::TRANSPORT_BILLING_AGREEMENT_ID,
|
91 |
$billing_agreement->getId()
|
92 |
);
|
93 |
-
$
|
94 |
Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID,
|
95 |
$billing_agreement->getReferenceId()
|
96 |
);
|
97 |
-
$
|
98 |
} catch (Exception $e) {
|
99 |
continue;
|
100 |
}
|
101 |
-
}
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
109 |
);
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
}
|
116 |
}
|
12 |
// Convert Agreements to PayEx Billing Agreement
|
13 |
$default_label = Mage::helper('payex')->__('Untitled Credit Card');
|
14 |
$payexautopay_agreement_table = $resource->getTableName('payexautopay_agreement');
|
15 |
+
if ($writeConnection->isTableExists(trim($payexautopay_agreement_table, '`'))) {
|
16 |
+
$records = $readConnection->fetchAll("SELECT * FROM {$payexautopay_agreement_table};");
|
17 |
+
foreach ($records as $record) {
|
18 |
+
$customer_id = $record['customer_id'];
|
19 |
+
$agreement_ref = $record['agreement_ref'];
|
20 |
+
$created_at = $record['created_at'];
|
21 |
|
22 |
+
// Skip empty lines
|
23 |
+
if (empty($agreement_ref)) {
|
24 |
+
continue;
|
25 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
// Check Billing Agreement is already exists
|
28 |
/** @var Mage_Sales_Model_Billing_Agreement $billing_agreement */
|
29 |
$billing_agreement = Mage::getModel('sales/billing_agreement')->load($agreement_ref, 'reference_id');
|
30 |
if ($billing_agreement->getId()) {
|
31 |
+
continue;
|
32 |
+
}
|
|
|
33 |
|
34 |
+
// Create Billing Agreement
|
35 |
+
$billing_agreement = Mage::getModel('sales/billing_agreement');
|
36 |
+
$billing_agreement->setCustomerId($customer_id)
|
37 |
+
->setMethodCode(PayEx_Payments_Model_Payment_Agreement::METHOD_BILLING_AGREEMENT)
|
38 |
+
->setReferenceId($agreement_ref)
|
39 |
+
->setStatus(Mage_Sales_Model_Billing_Agreement::STATUS_ACTIVE)
|
40 |
+
->setCreatedAt($created_at)
|
41 |
+
->setAgreementLabel($default_label)
|
42 |
+
->save();
|
43 |
+
}
|
44 |
+
|
45 |
+
// Update AutoPay Orders to use Billing Agreement
|
46 |
+
$orders = Mage::getModel('sales/order')->getCollection();
|
47 |
+
$orders->getSelect()->join(
|
48 |
+
array('p' => $orders->getResource()->getTable('sales/order_payment')),
|
49 |
+
'p.parent_id = main_table.entity_id',
|
50 |
+
array()
|
51 |
+
);
|
52 |
+
$orders->addFieldToFilter('method', 'payex_autopay');
|
53 |
+
foreach ($orders as $order) {
|
54 |
+
/** @var Mage_Sales_Model_Order $order */
|
55 |
+
$customer_id = (int) $order->getCustomerId();
|
56 |
+
if ($customer_id > 0) {
|
57 |
+
$payexautopay_agreement_table = $resource->getTableName('payexautopay_agreement');
|
58 |
+
$agreement_ref = $readConnection->fetchOne("SELECT agreement_ref FROM {$payexautopay_agreement_table} WHERE customer_id = {$customer_id} LIMIT 1;");
|
59 |
|
60 |
+
/** @var Mage_Sales_Model_Billing_Agreement $billing_agreement */
|
61 |
+
$billing_agreement = Mage::getModel('sales/billing_agreement')->load($agreement_ref, 'reference_id');
|
62 |
+
if ($billing_agreement->getId()) {
|
63 |
+
// Add Order Relation
|
64 |
+
//$billing_agreement->addOrderRelation($order->getId())->save();
|
65 |
+
$billing_agreement->getResource()->addOrderRelation($billing_agreement->getId(), $order->getId());
|
66 |
|
67 |
+
// Set Agreement Reference
|
|
|
|
|
|
|
68 |
try {
|
69 |
+
$order->getPayment()->setAdditionalInformation(
|
70 |
Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::TRANSPORT_BILLING_AGREEMENT_ID,
|
71 |
$billing_agreement->getId()
|
72 |
);
|
73 |
+
$order->getPayment()->setAdditionalInformation(
|
74 |
Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID,
|
75 |
$billing_agreement->getReferenceId()
|
76 |
);
|
77 |
+
$order->getPayment()->save();
|
78 |
} catch (Exception $e) {
|
79 |
continue;
|
80 |
}
|
|
|
81 |
|
82 |
+
// Update Quote Payment
|
83 |
+
$quoteId = $order->getQuoteId();
|
84 |
+
|
85 |
+
/** @var Mage_Sales_Model_Quote $quote */
|
86 |
+
$quote = Mage::getModel('sales/quote')->setStore($order->getStore())->load($quoteId);
|
87 |
+
if ($quote) {
|
88 |
+
// Set Agreement Reference for Quote
|
89 |
+
try {
|
90 |
+
$quote->getPayment()->setAdditionalInformation(
|
91 |
+
Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::TRANSPORT_BILLING_AGREEMENT_ID,
|
92 |
+
$billing_agreement->getId()
|
93 |
);
|
94 |
+
$quote->getPayment()->setAdditionalInformation(
|
95 |
+
Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID,
|
96 |
+
$billing_agreement->getReferenceId()
|
97 |
+
);
|
98 |
+
$quote->getPayment()->save();
|
99 |
+
} catch (Exception $e) {
|
100 |
+
continue;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
// Try to set Agreement Label
|
105 |
+
if (in_array($billing_agreement->getAgreementLabel(), array('', $default_label))) {
|
106 |
+
if ($transactionId = $order->getPayment()->getLastTransId()) {
|
107 |
+
if ($transaction = $order->getPayment()->getTransaction($transactionId)) {
|
108 |
+
$transaction_data = $transaction->getAdditionalInformation(
|
109 |
+
Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS
|
110 |
+
);
|
111 |
+
if (is_array($transaction_data)) {
|
112 |
+
if (!empty($transaction_data['maskedNumber']) || $transaction_data['maskedCard']) {
|
113 |
+
$masked_number = Mage::helper('payex/order')->getFormattedCC($transaction_data);
|
114 |
+
$billing_agreement->setAgreementLabel($masked_number)->save();
|
115 |
+
}
|
116 |
}
|
117 |
}
|
118 |
}
|
@@ -3,7 +3,7 @@
|
|
3 |
<modules>
|
4 |
<PayEx_Payments>
|
5 |
<!-- declare module's version information for database updates -->
|
6 |
-
<version>3.1.
|
7 |
</PayEx_Payments>
|
8 |
</modules>
|
9 |
|
@@ -390,6 +390,23 @@
|
|
390 |
<checkoutinfo>1</checkoutinfo>
|
391 |
<discount_calc>advanced</discount_calc>
|
392 |
</payex_evc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
</payment>
|
394 |
|
395 |
<tax>
|
3 |
<modules>
|
4 |
<PayEx_Payments>
|
5 |
<!-- declare module's version information for database updates -->
|
6 |
+
<version>3.1.5</version>
|
7 |
</PayEx_Payments>
|
8 |
</modules>
|
9 |
|
390 |
<checkoutinfo>1</checkoutinfo>
|
391 |
<discount_calc>advanced</discount_calc>
|
392 |
</payex_evc>
|
393 |
+
|
394 |
+
<!-- 'newmodule' configuration group (fieldset) -->
|
395 |
+
<payex_mobilepay>
|
396 |
+
<active>0</active>
|
397 |
+
<model>payex/payment_mobilepay</model>
|
398 |
+
<title>MobilePay Online</title>
|
399 |
+
<allowspecific>0</allowspecific>
|
400 |
+
<debug>1</debug>
|
401 |
+
<accountnumber>payex account number</accountnumber>
|
402 |
+
<encryptionkey>payex encryption key</encryptionkey>
|
403 |
+
<transactiontype>1</transactiontype>
|
404 |
+
<order_status_authorize>processing</order_status_authorize>
|
405 |
+
<order_status_capture>complete</order_status_capture>
|
406 |
+
<clientlanguage>en-US</clientlanguage>
|
407 |
+
<cleantime>20</cleantime>
|
408 |
+
<discount_calc>advanced</discount_calc>
|
409 |
+
</payex_mobilepay>
|
410 |
</payment>
|
411 |
|
412 |
<tax>
|
@@ -1819,6 +1819,152 @@
|
|
1819 |
</discount_calc>
|
1820 |
</fields>
|
1821 |
</payex_evc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1822 |
</groups>
|
1823 |
</payment>
|
1824 |
|
1819 |
</discount_calc>
|
1820 |
</fields>
|
1821 |
</payex_evc>
|
1822 |
+
|
1823 |
+
<!-- newmodule fieldset -->
|
1824 |
+
<payex_mobilepay translate="label" module="payex">
|
1825 |
+
<!-- will have title 'New Module' -->
|
1826 |
+
<label>MobilePay Online (via PayEx)</label>
|
1827 |
+
<!-- position between other payment methods -->
|
1828 |
+
<sort_order>621</sort_order>
|
1829 |
+
<!-- do not show this configuration options in store scope -->
|
1830 |
+
<show_in_default>1</show_in_default>
|
1831 |
+
<show_in_website>1</show_in_website>
|
1832 |
+
<show_in_store>1</show_in_store>
|
1833 |
+
<comment><![CDATA[This payment module provide <a href="https://www.mobilepay.dk/" target="_blank">MobilePay Online</a>.]]></comment>
|
1834 |
+
<fields>
|
1835 |
+
<!-- is this payment method active for the website? -->
|
1836 |
+
<active translate="label">
|
1837 |
+
<!-- label for the field -->
|
1838 |
+
<label>Enabled</label>
|
1839 |
+
<!-- input type for configuration value -->
|
1840 |
+
<frontend_type>select</frontend_type>
|
1841 |
+
<!-- model to take the option values from -->
|
1842 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1843 |
+
<!-- field position -->
|
1844 |
+
<sort_order>1</sort_order>
|
1845 |
+
<!-- do not show this field in store scope -->
|
1846 |
+
<show_in_default>1</show_in_default>
|
1847 |
+
<show_in_website>1</show_in_website>
|
1848 |
+
<show_in_store>1</show_in_store>
|
1849 |
+
</active>
|
1850 |
+
|
1851 |
+
<title translate="label">
|
1852 |
+
<label>Title</label>
|
1853 |
+
<frontend_type>text</frontend_type>
|
1854 |
+
<sort_order>2</sort_order>
|
1855 |
+
<show_in_default>1</show_in_default>
|
1856 |
+
<show_in_website>1</show_in_website>
|
1857 |
+
<show_in_store>1</show_in_store>
|
1858 |
+
</title>
|
1859 |
+
|
1860 |
+
<allowspecific translate="label">
|
1861 |
+
<label>Payment to applicable countries</label>
|
1862 |
+
<frontend_type>allowspecific</frontend_type>
|
1863 |
+
<sort_order>3</sort_order>
|
1864 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
1865 |
+
<show_in_default>1</show_in_default>
|
1866 |
+
<show_in_website>1</show_in_website>
|
1867 |
+
<show_in_store>1</show_in_store>
|
1868 |
+
</allowspecific>
|
1869 |
+
|
1870 |
+
<specificcountry translate="label">
|
1871 |
+
<label>Payment to Specific countries</label>
|
1872 |
+
<frontend_type>multiselect</frontend_type>
|
1873 |
+
<sort_order>4</sort_order>
|
1874 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
1875 |
+
<show_in_default>1</show_in_default>
|
1876 |
+
<show_in_website>1</show_in_website>
|
1877 |
+
<show_in_store>1</show_in_store>
|
1878 |
+
</specificcountry>
|
1879 |
+
|
1880 |
+
<debug translate="label">
|
1881 |
+
<label>Enable test mode</label>
|
1882 |
+
<frontend_type>select</frontend_type>
|
1883 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1884 |
+
<sort_order>5</sort_order>
|
1885 |
+
<show_in_default>1</show_in_default>
|
1886 |
+
<show_in_website>1</show_in_website>
|
1887 |
+
<show_in_store>1</show_in_store>
|
1888 |
+
</debug>
|
1889 |
+
|
1890 |
+
<accountnumber>
|
1891 |
+
<label>Account Number</label>
|
1892 |
+
<frontend_type>text</frontend_type>
|
1893 |
+
<sort_order>6</sort_order>
|
1894 |
+
<show_in_default>1</show_in_default>
|
1895 |
+
<show_in_website>1</show_in_website>
|
1896 |
+
<show_in_store>1</show_in_store>
|
1897 |
+
</accountnumber>
|
1898 |
+
|
1899 |
+
<encryptionkey>
|
1900 |
+
<label>Encryption Key</label>
|
1901 |
+
<frontend_type>text</frontend_type>
|
1902 |
+
<sort_order>7</sort_order>
|
1903 |
+
<show_in_default>1</show_in_default>
|
1904 |
+
<show_in_website>1</show_in_website>
|
1905 |
+
<show_in_store>1</show_in_store>
|
1906 |
+
</encryptionkey>
|
1907 |
+
|
1908 |
+
<transactiontype translate="label">
|
1909 |
+
<label>Transaction Type</label>
|
1910 |
+
<frontend_type>select</frontend_type>
|
1911 |
+
<source_model>payex/source_paymentAction</source_model>
|
1912 |
+
<sort_order>8</sort_order>
|
1913 |
+
<show_in_default>1</show_in_default>
|
1914 |
+
<show_in_website>1</show_in_website>
|
1915 |
+
<show_in_store>1</show_in_store>
|
1916 |
+
</transactiontype>
|
1917 |
+
|
1918 |
+
<order_status_authorize translate="label">
|
1919 |
+
<label>Order status (for authorize)</label>
|
1920 |
+
<frontend_type>select</frontend_type>
|
1921 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
1922 |
+
<sort_order>9</sort_order>
|
1923 |
+
<show_in_default>1</show_in_default>
|
1924 |
+
<show_in_website>1</show_in_website>
|
1925 |
+
<show_in_store>1</show_in_store>
|
1926 |
+
</order_status_authorize>
|
1927 |
+
|
1928 |
+
<order_status_capture translate="label">
|
1929 |
+
<label>Order status (for capture)</label>
|
1930 |
+
<frontend_type>select</frontend_type>
|
1931 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
1932 |
+
<sort_order>10</sort_order>
|
1933 |
+
<show_in_default>1</show_in_default>
|
1934 |
+
<show_in_website>1</show_in_website>
|
1935 |
+
<show_in_store>1</show_in_store>
|
1936 |
+
</order_status_capture>
|
1937 |
+
|
1938 |
+
<clientlanguage translate="label">
|
1939 |
+
<label>Client language</label>
|
1940 |
+
<frontend_type>select</frontend_type>
|
1941 |
+
<source_model>payex/source_clientLanguage</source_model>
|
1942 |
+
<sort_order>11</sort_order>
|
1943 |
+
<show_in_default>1</show_in_default>
|
1944 |
+
<show_in_website>1</show_in_website>
|
1945 |
+
<show_in_store>1</show_in_store>
|
1946 |
+
</clientlanguage>
|
1947 |
+
|
1948 |
+
<cleantime translate="label">
|
1949 |
+
<label>Time to clean pending orders (0 - disabled)</label>
|
1950 |
+
<frontend_type>text</frontend_type>
|
1951 |
+
<sort_order>12</sort_order>
|
1952 |
+
<show_in_default>1</show_in_default>
|
1953 |
+
<show_in_website>1</show_in_website>
|
1954 |
+
<show_in_store>1</show_in_store>
|
1955 |
+
</cleantime>
|
1956 |
+
|
1957 |
+
<discount_calc translate="label">
|
1958 |
+
<label>Discount Calculation</label>
|
1959 |
+
<frontend_type>select</frontend_type>
|
1960 |
+
<source_model>payex/source_discountCalculation</source_model>
|
1961 |
+
<sort_order>13</sort_order>
|
1962 |
+
<show_in_default>1</show_in_default>
|
1963 |
+
<show_in_website>1</show_in_website>
|
1964 |
+
<show_in_store>1</show_in_store>
|
1965 |
+
</discount_calc>
|
1966 |
+
</fields>
|
1967 |
+
</payex_mobilepay>
|
1968 |
</groups>
|
1969 |
</payment>
|
1970 |
|
@@ -23,7 +23,8 @@ $eav->addAttribute('order', 'base_payex_payment_fee', array('type' => 'decimal')
|
|
23 |
$eav->addAttribute('order', 'base_payex_payment_fee_tax', array('type' => 'decimal'));
|
24 |
|
25 |
// Install Agreement table
|
26 |
-
$installer->run(
|
|
|
27 |
CREATE TABLE IF NOT EXISTS `{$this->getTable('payexautopay_agreement')}` (
|
28 |
`agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Agreement Reference',
|
29 |
`customer_id` int(10) NOT NULL COMMENT 'Customer Id',
|
@@ -33,6 +34,7 @@ CREATE TABLE IF NOT EXISTS `{$this->getTable('payexautopay_agreement')}` (
|
|
33 |
UNIQUE KEY `agreement_ref` (`agreement_ref`),
|
34 |
UNIQUE KEY `customer_id` (`customer_id`)
|
35 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Payex Autopay: Agreements';
|
36 |
-
"
|
|
|
37 |
|
38 |
$this->endSetup();
|
23 |
$eav->addAttribute('order', 'base_payex_payment_fee_tax', array('type' => 'decimal'));
|
24 |
|
25 |
// Install Agreement table
|
26 |
+
$installer->run(
|
27 |
+
"
|
28 |
CREATE TABLE IF NOT EXISTS `{$this->getTable('payexautopay_agreement')}` (
|
29 |
`agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Agreement Reference',
|
30 |
`customer_id` int(10) NOT NULL COMMENT 'Customer Id',
|
34 |
UNIQUE KEY `agreement_ref` (`agreement_ref`),
|
35 |
UNIQUE KEY `customer_id` (`customer_id`)
|
36 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Payex Autopay: Agreements';
|
37 |
+
"
|
38 |
+
);
|
39 |
|
40 |
$this->endSetup();
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this PayEx_Payments_Block_Form_Mobilepay */
|
3 |
+
?>
|
4 |
+
|
5 |
+
<fieldset class="form-list">
|
6 |
+
<?php $_code=$this->getMethodCode() ?>
|
7 |
+
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
8 |
+
<li>
|
9 |
+
<div style="float:left">
|
10 |
+
<img src="<?php echo Mage::getDesign()->getSkinUrl('images/payex/mobilepay_online.png'); ?>" alt="MobilePay Online" /><br />
|
11 |
+
</div>
|
12 |
+
<div style="float:left">
|
13 |
+
<?php echo Mage::helper('payex')->__('You will be redirected to <a target="_blank" href="http://www.payex.com">PayEx</a> website when you place an order.'); ?>
|
14 |
+
</div>
|
15 |
+
<div class="clearfix"> </div>
|
16 |
+
</li>
|
17 |
+
</ul>
|
18 |
+
</fieldset>
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this PayEx_Payments_Block_Info_Mobilepay */
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
|
6 |
+
<?php $trans_id = $this->getInfo()->getLastTransId(); ?>
|
7 |
+
<?php if (!empty($trans_id)): ?>
|
8 |
+
<?php $specific = $this->getSpecificInformation(); ?>
|
9 |
+
<?php if (count($specific) > 0): ?>
|
10 |
+
<?php unset($specific['Authenticated Status']); ?>
|
11 |
+
<?php unset($specific['Transaction Ref']); ?>
|
12 |
+
<?php unset($specific['PayEx Transaction Status']); ?>
|
13 |
+
<?php foreach($specific as $key => $value): ?>
|
14 |
+
<?php echo Mage::helper('payex')->__($key) . ': ' . $this->htmlEscape($value); ?><br />
|
15 |
+
<?php endforeach; ?>
|
16 |
+
<?php endif; ?>
|
17 |
+
<?php else: ?>
|
18 |
+
<?php echo Mage::helper('paygate')->__('Payment has not been processed yet.'); ?>
|
19 |
+
<?php endif; ?>
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}}
|
2 |
+
<?php $trans_id = $this->getInfo()->getLastTransId(); ?>
|
3 |
+
<?php if (!empty($trans_id)): ?>
|
4 |
+
<?php $specific = $this->getSpecificInformation(); ?>
|
5 |
+
<?php if (count($specific) > 0): ?>
|
6 |
+
<?php unset($specific['Authenticated Status']); ?>
|
7 |
+
<?php unset($specific['Transaction Ref']); ?>
|
8 |
+
<?php unset($specific['PayEx Transaction Status']); ?>
|
9 |
+
<?php foreach($specific as $key => $value): ?>
|
10 |
+
<?php echo Mage::helper('payex')->__($key) . ': ' . $value; ?>
|
11 |
+
{{pdf_row_separator}}
|
12 |
+
<?php endforeach; ?>
|
13 |
+
<?php endif; ?>
|
14 |
+
<?php else: ?>
|
15 |
+
<?php echo Mage::helper('paygate')->__('Payment has not been processed yet.'); ?>
|
16 |
+
<?php endif; ?>
|
@@ -0,0 +1 @@
|
|
|
1 |
+
<p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this PayEx_Payments_Block_Form_Mobilepay */
|
3 |
+
?>
|
4 |
+
|
5 |
+
<fieldset class="form-list">
|
6 |
+
<?php $_code=$this->getMethodCode() ?>
|
7 |
+
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
8 |
+
<li>
|
9 |
+
<div style="float:left">
|
10 |
+
<img src="<?php echo Mage::getDesign()->getSkinUrl('images/payex/mobilepay_online.png'); ?>" alt="MobilePay Online" /><br />
|
11 |
+
</div>
|
12 |
+
<div style="float:left">
|
13 |
+
<?php echo Mage::helper('payex')->__('You will be redirected to <a target="_blank" href="http://www.payex.com">PayEx</a> website when you place an order.'); ?>
|
14 |
+
</div>
|
15 |
+
<div class="clearfix"> </div>
|
16 |
+
</li>
|
17 |
+
</ul>
|
18 |
+
</fieldset>
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this PayEx_Payments_Block_Info_Mobilepay */
|
3 |
+
?>
|
4 |
+
|
5 |
+
<p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
|
6 |
+
<?php $trans_id = $this->getInfo()->getLastTransId(); ?>
|
7 |
+
<?php if (!empty($trans_id)): ?>
|
8 |
+
<?php $specific = $this->getSpecificInformation(); ?>
|
9 |
+
<?php if (count($specific) > 0): ?>
|
10 |
+
<?php unset($specific['Authenticated Status']); ?>
|
11 |
+
<?php unset($specific['Transaction Ref']); ?>
|
12 |
+
<?php unset($specific['PayEx Transaction Status']); ?>
|
13 |
+
<?php foreach($specific as $key => $value): ?>
|
14 |
+
<?php echo Mage::helper('payex')->__($key) . ': ' . $this->htmlEscape($value); ?><br />
|
15 |
+
<?php endforeach; ?>
|
16 |
+
<?php endif; ?>
|
17 |
+
<?php else: ?>
|
18 |
+
<?php echo Mage::helper('paygate')->__('Payment has not been processed yet.'); ?>
|
19 |
+
<?php endif; ?>
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php echo $this->escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}}
|
2 |
+
<?php $trans_id = $this->getInfo()->getLastTransId(); ?>
|
3 |
+
<?php if (!empty($trans_id)): ?>
|
4 |
+
<?php $specific = $this->getSpecificInformation(); ?>
|
5 |
+
<?php if (count($specific) > 0): ?>
|
6 |
+
<?php unset($specific['Authenticated Status']); ?>
|
7 |
+
<?php unset($specific['Transaction Ref']); ?>
|
8 |
+
<?php unset($specific['PayEx Transaction Status']); ?>
|
9 |
+
<?php foreach($specific as $key => $value): ?>
|
10 |
+
<?php echo Mage::helper('payex')->__($key) . ': ' . $value; ?>
|
11 |
+
{{pdf_row_separator}}
|
12 |
+
<?php endforeach; ?>
|
13 |
+
<?php endif; ?>
|
14 |
+
<?php else: ?>
|
15 |
+
<?php echo Mage::helper('paygate')->__('Payment has not been processed yet.'); ?>
|
16 |
+
<?php endif; ?>
|
@@ -0,0 +1 @@
|
|
|
1 |
+
<p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
|
@@ -10,7 +10,7 @@
|
|
10 |
<Mage_Payment />
|
11 |
</depends>
|
12 |
<!-- declare module's version information for database updates -->
|
13 |
-
<version>3.1.
|
14 |
</PayEx_Payments>
|
15 |
</modules>
|
16 |
</config>
|
10 |
<Mage_Payment />
|
11 |
</depends>
|
12 |
<!-- declare module's version information for database updates -->
|
13 |
+
<version>3.1.5</version>
|
14 |
</PayEx_Payments>
|
15 |
</modules>
|
16 |
</config>
|
@@ -1,3 +1,4 @@
|
|
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
$(document).on('click', '#ssn_click', function(e) {
|
3 |
if ($(this).hasClass('disabled')) {
|
1 |
+
// @codingStandardsIgnoreFile
|
2 |
jQuery(document).ready(function($) {
|
3 |
$(document).on('click', '#ssn_click', function(e) {
|
4 |
if ($(this).hasClass('disabled')) {
|
@@ -1,3 +1,4 @@
|
|
|
|
1 |
function fireEvent(element, event) {
|
2 |
if (document.createEventObject) {
|
3 |
// dispatch for IE
|
1 |
+
// @codingStandardsIgnoreFile
|
2 |
function fireEvent(element, event) {
|
3 |
if (document.createEventObject) {
|
4 |
// dispatch for IE
|
@@ -1,47 +1,47 @@
|
|
1 |
-
PHP-Name-Parser
|
2 |
-
===============
|
3 |
-
|
4 |
-
PHP library to split names into their respective components. Besides detecting first and last names, this library attempts to handle prefixes, suffixes, initials and compound last names like "Von Fange". It also normalizes prefixes (Mister -> Mr.) and fixes capitalization (JOHN SMITH -> John Smith).
|
5 |
-
|
6 |
-
**Usage:**
|
7 |
-
|
8 |
-
include("parser.php");
|
9 |
-
|
10 |
-
$parser = new FullNameParser();
|
11 |
-
$parser->parse_name("Mr Anthony R Von Fange III");
|
12 |
-
|
13 |
-
**Results:**
|
14 |
-
|
15 |
-
Array (
|
16 |
-
[nickname] =>
|
17 |
-
[salutation] => Mr.
|
18 |
-
[fname] => Anthony
|
19 |
-
[initials] => R
|
20 |
-
[lname] => Von Fange
|
21 |
-
[suffix] => III
|
22 |
-
)
|
23 |
-
|
24 |
-
**The algorithm:**
|
25 |
-
|
26 |
-
We start by splitting the full name into separate words. We then do a dictionary lookup on the first and last words to see if they are a common prefix or suffix. Next, we take the middle portion of the string (everything minus the prefix & suffix) and look at everything except the last word of that string. We then loop through each of those words concatenating them together to make up the first name. While we’re doing that, we watch for any indication of a compound last name. It turns out that almost every compound last name starts with 1 of 16 prefixes (Von, Van, Vere, etc). If we see one of those prefixes, we break out of the first name loop and move on to concatenating the last name. We handle the capitalization issue by checking for camel-case before uppercasing the first letter of each word and lowercasing everything else. I wrote special cases for periods and dashes. We also have a couple other special cases, like ignoring words in parentheses all-together.
|
27 |
-
|
28 |
-
Check examples.php for the test suite and examples of how various name formats are parsed.
|
29 |
-
|
30 |
-
**To-do**
|
31 |
-
|
32 |
-
* Handle the "Lname, Fname" format
|
33 |
-
* Support non-English names (handle unicode characters & better understand global naming rules)
|
34 |
-
* Separate the parsing of the name from the normalization & capitalization & make those optional.
|
35 |
-
* Add common name libraries to allow for things like gender detection
|
36 |
-
|
37 |
-
**Same logic, different languages**
|
38 |
-
|
39 |
-
* [Name Parser in Java](https://github.com/gkhays/NameParser)
|
40 |
-
* [Name Parser in JavaScript](https://github.com/joshfraser/JavaScript-Name-Parser)
|
41 |
-
|
42 |
-
**Credits & license:**
|
43 |
-
|
44 |
-
* Read more about the inspiration for this [PHP Name Parser](http://www.onlineaspect.com/2009/08/17/splitting-names/) library by [Josh Fraser](http://joshfraser.com)
|
45 |
-
* Special thanks to [Josh Jones](https://github.com/UberNerdBoy), [Timothy Wood](https://github.com/codearachnid), [Michael Waskosky](https://github.com/waskosky), [Eric Celeste](https://github.com/efc)
|
46 |
-
* Released under Apache 2.0 license
|
47 |
-
|
1 |
+
PHP-Name-Parser
|
2 |
+
===============
|
3 |
+
|
4 |
+
PHP library to split names into their respective components. Besides detecting first and last names, this library attempts to handle prefixes, suffixes, initials and compound last names like "Von Fange". It also normalizes prefixes (Mister -> Mr.) and fixes capitalization (JOHN SMITH -> John Smith).
|
5 |
+
|
6 |
+
**Usage:**
|
7 |
+
|
8 |
+
include("parser.php");
|
9 |
+
|
10 |
+
$parser = new FullNameParser();
|
11 |
+
$parser->parse_name("Mr Anthony R Von Fange III");
|
12 |
+
|
13 |
+
**Results:**
|
14 |
+
|
15 |
+
Array (
|
16 |
+
[nickname] =>
|
17 |
+
[salutation] => Mr.
|
18 |
+
[fname] => Anthony
|
19 |
+
[initials] => R
|
20 |
+
[lname] => Von Fange
|
21 |
+
[suffix] => III
|
22 |
+
)
|
23 |
+
|
24 |
+
**The algorithm:**
|
25 |
+
|
26 |
+
We start by splitting the full name into separate words. We then do a dictionary lookup on the first and last words to see if they are a common prefix or suffix. Next, we take the middle portion of the string (everything minus the prefix & suffix) and look at everything except the last word of that string. We then loop through each of those words concatenating them together to make up the first name. While we’re doing that, we watch for any indication of a compound last name. It turns out that almost every compound last name starts with 1 of 16 prefixes (Von, Van, Vere, etc). If we see one of those prefixes, we break out of the first name loop and move on to concatenating the last name. We handle the capitalization issue by checking for camel-case before uppercasing the first letter of each word and lowercasing everything else. I wrote special cases for periods and dashes. We also have a couple other special cases, like ignoring words in parentheses all-together.
|
27 |
+
|
28 |
+
Check examples.php for the test suite and examples of how various name formats are parsed.
|
29 |
+
|
30 |
+
**To-do**
|
31 |
+
|
32 |
+
* Handle the "Lname, Fname" format
|
33 |
+
* Support non-English names (handle unicode characters & better understand global naming rules)
|
34 |
+
* Separate the parsing of the name from the normalization & capitalization & make those optional.
|
35 |
+
* Add common name libraries to allow for things like gender detection
|
36 |
+
|
37 |
+
**Same logic, different languages**
|
38 |
+
|
39 |
+
* [Name Parser in Java](https://github.com/gkhays/NameParser)
|
40 |
+
* [Name Parser in JavaScript](https://github.com/joshfraser/JavaScript-Name-Parser)
|
41 |
+
|
42 |
+
**Credits & license:**
|
43 |
+
|
44 |
+
* Read more about the inspiration for this [PHP Name Parser](http://www.onlineaspect.com/2009/08/17/splitting-names/) library by [Josh Fraser](http://joshfraser.com)
|
45 |
+
* Special thanks to [Josh Jones](https://github.com/UberNerdBoy), [Timothy Wood](https://github.com/codearachnid), [Michael Waskosky](https://github.com/waskosky), [Eric Celeste](https://github.com/efc), [Josh Houghtelin](https://github.com/jhoughtelin) and [monitaure](https://www.github.com/monitaure) for their contributions. Pull requests are always welcome as long as you don't break the test suite.
|
46 |
+
* Released under Apache 2.0 license
|
47 |
+
|
@@ -1,283 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once('parser.php');
|
4 |
-
|
5 |
-
// examples & a poor mans test suite
|
6 |
-
// intentionally shows examples that fail
|
7 |
-
|
8 |
-
$names = array(
|
9 |
-
"Mr Anthony R Von Fange III" => array("salutation" => "Mr.",
|
10 |
-
"fname" => "Anthony",
|
11 |
-
"initials" => "R",
|
12 |
-
"lname" => "Von Fange",
|
13 |
-
"suffix" => "III"),
|
14 |
-
"J. B. Hunt" => array("salutation" => "",
|
15 |
-
"fname" => "J.",
|
16 |
-
"initials" => "B.",
|
17 |
-
"lname" => "Hunt",
|
18 |
-
"suffix" => ""),
|
19 |
-
"J.B. Hunt" => array("salutation" => "",
|
20 |
-
"fname" => "J.B.",
|
21 |
-
"initials" => "",
|
22 |
-
"lname" => "Hunt",
|
23 |
-
"suffix" => ""),
|
24 |
-
"Edward Senior III" => array("salutation" => "",
|
25 |
-
"fname" => "Edward",
|
26 |
-
"initials" => "",
|
27 |
-
"lname" => "Senior",
|
28 |
-
"suffix" => "III"),
|
29 |
-
"Edward Dale Senior II" => array("salutation" => "",
|
30 |
-
"fname" => "Edward Dale",
|
31 |
-
"initials" => "",
|
32 |
-
"lname" => "Senior",
|
33 |
-
"suffix" => "II"),
|
34 |
-
"Dale Edward Jones Senior" => array("salutation" => "",
|
35 |
-
"fname" => "Dale Edward",
|
36 |
-
"initials" => "",
|
37 |
-
"lname" => "Jones",
|
38 |
-
"suffix" => "Senior"),
|
39 |
-
"Edward Senior II" => array("salutation" => "",
|
40 |
-
"fname" => "Edward",
|
41 |
-
"initials" => "",
|
42 |
-
"lname" => "Senior",
|
43 |
-
"suffix" => "II"),
|
44 |
-
"Dale Edward Senior II, PhD" => array("salutation" => "",
|
45 |
-
"fname" => "Dale Edward",
|
46 |
-
"initials" => "",
|
47 |
-
"lname" => "Senior",
|
48 |
-
"suffix" => "II, PhD"),
|
49 |
-
"Jason Rodriguez Sr." => array("salutation" => "",
|
50 |
-
"fname" => "Jason",
|
51 |
-
"initials" => "",
|
52 |
-
"lname" => "Rodriguez",
|
53 |
-
"suffix" => "Sr"),
|
54 |
-
"Jason Senior" => array("salutation" => "",
|
55 |
-
"fname" => "Jason",
|
56 |
-
"initials" => "",
|
57 |
-
"lname" => "Senior",
|
58 |
-
"suffix" => ""),
|
59 |
-
"Bill Junior" => array("salutation" => "",
|
60 |
-
"fname" => "Bill",
|
61 |
-
"initials" => "",
|
62 |
-
"lname" => "Junior",
|
63 |
-
"suffix" => ""),
|
64 |
-
"Sara Ann Fraser" => array("salutation" => "",
|
65 |
-
"fname" => "Sara Ann",
|
66 |
-
"initials" => "",
|
67 |
-
"lname" => "Fraser",
|
68 |
-
"suffix" => ""),
|
69 |
-
"Adam" => array("salutation" => "",
|
70 |
-
"fname" => "Adam",
|
71 |
-
"initials" => "",
|
72 |
-
"lname" => "",
|
73 |
-
"suffix" => ""),
|
74 |
-
"OLD MACDONALD" => array("salutation" => "",
|
75 |
-
"fname" => "Old",
|
76 |
-
"initials" => "",
|
77 |
-
"lname" => "Macdonald",
|
78 |
-
"suffix" => ""),
|
79 |
-
"Old MacDonald" => array("salutation" => "",
|
80 |
-
"fname" => "Old",
|
81 |
-
"initials" => "",
|
82 |
-
"lname" => "MacDonald",
|
83 |
-
"suffix" => ""),
|
84 |
-
"Old McDonald" => array("salutation" => "",
|
85 |
-
"fname" => "Old",
|
86 |
-
"initials" => "",
|
87 |
-
"lname" => "McDonald",
|
88 |
-
"suffix" => ""),
|
89 |
-
"Old Mc Donald" => array("salutation" => "",
|
90 |
-
"fname" => "Old Mc",
|
91 |
-
"initials" => "",
|
92 |
-
"lname" => "Donald",
|
93 |
-
"suffix" => ""),
|
94 |
-
"Old Mac Donald" => array("salutation" => "",
|
95 |
-
"fname" => "Old Mac",
|
96 |
-
"initials" => "",
|
97 |
-
"lname" => "Donald",
|
98 |
-
"suffix" => ""),
|
99 |
-
"James van Allen" => array("salutation" => "",
|
100 |
-
"fname" => "James",
|
101 |
-
"initials" => "",
|
102 |
-
"lname" => "Van Allen",
|
103 |
-
"suffix" => ""),
|
104 |
-
"Jimmy (Bubba) Smith" => array("nickname" => "Bubba",
|
105 |
-
"salutation" => "",
|
106 |
-
"fname" => "Jimmy",
|
107 |
-
"initials" => "",
|
108 |
-
"lname" => "Smith",
|
109 |
-
"suffix" => ""),
|
110 |
-
"Miss Jennifer Shrader Lawrence" => array("salutation" => "Ms.",
|
111 |
-
"fname" => "Jennifer Shrader",
|
112 |
-
"initials" => "",
|
113 |
-
"lname" => "Lawrence",
|
114 |
-
"suffix" => ""),
|
115 |
-
"Jonathan Smith, MD" => array("salutation" => "",
|
116 |
-
"fname" => "Jonathan",
|
117 |
-
"initials" => "",
|
118 |
-
"lname" => "Smith",
|
119 |
-
"suffix" => "MD"),
|
120 |
-
"Dr. Jonathan Smith" => array("salutation" => "Dr.",
|
121 |
-
"fname" => "Jonathan",
|
122 |
-
"initials" => "",
|
123 |
-
"lname" => "Smith",
|
124 |
-
"suffix" => ""),
|
125 |
-
"Jonathan Smith IV, PhD" => array("salutation" => "",
|
126 |
-
"fname" => "Jonathan",
|
127 |
-
"initials" => "",
|
128 |
-
"lname" => "Smith",
|
129 |
-
"suffix" => "IV, PhD"),
|
130 |
-
"Miss Jamie P. Harrowitz" => array("salutation" => "Ms.",
|
131 |
-
"fname" => "Jamie",
|
132 |
-
"initials" => "P.",
|
133 |
-
"lname" => "Harrowitz",
|
134 |
-
"suffix" => ""),
|
135 |
-
"Mr John Doe" => array("salutation" => "Mr.",
|
136 |
-
"fname" => "John",
|
137 |
-
"initials" => "",
|
138 |
-
"lname" => "Doe",
|
139 |
-
"suffix" => ""),
|
140 |
-
"Rev. Dr John Doe" => array("salutation" => "Rev. Dr.",
|
141 |
-
"fname" => "John",
|
142 |
-
"initials" => "",
|
143 |
-
"lname" => "Doe",
|
144 |
-
"suffix" => ""),
|
145 |
-
"Anthony Von Fange III" => array("salutation" => "",
|
146 |
-
"fname" => "Anthony",
|
147 |
-
"initials" => "",
|
148 |
-
"lname" => "Von Fange",
|
149 |
-
"suffix" => "III"),
|
150 |
-
"Anthony Von Fange III, PhD" => array("salutation" => "",
|
151 |
-
"fname" => "Anthony",
|
152 |
-
"initials" => "",
|
153 |
-
"lname" => "Von Fange",
|
154 |
-
"suffix" => "III, PhD"),
|
155 |
-
"Smarty Pants Phd" => array("salutation" => "",
|
156 |
-
"fname" => "Smarty",
|
157 |
-
"initials" => "",
|
158 |
-
"lname" => "Pants",
|
159 |
-
"suffix" => "PhD"),
|
160 |
-
"Mark Peter Williams" => array("salutation" => "",
|
161 |
-
"fname" => "Mark Peter",
|
162 |
-
"initials" => "",
|
163 |
-
"lname" => "Williams",
|
164 |
-
"suffix" => ""),
|
165 |
-
"Mark P Williams" => array("salutation" => "",
|
166 |
-
"fname" => "Mark",
|
167 |
-
"initials" => "P",
|
168 |
-
"lname" => "Williams",
|
169 |
-
"suffix" => ""),
|
170 |
-
"Mark P. Williams" => array("salutation" => "",
|
171 |
-
"fname" => "Mark",
|
172 |
-
"initials" => "P.",
|
173 |
-
"lname" => "Williams",
|
174 |
-
"suffix" => ""),
|
175 |
-
"M Peter Williams" => array("salutation" => "",
|
176 |
-
"fname" => "Peter",
|
177 |
-
"initials" => "M",
|
178 |
-
"lname" => "Williams",
|
179 |
-
"suffix" => ""),
|
180 |
-
"M. Peter Williams" => array("salutation" => "",
|
181 |
-
"fname" => "Peter",
|
182 |
-
"initials" => "M.",
|
183 |
-
"lname" => "Williams",
|
184 |
-
"suffix" => ""),
|
185 |
-
"M. P. Williams" => array("salutation" => "",
|
186 |
-
"fname" => "M.",
|
187 |
-
"initials" => "P.",
|
188 |
-
"lname" => "Williams",
|
189 |
-
"suffix" => ""),
|
190 |
-
"The Rev. Mark Williams" => array("salutation" => "Rev.",
|
191 |
-
"fname" => "Mark",
|
192 |
-
"initials" => "",
|
193 |
-
"lname" => "Williams",
|
194 |
-
"suffix" => ""),
|
195 |
-
"Mister Mark Williams" => array("salutation" => "Mr.",
|
196 |
-
"fname" => "Mark",
|
197 |
-
"initials" => "",
|
198 |
-
"lname" => "Williams",
|
199 |
-
"suffix" => ""),
|
200 |
-
// fails. format not yet supported
|
201 |
-
"Fraser, Joshua" => array("salutation" => "",
|
202 |
-
"fname" => "Joshua",
|
203 |
-
"initials" => "",
|
204 |
-
"lname" => "Fraser",
|
205 |
-
"suffix" => ""),
|
206 |
-
// fails. both initials should be capitalized
|
207 |
-
"JB Hunt" => array("salutation" => "",
|
208 |
-
"fname" => "JB",
|
209 |
-
"initials" => "",
|
210 |
-
"lname" => "Hunt",
|
211 |
-
"suffix" => ""),
|
212 |
-
// fails. doesn't handle multiple words inside parenthesis
|
213 |
-
"Jimmy (Bubba Junior) Smith" => array("nickname" => "Bubba Junior",
|
214 |
-
"salutation" => "",
|
215 |
-
"fname" => "Jimmy",
|
216 |
-
"initials" => "",
|
217 |
-
"lname" => "Smith",
|
218 |
-
"suffix" => ""),
|
219 |
-
// fails. should normalize the PhD suffix
|
220 |
-
"Anthony Von Fange III, PHD" => array("salutation" => "",
|
221 |
-
"fname" => "Anthony",
|
222 |
-
"initials" => "",
|
223 |
-
"lname" => "Von Fange",
|
224 |
-
"suffix" => "III, PhD"),
|
225 |
-
// fails. should treat "Silly" as the nickname or remove altogether
|
226 |
-
"Not So Smarty Pants, Silly" => array("nickname" => "Silly",
|
227 |
-
"salutation" => "",
|
228 |
-
"fname" => "Not So Smarty",
|
229 |
-
"initials" => "",
|
230 |
-
"lname" => "Pants",
|
231 |
-
"suffix" => ""),
|
232 |
-
"Rev Al Sharpton" => array("salutation" => "Rev.",
|
233 |
-
"fname" => "Al",
|
234 |
-
"initials" => "",
|
235 |
-
"lname" => "Sharpton",
|
236 |
-
"suffix" => ""),
|
237 |
-
"Dr Ty P. Bennington iIi" => array("salutation" => "Dr.",
|
238 |
-
"fname" => "Ty",
|
239 |
-
"initials" => "P.",
|
240 |
-
"lname" => "Bennington",
|
241 |
-
"suffix" => "III"),
|
242 |
-
);
|
243 |
-
|
244 |
-
|
245 |
-
$parser = new FullNameParser();
|
246 |
-
|
247 |
-
$headers = array("salutation","fname","initials","lname","suffix","nickname");
|
248 |
-
?>
|
249 |
-
<!DOCTYPE html>
|
250 |
-
<html lang="en-US">
|
251 |
-
<head>
|
252 |
-
<meta charset="UTF-8">
|
253 |
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
254 |
-
<title>PHP Name Parser | Unit Tests</title>
|
255 |
-
<link rel="stylesheet" href="./tests/style.css" type="text/css" media="all">
|
256 |
-
</head>
|
257 |
-
<body>
|
258 |
-
<div class="wrapper">
|
259 |
-
<table class="unit-tests">
|
260 |
-
<thead>
|
261 |
-
<tr>
|
262 |
-
<th>Full Name</th>
|
263 |
-
<?php foreach ($headers as $col): ?>
|
264 |
-
<th><?= ucfirst($col); ?></th>
|
265 |
-
<?php endforeach; ?>
|
266 |
-
<th>Passed</th>
|
267 |
-
</tr>
|
268 |
-
</thead>
|
269 |
-
<tbody>
|
270 |
-
<?php foreach ($names as $name => $expected_values): $split_name = $parser->parse_name($name); $passed = ($split_name === $expected_values); ?>
|
271 |
-
<tr class="<?= ($passed) ? 'pass' : 'fail'; ?>">
|
272 |
-
<td><?= $name; ?></td>
|
273 |
-
<?php foreach ($headers as $col): ?>
|
274 |
-
<td><?= (isset($split_name[$col])) ? $split_name[$col] : ''; ?></td>
|
275 |
-
<?php endforeach; ?>
|
276 |
-
<td><?= ($passed) ? 'PASS' : 'FAIL'; ?></td>
|
277 |
-
</tr>
|
278 |
-
<?php endforeach; ?>
|
279 |
-
</tbody>
|
280 |
-
</table>
|
281 |
-
</div>
|
282 |
-
</body>
|
283 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,453 +1,559 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Split a full name into its constituent parts
|
7 |
-
* - prefix/salutation (Mr. Mrs. Dr. etc)
|
8 |
-
* - given/first name
|
9 |
-
* - middle name/initial(s)
|
10 |
-
* - surname (last name)
|
11 |
-
* - suffix (II, PhD, Jr. etc)
|
12 |
-
*
|
13 |
-
* Author: Josh
|
14 |
-
*
|
15 |
-
* Contribution from Clive Verrall www.cliveverrall.com February 2016
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
*
|
28 |
-
*
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
'
|
46 |
-
'
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
$
|
211 |
-
}
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
$
|
218 |
-
$
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
$
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
*
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
$
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
*
|
343 |
-
*
|
344 |
-
*
|
345 |
-
*
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
*
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// @codingStandardsIgnoreFile
|
3 |
+
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Split a full name into its constituent parts
|
7 |
+
* - prefix/salutation (Mr. Mrs. Dr. etc)
|
8 |
+
* - given/first name
|
9 |
+
* - middle name/initial(s)
|
10 |
+
* - surname (last name)
|
11 |
+
* - suffix (II, PhD, Jr. etc)
|
12 |
+
*
|
13 |
+
* Author: Josh Fraser
|
14 |
+
*
|
15 |
+
* Contribution from Clive Verrall www.cliveverrall.com February 2016
|
16 |
+
*
|
17 |
+
* // other contributions:
|
18 |
+
* // - eric willis [list of honorifics](http://notes.ericwillis.com/2009/11/common-name-prefixes-titles-and-honorifics/)
|
19 |
+
* // - `TomThak` for raising issue #16 and providing [wikepedia resource](https://cs.wikipedia.org/wiki/Akademick%C3%BD_titul)
|
20 |
+
* // - `atla5` for closing the issue.
|
21 |
+
*/
|
22 |
+
class FullNameParser {
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Create the dictionary of terms for use later
|
28 |
+
*
|
29 |
+
* - Common honorific prefixes (english)
|
30 |
+
* - Common compound surname identifiers
|
31 |
+
* - Common suffixes (lineage and professional)
|
32 |
+
* Note: longer professional titles should appear earlier in the array than shorter titles to reduce the risk of mis-identification e.g. BEng before BE
|
33 |
+
* Also note that case and periods are part of the matching for professional titles and therefore need to be correct, there are no case conversions
|
34 |
+
*/
|
35 |
+
protected $dict = array(
|
36 |
+
'prefix' => array(
|
37 |
+
'Mr.' => array('mr', 'mister', 'master'),
|
38 |
+
'Mrs.' => array('mrs', 'missus', 'missis'),
|
39 |
+
'Ms.' => array('ms', 'miss'),
|
40 |
+
'Dr.' => array('dr'),
|
41 |
+
'Rev.' => array("rev", "rev'd", "reverend"),
|
42 |
+
'Fr.' => array('fr', 'father'),
|
43 |
+
'Sr.' => array('sr', 'sister'),
|
44 |
+
'Prof.' => array('prof', 'professor'),
|
45 |
+
'Sir' => array('sir'),
|
46 |
+
'Hon.' => array('honorable'),
|
47 |
+
'Pres.' => array('president'),
|
48 |
+
'Gov' => array('governor','governer'),
|
49 |
+
'Ofc' => array('officer'),
|
50 |
+
'Msgr' => array('monsignor'),
|
51 |
+
'Sr.' => array('sister'),
|
52 |
+
'Br.' => array('brother'),
|
53 |
+
'Supt.' => array('superintendent'),
|
54 |
+
'Rep.' => array('representatitve'),
|
55 |
+
'Sen.' => array('senator'),
|
56 |
+
'Amb.' => array('ambassador'),
|
57 |
+
'Treas.' => array('treasurer'),
|
58 |
+
'Sec.' => array('secretary'),
|
59 |
+
'Pvt.' => array('private'),
|
60 |
+
'Cpl.' => array('corporal'),
|
61 |
+
'Sgt.' => array('sargent'),
|
62 |
+
'Adm.' => array('administrative','administrator','administrater'),
|
63 |
+
'Maj.' => array('major'),
|
64 |
+
'Capt.' => array('captain'),
|
65 |
+
'Cmdr.' => array('commander'),
|
66 |
+
'Lt.' => array('lieutenant'),
|
67 |
+
'Lt. Col.' => array('lieutenant colonel'),
|
68 |
+
'Col.' => array('colonel'),
|
69 |
+
'Gen.' => array('general'),
|
70 |
+
'Bc.' => array('bachelor', 'baccalaureus'),
|
71 |
+
'BcA.' => array('bachelor of arts', 'baccalaureus artis'),
|
72 |
+
'ICDr.' => array('doctor of canon law', 'juris cononici doctor'),
|
73 |
+
'Ing.' => array('engineer', 'ingenieur'),
|
74 |
+
'Ing. sheet.' => array('architect engineer', 'intrudes upon architectus'),
|
75 |
+
'JUDr.' => array('juris doctor utriusque', 'doctor rights'),
|
76 |
+
'MDDr.' => array('doctor of dental medicine', 'medicinae doctor dentium'),
|
77 |
+
'MgA.' => array('master of arts','magister artis'),
|
78 |
+
'Mgr.' => array('master'),
|
79 |
+
'MD.' => array('doctor of general medicine'),
|
80 |
+
'DVM.' => array('doctor of veterinary medine'),
|
81 |
+
'PaedDr.' => array('doctor of education'),
|
82 |
+
'PharmDr.' => array('doctor of pharmacy'),
|
83 |
+
'PhDr.' => array('doctor of philosophy'),
|
84 |
+
'PhMr.' => array('master of pharmacy'),
|
85 |
+
'RCDr.' => array('doctor of business studies'),
|
86 |
+
'RNDr.' => array('doctor of science'),
|
87 |
+
'DSc.' => array('doctor of science'),
|
88 |
+
'RSDr.' => array('doctor of socio-political sciences'),
|
89 |
+
'RTDr.' => array('doctor of technical sciences'),
|
90 |
+
'ThDr.' => array('doctor of theology'),
|
91 |
+
'Th.D.' => array('doctor of theology'),
|
92 |
+
'ThLic.' => array('licentiate of theology'),
|
93 |
+
'ThMgr.' => array('master of theology','master of divinity'),
|
94 |
+
'Acad.' => array('academian','academic'),
|
95 |
+
'ArtD.' => array('doctor of arts'),
|
96 |
+
'DiS.' => array('certified specialist'),
|
97 |
+
'As.' => array('assistant'),
|
98 |
+
'Odb. As.' => array('assistant professor'),
|
99 |
+
'Doc.' => array('associate professor'),
|
100 |
+
' ' => array('the')
|
101 |
+
),
|
102 |
+
'compound' => array('da','de','del','della','der','di','du','la','pietro','st.','st','ter','van','vanden','vere','von'),
|
103 |
+
'suffixes' => array(
|
104 |
+
'line' => array('I','II','III','IV','V','1st','2nd','3rd','4th','5th','Senior','Junior','Jr','Sr'),
|
105 |
+
'prof' => array('AO', 'B.A.', 'M.Sc', 'BCompt', 'PhD', 'Ph.D.','APR','RPh','PE','MD', 'M.D.', 'MA','DMD','CME', 'BSc', 'Bsc', 'BSc(hons)', 'Ph.D.', 'BEng', 'M.B.A.', 'MBA', 'FAICD', 'CM', 'OBC', 'M.B.', 'ChB', 'FRCP', 'FRSC',
|
106 |
+
'FREng', 'Esq', 'MEng', 'MSc', 'J.D.', 'JD', 'BGDipBus', 'Dip', 'Dipl.Phys','M.H.Sc.', 'MPA', 'B.Comm', 'B.Eng', 'B.Acc', 'FSA', 'PGDM', 'FCPA', 'RN', 'R.N.', 'MSN',
|
107 |
+
'PCA', 'PCCRM','PCFP','PCGD','PCHR','PCM','PCPS','PCPM','PCSCM','PCSM','PCMM','PCTC','ACA', 'FCA','ACMA', 'FCMA','AAIA', 'FAIA','CCC','MIPA','FIPA','CIA','CFE','CISA','CFAP',
|
108 |
+
'QC', 'Q.C.', 'M.Tech', 'CTA', 'C.I.M.A.', 'B.Ec',
|
109 |
+
'CFIA','ICCP','CPS','CAP-OM','CAPTA','TNAOAP','AFA','AVA','ASA','CAIA','CBA','CVA','ICVS','CIIA','CMU','PFM','PRM','CFP','CWM','CCP','EA','CCMT','CGAP','CDFM','CFO','CGFM','CGAT','CGFO','CMFO','CPFO','CPFA',
|
110 |
+
'BMD','BIET','P.Eng','PE', 'MBBS', 'MB', 'BCh', 'BAO', 'BMBS', 'MBBChir', 'MBChBa','MPhil','LL.D', 'LLD', 'D.Lit','DEA', 'DESS', 'DClinPsy', 'DSc', 'MRes', 'M.Res', 'Psy.D', 'Pharm.D',
|
111 |
+
'BA(Admin)', 'BAcc','BACom','BAdmin','BAE','BAEcon','BA(Ed)','BA(FS)','BAgr','BAH','BAI','BAI(Elect)','BAI(Mech)','BALaw','BAO','BAppSc','BArch','BArchSc','BARelSt','BASc','BASoc', 'DDS', 'D.D.S.',
|
112 |
+
'BASS','BATheol','BBA','BBLS', 'BBS','BBus','BChem','BCJ','BCL','BCLD(SocSc)','BClinSci','BCom','BCombSt','BCommEdCommDev','BComp','BComSc','BCoun','BD','BDes','BE','BEcon','BEcon&Fin', 'M.P.P.M.', 'MPPM',
|
113 |
+
'BEconSci', 'BEd','BEng','BES','BEng(Tech)','BFA','BFin','BFLS','BFST','BH','BHealthSc','BHSc','BHy','BJur','BL','BLE','BLegSc','BLib','BLing','BLitt','BLittCelt','BLS','BMedSc','BMet',
|
114 |
+
'BMid', 'BMin','BMS','BMSc','BMSc','BMS','BMus','BMusEd','BMusPerf','BN', 'BNS','BNurs','BOptom','BPA','BPharm', 'BPhil', 'TTC', 'DIP', 'Tchg', 'BEd', 'MEd','ACIB', 'FCIM', 'FCIS', 'FCS', 'Fcs',
|
115 |
+
'Bachelor', 'O.C.', 'JP', 'C.Eng', 'C.P.A.', 'B.B.S.', 'MBE', 'GBE', 'KBE', 'DBE', 'CBE', 'OBE', 'MRICS', 'D.P.S.K.', 'D.P.P.J.', 'DPSK', 'DPPJ', 'B.B.A.', 'GBS', 'MIGEM', 'M.I.G.E.M.', 'FCIS',
|
116 |
+
'BPhil(Ed)', 'BPhys','BPhysio','BPl','BRadiog','BSc', 'B.Sc', 'BScAgr','BSc(Dairy)','BSc(DomSc)','BScEc','BScEcon','BSc(Econ)','BSc(Eng)','BScFor','BSc(HealthSc)','BSc(Hort)', 'BBA', 'B.B.A.',
|
117 |
+
'BSc(MCRM)', 'BSc(Med)','BSc(Mid)','BSc(Min)','BSc(Psych)', 'BSc(Tech)','BSD', 'BSocSc','BSS','BStSu','BTchg','BTCP','BTech','BTechEd','BTh','BTheol','BTS','EdB','LittB','LLB','MA','MusB','ScBTech',
|
118 |
+
'CEng', 'FCA', 'CFA', 'Cfa', 'C.F.A.', 'LLB', 'LL.B', 'LLM', 'LL.M', 'CA(SA)', 'C.A.', 'CA','CPA', 'Solicitor', 'DMS', 'FIWO', 'CEnv', 'MICE', 'MIWEM', 'B.Com', 'BCom', 'BAcc', 'BA', 'BEc', 'MEc', 'HDip', 'B.Bus.', 'E.S.C.P.' )
|
119 |
+
),
|
120 |
+
'vowels' => array('a','e','i','o','u')
|
121 |
+
);
|
122 |
+
|
123 |
+
protected $not_nicknames = array( "(hons)");
|
124 |
+
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Parse Static entry point.
|
128 |
+
*
|
129 |
+
* @param string $name the full name you wish to parse
|
130 |
+
* @return array returns associative array of name parts
|
131 |
+
*/
|
132 |
+
public static function parse($name) {
|
133 |
+
$parser = new self();
|
134 |
+
return $parser->parse_name($name);
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
/**
|
139 |
+
* This is the primary method which calls all other methods
|
140 |
+
*
|
141 |
+
* @param string $name the full name you wish to parse
|
142 |
+
* @return array returns associative array of name parts
|
143 |
+
*/
|
144 |
+
public function parse_name($full_name) {
|
145 |
+
|
146 |
+
# Remove leading/trailing whitespace
|
147 |
+
$full_name = trim($full_name);
|
148 |
+
|
149 |
+
// remove any words that don't add value
|
150 |
+
// $full_name = str_replace("(Hons)", '', $full_name );
|
151 |
+
// $full_name = str_replace("(hons)", '', $full_name );
|
152 |
+
|
153 |
+
# Setup default vars
|
154 |
+
extract(array('salutation' => '', 'fname' => '', 'initials' => '', 'lname' => '', 'suffix' => ''));
|
155 |
+
|
156 |
+
# Find all the professional suffixes possible
|
157 |
+
$professional_suffix = $this->get_pro_suffix($full_name);
|
158 |
+
|
159 |
+
// The position of the first professional suffix denotes the end of the name and the start of suffixes
|
160 |
+
$first_suffix_index = mb_strlen($full_name);
|
161 |
+
foreach ($professional_suffix as $key => $psx) {
|
162 |
+
$start = mb_strpos($full_name, $psx);
|
163 |
+
if( $start === FALSE ) {
|
164 |
+
trigger_error("ASSERT ERROR, the professional suffix:".$psx." cannot be found in the full name:".$full_name, E_USER_ERROR);
|
165 |
+
continue;
|
166 |
+
}
|
167 |
+
if( $start < $first_suffix_index) {
|
168 |
+
$first_suffix_index = $start;
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
// everything to the right of the first professional suffix is part of the suffix
|
173 |
+
$suffix = mb_substr($full_name, $first_suffix_index);
|
174 |
+
|
175 |
+
// remove the suffixes from the full_name
|
176 |
+
$full_name = mb_substr($full_name, 0, $first_suffix_index);
|
177 |
+
|
178 |
+
# Deal with nickname, push to array
|
179 |
+
$has_nick = $this->get_nickname($full_name);
|
180 |
+
if ($has_nick) {
|
181 |
+
# Remove wrapper chars from around nickname
|
182 |
+
$name['nickname'] = mb_substr($has_nick, 1, (mb_strlen($has_nick) - 2));
|
183 |
+
# Remove the nickname from the full name
|
184 |
+
$full_name = str_replace($has_nick, '', $full_name);
|
185 |
+
# Get rid of consecutive spaces left by the removal
|
186 |
+
$full_name = str_replace(' ', ' ', $full_name);
|
187 |
+
}
|
188 |
+
|
189 |
+
# Grab a list of words from the remainder of the full name
|
190 |
+
$unfiltered_name_parts = $this->break_words($full_name);
|
191 |
+
|
192 |
+
# Is first word a title or multiple titles consecutively?
|
193 |
+
if( count($unfiltered_name_parts)) {
|
194 |
+
// only start looking if there are any words left in the name to process
|
195 |
+
while (count($unfiltered_name_parts) > 0 && $s = $this->is_salutation($unfiltered_name_parts[0])) {
|
196 |
+
$salutation .= "$s ";
|
197 |
+
array_shift($unfiltered_name_parts);
|
198 |
+
}
|
199 |
+
$salutation = trim($salutation);
|
200 |
+
// Find if there is a line suffix, if so then move it out
|
201 |
+
# Is last word a suffix or multiple suffixes consecutively?
|
202 |
+
while (count($unfiltered_name_parts) > 0 && $s = $this->is_line_suffix($unfiltered_name_parts[count($unfiltered_name_parts)-1], $full_name)) {
|
203 |
+
if( $suffix != "") {
|
204 |
+
$suffix = $s.", ".$suffix;
|
205 |
+
} else {
|
206 |
+
$suffix .= $s;
|
207 |
+
}
|
208 |
+
array_pop($unfiltered_name_parts);
|
209 |
+
}
|
210 |
+
$suffix = trim($suffix);
|
211 |
+
} else {
|
212 |
+
$salutation = "";
|
213 |
+
$suffix = "";
|
214 |
+
}
|
215 |
+
|
216 |
+
// Re-pack the unfiltered name parts array and exclude empty words
|
217 |
+
$name_arr = array();
|
218 |
+
foreach ($unfiltered_name_parts as $key => $name_part) {
|
219 |
+
$name_part = trim($name_part);
|
220 |
+
$name_part = rtrim($name_part,',');
|
221 |
+
if(mb_strlen($name_part) == '1') {
|
222 |
+
// If any word left is of one character that is not alphabetic then it is not a real word, so remove it
|
223 |
+
if( ! $this->mb_ctype_alpha($name_part)) {
|
224 |
+
$name_part = "";
|
225 |
+
}
|
226 |
+
}
|
227 |
+
if(mb_strlen(trim($name_part)) ) {
|
228 |
+
$name_arr[] = $name_part;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
$unfiltered_name_parts = $name_arr;
|
232 |
+
|
233 |
+
# set the ending range after prefix/suffix trim
|
234 |
+
$end = count($unfiltered_name_parts);
|
235 |
+
|
236 |
+
# concat the first name
|
237 |
+
for ($i=0; $i<$end-1; $i++) {
|
238 |
+
$word = $unfiltered_name_parts[$i];
|
239 |
+
# move on to parsing the last name if we find an indicator of a compound last name (Von, Van, etc)
|
240 |
+
# we use $i != 0 to allow for rare cases where an indicator is actually the first name (like "Von Fabella")
|
241 |
+
if ($this->is_compound($word) && $i != 0) {
|
242 |
+
break;
|
243 |
+
}
|
244 |
+
# is it a middle initial or part of their first name?
|
245 |
+
# if we start off with an initial, we'll call it the first name
|
246 |
+
if ($this->is_initial($word)) {
|
247 |
+
# is the initial the first word?
|
248 |
+
if ($i == 0) {
|
249 |
+
# if so, do a look-ahead to see if they go by their middle name
|
250 |
+
# for ex: "R. Jason Smith" => "Jason Smith" & "R." is stored as an initial
|
251 |
+
# but "R. J. Smith" => "R. Smith" and "J." is stored as an initial
|
252 |
+
if ($this->is_initial($unfiltered_name_parts[$i+1])) {
|
253 |
+
$fname .= " ".mb_strtoupper($word);
|
254 |
+
}
|
255 |
+
else {
|
256 |
+
$initials .= " ".mb_strtoupper($word);
|
257 |
+
}
|
258 |
+
}
|
259 |
+
# otherwise, just go ahead and save the initial
|
260 |
+
else {
|
261 |
+
$initials .= " ".mb_strtoupper($word);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
else {
|
265 |
+
$fname .= " ".$this->fix_case($word);
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
if( count($unfiltered_name_parts)) {
|
270 |
+
# check that we have more than 1 word in our string
|
271 |
+
if ($end-0 > 1) {
|
272 |
+
# concat the last name
|
273 |
+
for ($i; $i < $end; $i++) {
|
274 |
+
$lname .= " ".$this->fix_case($unfiltered_name_parts[$i]);
|
275 |
+
}
|
276 |
+
}
|
277 |
+
else {
|
278 |
+
# otherwise, single word strings are assumed to be first names
|
279 |
+
$fname = $this->fix_case($unfiltered_name_parts[$i]);
|
280 |
+
}
|
281 |
+
} else {
|
282 |
+
$fname = "";
|
283 |
+
}
|
284 |
+
|
285 |
+
# return the various parts in an array
|
286 |
+
$name['salutation'] = $salutation;
|
287 |
+
$name['fname'] = trim($fname);
|
288 |
+
$name['initials'] = trim($initials);
|
289 |
+
$name['lname'] = trim($lname);
|
290 |
+
$name['suffix'] = $suffix;
|
291 |
+
return $name;
|
292 |
+
}
|
293 |
+
|
294 |
+
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Breaks name into individual words
|
298 |
+
*
|
299 |
+
* @param string $name the full name you wish to parse
|
300 |
+
* @return array full list of words broken down by spaces
|
301 |
+
*/
|
302 |
+
public function break_words($name) {
|
303 |
+
$temp_word_arr = explode(' ', $name);
|
304 |
+
$final_word_arr = array();
|
305 |
+
foreach ($temp_word_arr as $key => $word) {
|
306 |
+
if( $word != "" && $word != ",") {
|
307 |
+
$final_word_arr[] = $word;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
return $final_word_arr;
|
311 |
+
}
|
312 |
+
|
313 |
+
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Checks for the existence of, and returns professional suffix
|
317 |
+
*
|
318 |
+
* @param string $name the name you wish to test
|
319 |
+
* @return mixed returns the suffix if exists, false otherwise
|
320 |
+
*/
|
321 |
+
public function get_pro_suffix($name) {
|
322 |
+
|
323 |
+
$found_suffix_arr = array();
|
324 |
+
foreach ($this->dict['suffixes']['prof'] as $suffix) {
|
325 |
+
if (preg_match('/[,\s]+'.preg_quote($suffix).'\b/i', $name, $matches)) {
|
326 |
+
$found_suffix = trim($matches[0]);
|
327 |
+
$found_suffix = rtrim($found_suffix,',');
|
328 |
+
$found_suffix = ltrim($found_suffix,',');
|
329 |
+
$found_suffix_arr[] = trim($found_suffix);
|
330 |
+
}
|
331 |
+
}
|
332 |
+
return $found_suffix_arr;
|
333 |
+
}
|
334 |
+
|
335 |
+
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Function to check name for existence of nickname based on these stipulations
|
339 |
+
* - String wrapped in parentheses (string)
|
340 |
+
* - String wrapped in double quotes "string"
|
341 |
+
* x String wrapped in single quotes 'string'
|
342 |
+
*
|
343 |
+
* I removed the check for strings in single quotes 'string' due to possible
|
344 |
+
* conflicts with names that may include apostrophes. Arabic transliterations, for example
|
345 |
+
*
|
346 |
+
* @param string $name the name you wish to test against
|
347 |
+
* @return mixed returns nickname if exists, false otherwise
|
348 |
+
*/
|
349 |
+
protected function get_nickname($name) {
|
350 |
+
if (preg_match("/[\(|\"].*?[\)|\"]/", $name, $matches)) {
|
351 |
+
if( ! in_array( mb_strtolower($matches[0]), $this->not_nicknames ) ) {
|
352 |
+
return $matches[0];
|
353 |
+
} else {
|
354 |
+
return false;
|
355 |
+
}
|
356 |
+
}
|
357 |
+
return false;
|
358 |
+
}
|
359 |
+
|
360 |
+
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Checks word against array of common lineage suffixes
|
364 |
+
*
|
365 |
+
* @param string $word the single word you wish to test
|
366 |
+
* @param string $name full name for context in determining edge-cases
|
367 |
+
* @return mixed boolean if false, string if true (returns suffix)
|
368 |
+
*/
|
369 |
+
protected function is_line_suffix($word, $name) {
|
370 |
+
|
371 |
+
# Ignore periods and righ commas, normalize case
|
372 |
+
$word = str_replace('.', '', mb_strtolower($word));
|
373 |
+
$word = rtrim($word,',');
|
374 |
+
|
375 |
+
# Search the array for our word
|
376 |
+
$line_match = array_search($word, array_map('mb_strtolower', $this->dict['suffixes']['line']));
|
377 |
+
|
378 |
+
# Now test our edge cases based on lineage
|
379 |
+
if ($line_match !== false) {
|
380 |
+
# Store our match
|
381 |
+
$matched_case = $this->dict['suffixes']['line'][$line_match];
|
382 |
+
|
383 |
+
# Remove it from the array
|
384 |
+
$temp_array = $this->dict['suffixes']['line'];
|
385 |
+
unset($temp_array[$line_match]);
|
386 |
+
|
387 |
+
# Make sure we're dealing with the suffix and not a surname
|
388 |
+
if ($word == 'senior' || $word == 'junior') {
|
389 |
+
|
390 |
+
# If name is Joshua Senior, it's pretty likely that Senior is the surname
|
391 |
+
# However, if the name is Joshua Jones Senior, then it's likely a suffix
|
392 |
+
if ($this->mb_str_word_count($name) < 3) {
|
393 |
+
return false;
|
394 |
+
}
|
395 |
+
|
396 |
+
# If the word Junior or Senior is contained, but so is some other
|
397 |
+
# lineage suffix, then the word is likely a surname and not a suffix
|
398 |
+
foreach ($temp_array as $suffix) {
|
399 |
+
if (preg_match("/\b".$suffix."\b/i", $name)) {
|
400 |
+
return false;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
return $matched_case;
|
405 |
+
}
|
406 |
+
return false;
|
407 |
+
}
|
408 |
+
|
409 |
+
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Checks word against list of common honorific prefixes
|
413 |
+
*
|
414 |
+
* @param string $word the single word you wish to test
|
415 |
+
* @return boolean
|
416 |
+
*/
|
417 |
+
protected function is_salutation($word) {
|
418 |
+
$word = str_replace('.', '', mb_strtolower($word));
|
419 |
+
foreach ($this->dict['prefix'] as $replace => $originals) {
|
420 |
+
if (in_array($word, $originals)) {
|
421 |
+
return $replace;
|
422 |
+
}
|
423 |
+
}
|
424 |
+
return false;
|
425 |
+
}
|
426 |
+
|
427 |
+
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Checks our dictionary of compound indicators to see if last name is compound
|
431 |
+
*
|
432 |
+
* @param string $word the single word you wish to test
|
433 |
+
* @return boolean
|
434 |
+
*/
|
435 |
+
protected function is_compound($word) {
|
436 |
+
return array_search(mb_strtolower($word), $this->dict['compound']);
|
437 |
+
}
|
438 |
+
|
439 |
+
|
440 |
+
|
441 |
+
/**
|
442 |
+
* Test string to see if it's a single letter/initial (period optional)
|
443 |
+
*
|
444 |
+
* @param string $word the single word you wish to test
|
445 |
+
* @return boolean
|
446 |
+
*/
|
447 |
+
protected function is_initial($word) {
|
448 |
+
return ((mb_strlen($word) == 1) || (mb_strlen($word) == 2 && $word{1} == "."));
|
449 |
+
}
|
450 |
+
|
451 |
+
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Checks for camelCase words such as McDonald and MacElroy
|
455 |
+
*
|
456 |
+
* @param string $word the single word you wish to test
|
457 |
+
* @return boolean
|
458 |
+
*/
|
459 |
+
protected function is_camel_case($word) {
|
460 |
+
if (preg_match('/\p{L}(\p{Lu}*\p{Ll}\p{Ll}*\p{Lu}|\p{Ll}*\p{Lu}\p{Lu}*\p{Ll})\p{L}*/', $word)) {
|
461 |
+
return true;
|
462 |
+
}
|
463 |
+
return false;
|
464 |
+
}
|
465 |
+
|
466 |
+
# ucfirst words split by dashes or periods
|
467 |
+
# ucfirst all upper/lower strings, but leave camelcase words alone
|
468 |
+
public function fix_case($word) {
|
469 |
+
|
470 |
+
# Fix case for words split by periods (J.P.)
|
471 |
+
if (mb_strpos($word, '.') !== false) {
|
472 |
+
$word = $this->safe_ucfirst(".", $word);;
|
473 |
+
}
|
474 |
+
|
475 |
+
# Fix case for words split by hyphens (Kimura-Fay)
|
476 |
+
if (mb_strpos($word, '-') !== false) {
|
477 |
+
$word = $this->safe_ucfirst("-", $word);
|
478 |
+
}
|
479 |
+
|
480 |
+
# Special case for single letters
|
481 |
+
if (mb_strlen($word) == 1) {
|
482 |
+
$word = mb_strtoupper($word);
|
483 |
+
}
|
484 |
+
|
485 |
+
# Special case for 2-letter words
|
486 |
+
if (mb_strlen($word) == 2) {
|
487 |
+
# Both letters vowels (uppercase both)
|
488 |
+
if (in_array(mb_strtolower($word{0}), $this->dict['vowels']) && in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
|
489 |
+
$word = mb_strtoupper($word);
|
490 |
+
}
|
491 |
+
# Both letters consonants (uppercase both)
|
492 |
+
if (!in_array(mb_strtolower($word{0}), $this->dict['vowels']) && !in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
|
493 |
+
$word = mb_strtoupper($word);
|
494 |
+
}
|
495 |
+
# First letter is vowel, second letter consonant (uppercase first)
|
496 |
+
if (in_array(mb_strtolower($word{0}), $this->dict['vowels']) && !in_array(mb_strtolower($word{1}), $this->dict['vowels'])) {
|
497 |
+
$word = $this->mb_ucfirst(mb_strtolower($word));
|
498 |
+
}
|
499 |
+
# First letter consonant, second letter vowel or "y" (uppercase first)
|
500 |
+
if (!in_array(mb_strtolower($word{0}), $this->dict['vowels']) && (in_array(mb_strtolower($word{1}), $this->dict['vowels']) || mb_strtolower($word{1}) == 'y')) {
|
501 |
+
$word = $this->mb_ucfirst(mb_strtolower($word));
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
# Fix case for words which aren't initials, but are all uppercase or lowercase
|
506 |
+
if ( (mb_strlen($word) >= 3) && ($this->mb_ctype_upper($word) || $this->mb_ctype_lower($word)) ) {
|
507 |
+
$word = $this->mb_ucfirst(mb_strtolower($word));
|
508 |
+
}
|
509 |
+
|
510 |
+
return $word;
|
511 |
+
}
|
512 |
+
|
513 |
+
# helper public function for fix_case
|
514 |
+
public function safe_ucfirst($seperator, $word) {
|
515 |
+
# uppercase words split by the seperator (ex. dashes or periods)
|
516 |
+
$parts = explode($seperator, $word);
|
517 |
+
foreach ($parts as $word) {
|
518 |
+
$words[] = ($this->is_camel_case($word)) ? $word : $this->mb_ucfirst(mb_strtolower($word));
|
519 |
+
}
|
520 |
+
return implode($seperator, $words);
|
521 |
+
}
|
522 |
+
|
523 |
+
# helper public function for multibytes ctype_alpha
|
524 |
+
public function mb_ctype_alpha($text)
|
525 |
+
{
|
526 |
+
return (bool)preg_match('/^\p{L}*$/', $text);
|
527 |
+
}
|
528 |
+
|
529 |
+
# helper public function for multibytes ctype_lower
|
530 |
+
public function mb_ctype_lower($text)
|
531 |
+
{
|
532 |
+
return (bool)preg_match('/^\p{Ll}*$/', $text);
|
533 |
+
}
|
534 |
+
|
535 |
+
# helper public function for multibytes ctype_upper
|
536 |
+
public function mb_ctype_upper($text)
|
537 |
+
{
|
538 |
+
return (bool)preg_match('/^\p{Lu}*$/', $text);
|
539 |
+
}
|
540 |
+
|
541 |
+
# helper public function for multibytes str_word_count
|
542 |
+
public function mb_str_word_count($text)
|
543 |
+
{
|
544 |
+
if (empty($text)) {
|
545 |
+
return 0;
|
546 |
+
} else {
|
547 |
+
return preg_match('/s+/', $text) + 1;
|
548 |
+
}
|
549 |
+
}
|
550 |
+
|
551 |
+
# helper public function for multibytes ucfirst
|
552 |
+
public function mb_ucfirst($string)
|
553 |
+
{
|
554 |
+
$strlen = mb_strlen($string);
|
555 |
+
$firstChar = mb_substr($string, 0, 1);
|
556 |
+
$then = mb_substr($string, 1, $strlen - 1);
|
557 |
+
return mb_strtoupper($firstChar) . $then;
|
558 |
+
}
|
559 |
+
}
|
@@ -1,477 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class FullNameParserTest extends PHPUnit_Framework_TestCase
|
4 |
-
{
|
5 |
-
|
6 |
-
/**
|
7 |
-
* @dataProvider functionalNameProvider
|
8 |
-
*/
|
9 |
-
public function testName($name, $expected_result)
|
10 |
-
{
|
11 |
-
$parser = new FullNameParser();
|
12 |
-
$split_name = $parser->parse_name($name, true);
|
13 |
-
$this->assertSame($split_name, $expected_result);
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @dataProvider disfunctionalNameProvider
|
18 |
-
*/
|
19 |
-
public function testBadNames($name, $expected_result)
|
20 |
-
{
|
21 |
-
$parser = new FullNameParser();
|
22 |
-
$split_name = $parser->parse_name($name, true);
|
23 |
-
$array_equal = ($split_name === $expected_result);
|
24 |
-
// These tests pass because the expected results do NOT match the actual results.
|
25 |
-
$this->assertFalse($array_equal);
|
26 |
-
}
|
27 |
-
|
28 |
-
public function functionalNameProvider()
|
29 |
-
{
|
30 |
-
return array(
|
31 |
-
array(
|
32 |
-
"Mr Anthony R Von Fange III",
|
33 |
-
array(
|
34 |
-
"salutation" => "Mr.",
|
35 |
-
"fname" => "Anthony",
|
36 |
-
"initials" => "R",
|
37 |
-
"lname" => "Von Fange",
|
38 |
-
"suffix" => "III"
|
39 |
-
)
|
40 |
-
),
|
41 |
-
array(
|
42 |
-
"J. B. Hunt",
|
43 |
-
array(
|
44 |
-
"salutation" => "",
|
45 |
-
"fname" => "J.",
|
46 |
-
"initials" => "B.",
|
47 |
-
"lname" => "Hunt",
|
48 |
-
"suffix" => ""
|
49 |
-
)
|
50 |
-
),
|
51 |
-
array(
|
52 |
-
"J.B. Hunt",
|
53 |
-
array(
|
54 |
-
"salutation" => "",
|
55 |
-
"fname" => "J.B.",
|
56 |
-
"initials" => "",
|
57 |
-
"lname" => "Hunt",
|
58 |
-
"suffix" => ""
|
59 |
-
)
|
60 |
-
),
|
61 |
-
array(
|
62 |
-
"Edward Senior III",
|
63 |
-
array(
|
64 |
-
"salutation" => "",
|
65 |
-
"fname" => "Edward",
|
66 |
-
"initials" => "",
|
67 |
-
"lname" => "Senior",
|
68 |
-
"suffix" => "III"
|
69 |
-
)
|
70 |
-
),
|
71 |
-
array(
|
72 |
-
"Edward Dale Senior II",
|
73 |
-
array(
|
74 |
-
"salutation" => "",
|
75 |
-
"fname" => "Edward Dale",
|
76 |
-
"initials" => "",
|
77 |
-
"lname" => "Senior",
|
78 |
-
"suffix" => "II"
|
79 |
-
)
|
80 |
-
),
|
81 |
-
array(
|
82 |
-
"Dale Edward Jones Senior",
|
83 |
-
array(
|
84 |
-
"salutation" => "",
|
85 |
-
"fname" => "Dale Edward",
|
86 |
-
"initials" => "",
|
87 |
-
"lname" => "Jones",
|
88 |
-
"suffix" => "Senior"
|
89 |
-
)
|
90 |
-
),
|
91 |
-
array(
|
92 |
-
"Edward Senior II",
|
93 |
-
array(
|
94 |
-
"salutation" => "",
|
95 |
-
"fname" => "Edward",
|
96 |
-
"initials" => "",
|
97 |
-
"lname" => "Senior",
|
98 |
-
"suffix" => "II"
|
99 |
-
)
|
100 |
-
),
|
101 |
-
array(
|
102 |
-
"Dale Edward Senior II, PhD",
|
103 |
-
array(
|
104 |
-
"salutation" => "",
|
105 |
-
"fname" => "Dale Edward",
|
106 |
-
"initials" => "",
|
107 |
-
"lname" => "Senior",
|
108 |
-
"suffix" => "II, PhD"
|
109 |
-
)
|
110 |
-
),
|
111 |
-
array(
|
112 |
-
"Jason Rodriguez Sr.",
|
113 |
-
array(
|
114 |
-
"salutation" => "",
|
115 |
-
"fname" => "Jason",
|
116 |
-
"initials" => "",
|
117 |
-
"lname" => "Rodriguez",
|
118 |
-
"suffix" => "Sr"
|
119 |
-
)
|
120 |
-
),
|
121 |
-
array(
|
122 |
-
"Jason Senior",
|
123 |
-
array(
|
124 |
-
"salutation" => "",
|
125 |
-
"fname" => "Jason",
|
126 |
-
"initials" => "",
|
127 |
-
"lname" => "Senior",
|
128 |
-
"suffix" => ""
|
129 |
-
)
|
130 |
-
),
|
131 |
-
array(
|
132 |
-
"Bill Junior",
|
133 |
-
array(
|
134 |
-
"salutation" => "",
|
135 |
-
"fname" => "Bill",
|
136 |
-
"initials" => "",
|
137 |
-
"lname" => "Junior",
|
138 |
-
"suffix" => ""
|
139 |
-
)
|
140 |
-
),
|
141 |
-
array(
|
142 |
-
"Sara Ann Fraser",
|
143 |
-
array(
|
144 |
-
"salutation" => "",
|
145 |
-
"fname" => "Sara Ann",
|
146 |
-
"initials" => "",
|
147 |
-
"lname" => "Fraser",
|
148 |
-
"suffix" => ""
|
149 |
-
)
|
150 |
-
),
|
151 |
-
array(
|
152 |
-
"Adam",
|
153 |
-
array(
|
154 |
-
"salutation" => "",
|
155 |
-
"fname" => "Adam",
|
156 |
-
"initials" => "",
|
157 |
-
"lname" => "",
|
158 |
-
"suffix" => ""
|
159 |
-
)
|
160 |
-
),
|
161 |
-
array(
|
162 |
-
"OLD MACDONALD",
|
163 |
-
array(
|
164 |
-
"salutation" => "",
|
165 |
-
"fname" => "Old",
|
166 |
-
"initials" => "",
|
167 |
-
"lname" => "Macdonald",
|
168 |
-
"suffix" => ""
|
169 |
-
)
|
170 |
-
),
|
171 |
-
array(
|
172 |
-
"Old MacDonald",
|
173 |
-
array(
|
174 |
-
"salutation" => "",
|
175 |
-
"fname" => "Old",
|
176 |
-
"initials" => "",
|
177 |
-
"lname" => "MacDonald",
|
178 |
-
"suffix" => ""
|
179 |
-
)
|
180 |
-
),
|
181 |
-
array(
|
182 |
-
"Old McDonald",
|
183 |
-
array(
|
184 |
-
"salutation" => "",
|
185 |
-
"fname" => "Old",
|
186 |
-
"initials" => "",
|
187 |
-
"lname" => "McDonald",
|
188 |
-
"suffix" => ""
|
189 |
-
)
|
190 |
-
),
|
191 |
-
array(
|
192 |
-
"Old Mc Donald",
|
193 |
-
array(
|
194 |
-
"salutation" => "",
|
195 |
-
"fname" => "Old Mc",
|
196 |
-
"initials" => "",
|
197 |
-
"lname" => "Donald",
|
198 |
-
"suffix" => ""
|
199 |
-
)
|
200 |
-
),
|
201 |
-
array(
|
202 |
-
"Old Mac Donald",
|
203 |
-
array(
|
204 |
-
"salutation" => "",
|
205 |
-
"fname" => "Old Mac",
|
206 |
-
"initials" => "",
|
207 |
-
"lname" => "Donald",
|
208 |
-
"suffix" => ""
|
209 |
-
)
|
210 |
-
),
|
211 |
-
array(
|
212 |
-
"James van Allen",
|
213 |
-
array(
|
214 |
-
"salutation" => "",
|
215 |
-
"fname" => "James",
|
216 |
-
"initials" => "",
|
217 |
-
"lname" => "Van Allen",
|
218 |
-
"suffix" => ""
|
219 |
-
)
|
220 |
-
),
|
221 |
-
array(
|
222 |
-
"Jimmy (Bubba) Smith",
|
223 |
-
array(
|
224 |
-
"nickname" => "Bubba",
|
225 |
-
"salutation" => "",
|
226 |
-
"fname" => "Jimmy",
|
227 |
-
"initials" => "",
|
228 |
-
"lname" => "Smith",
|
229 |
-
"suffix" => ""
|
230 |
-
)
|
231 |
-
),
|
232 |
-
array(
|
233 |
-
"Miss Jennifer Shrader Lawrence",
|
234 |
-
array(
|
235 |
-
"salutation" => "Ms.",
|
236 |
-
"fname" => "Jennifer Shrader",
|
237 |
-
"initials" => "",
|
238 |
-
"lname" => "Lawrence",
|
239 |
-
"suffix" => ""
|
240 |
-
)
|
241 |
-
),
|
242 |
-
array(
|
243 |
-
"Jonathan Smith, MD",
|
244 |
-
array(
|
245 |
-
"salutation" => "",
|
246 |
-
"fname" => "Jonathan",
|
247 |
-
"initials" => "",
|
248 |
-
"lname" => "Smith",
|
249 |
-
"suffix" => "MD"
|
250 |
-
)
|
251 |
-
),
|
252 |
-
array(
|
253 |
-
"Dr. Jonathan Smith",
|
254 |
-
array(
|
255 |
-
"salutation" => "Dr.",
|
256 |
-
"fname" => "Jonathan",
|
257 |
-
"initials" => "",
|
258 |
-
"lname" => "Smith",
|
259 |
-
"suffix" => ""
|
260 |
-
)
|
261 |
-
),
|
262 |
-
array(
|
263 |
-
"Jonathan Smith IV, PhD",
|
264 |
-
array(
|
265 |
-
"salutation" => "",
|
266 |
-
"fname" => "Jonathan",
|
267 |
-
"initials" => "",
|
268 |
-
"lname" => "Smith",
|
269 |
-
"suffix" => "IV, PhD"
|
270 |
-
)
|
271 |
-
),
|
272 |
-
array(
|
273 |
-
"Miss Jamie P. Harrowitz",
|
274 |
-
array(
|
275 |
-
"salutation" => "Ms.",
|
276 |
-
"fname" => "Jamie",
|
277 |
-
"initials" => "P.",
|
278 |
-
"lname" => "Harrowitz",
|
279 |
-
"suffix" => ""
|
280 |
-
)
|
281 |
-
),
|
282 |
-
array(
|
283 |
-
"Mr John Doe",
|
284 |
-
array(
|
285 |
-
"salutation" => "Mr.",
|
286 |
-
"fname" => "John",
|
287 |
-
"initials" => "",
|
288 |
-
"lname" => "Doe",
|
289 |
-
"suffix" => ""
|
290 |
-
)
|
291 |
-
),
|
292 |
-
array(
|
293 |
-
"Rev. Dr John Doe",
|
294 |
-
array(
|
295 |
-
"salutation" => "Rev. Dr.",
|
296 |
-
"fname" => "John",
|
297 |
-
"initials" => "",
|
298 |
-
"lname" => "Doe",
|
299 |
-
"suffix" => ""
|
300 |
-
)
|
301 |
-
),
|
302 |
-
array(
|
303 |
-
"Anthony Von Fange III",
|
304 |
-
array(
|
305 |
-
"salutation" => "",
|
306 |
-
"fname" => "Anthony",
|
307 |
-
"initials" => "",
|
308 |
-
"lname" => "Von Fange",
|
309 |
-
"suffix" => "III"
|
310 |
-
)
|
311 |
-
),
|
312 |
-
array(
|
313 |
-
"Anthony Von Fange III, PhD",
|
314 |
-
array(
|
315 |
-
"salutation" => "",
|
316 |
-
"fname" => "Anthony",
|
317 |
-
"initials" => "",
|
318 |
-
"lname" => "Von Fange",
|
319 |
-
"suffix" => "III, PhD"
|
320 |
-
)
|
321 |
-
),
|
322 |
-
array(
|
323 |
-
"Smarty Pants Phd",
|
324 |
-
array(
|
325 |
-
"salutation" => "",
|
326 |
-
"fname" => "Smarty",
|
327 |
-
"initials" => "",
|
328 |
-
"lname" => "Pants",
|
329 |
-
"suffix" => "PhD"
|
330 |
-
)
|
331 |
-
),
|
332 |
-
array(
|
333 |
-
"Mark Peter Williams",
|
334 |
-
array(
|
335 |
-
"salutation" => "",
|
336 |
-
"fname" => "Mark Peter",
|
337 |
-
"initials" => "",
|
338 |
-
"lname" => "Williams",
|
339 |
-
"suffix" => ""
|
340 |
-
)
|
341 |
-
),
|
342 |
-
array(
|
343 |
-
"Mark P Williams",
|
344 |
-
array(
|
345 |
-
"salutation" => "",
|
346 |
-
"fname" => "Mark",
|
347 |
-
"initials" => "P",
|
348 |
-
"lname" => "Williams",
|
349 |
-
"suffix" => ""
|
350 |
-
)
|
351 |
-
),
|
352 |
-
array(
|
353 |
-
"Mark P. Williams",
|
354 |
-
array(
|
355 |
-
"salutation" => "",
|
356 |
-
"fname" => "Mark",
|
357 |
-
"initials" => "P.",
|
358 |
-
"lname" => "Williams",
|
359 |
-
"suffix" => ""
|
360 |
-
)
|
361 |
-
),
|
362 |
-
array(
|
363 |
-
"M Peter Williams",
|
364 |
-
array(
|
365 |
-
"salutation" => "",
|
366 |
-
"fname" => "Peter",
|
367 |
-
"initials" => "M",
|
368 |
-
"lname" => "Williams",
|
369 |
-
"suffix" => ""
|
370 |
-
)
|
371 |
-
),
|
372 |
-
array(
|
373 |
-
"M. Peter Williams",
|
374 |
-
array(
|
375 |
-
"salutation" => "",
|
376 |
-
"fname" => "Peter",
|
377 |
-
"initials" => "M.",
|
378 |
-
"lname" => "Williams",
|
379 |
-
"suffix" => ""
|
380 |
-
)
|
381 |
-
),
|
382 |
-
array(
|
383 |
-
"M. P. Williams",
|
384 |
-
array(
|
385 |
-
"salutation" => "",
|
386 |
-
"fname" => "M.",
|
387 |
-
"initials" => "P.",
|
388 |
-
"lname" => "Williams",
|
389 |
-
"suffix" => ""
|
390 |
-
)
|
391 |
-
),
|
392 |
-
array(
|
393 |
-
"The Rev. Mark Williams",
|
394 |
-
array(
|
395 |
-
"salutation" => "Rev.",
|
396 |
-
"fname" => "Mark",
|
397 |
-
"initials" => "",
|
398 |
-
"lname" => "Williams",
|
399 |
-
"suffix" => ""
|
400 |
-
)
|
401 |
-
),
|
402 |
-
array(
|
403 |
-
"Mister Mark Williams",
|
404 |
-
array(
|
405 |
-
"salutation" => "Mr.",
|
406 |
-
"fname" => "Mark",
|
407 |
-
"initials" => "",
|
408 |
-
"lname" => "Williams",
|
409 |
-
"suffix" => ""
|
410 |
-
)
|
411 |
-
)
|
412 |
-
);
|
413 |
-
}
|
414 |
-
|
415 |
-
public function disfunctionalNameProvider()
|
416 |
-
{
|
417 |
-
return array(
|
418 |
-
// fails. format not yet supported
|
419 |
-
array(
|
420 |
-
"Fraser, Joshua",
|
421 |
-
array(
|
422 |
-
"salutation" => "",
|
423 |
-
"fname" => "Joshua",
|
424 |
-
"initials" => "",
|
425 |
-
"lname" => "Fraser",
|
426 |
-
"suffix" => ""
|
427 |
-
)
|
428 |
-
),
|
429 |
-
// fails. both initials should be capitalized
|
430 |
-
array(
|
431 |
-
"JB Hunt",
|
432 |
-
array(
|
433 |
-
"salutation" => "",
|
434 |
-
"fname" => "JB",
|
435 |
-
"initials" => "",
|
436 |
-
"lname" => "Hunt",
|
437 |
-
"suffix" => ""
|
438 |
-
)
|
439 |
-
),
|
440 |
-
// fails. doesn't handle multiple words inside parenthesis
|
441 |
-
array(
|
442 |
-
"Jimmy (Bubba Junior) Smith",
|
443 |
-
array(
|
444 |
-
"nickname" => "Bubba Junior",
|
445 |
-
"salutation" => "",
|
446 |
-
"fname" => "Jimmy",
|
447 |
-
"initials" => "",
|
448 |
-
"lname" => "Smith",
|
449 |
-
"suffix" => ""
|
450 |
-
)
|
451 |
-
),
|
452 |
-
// fails. should normalize the PhD suffix
|
453 |
-
array(
|
454 |
-
"Anthony Von Fange III, PHD",
|
455 |
-
array(
|
456 |
-
"salutation" => "",
|
457 |
-
"fname" => "Anthony",
|
458 |
-
"initials" => "",
|
459 |
-
"lname" => "Von Fange",
|
460 |
-
"suffix" => "III, PhD"
|
461 |
-
)
|
462 |
-
),
|
463 |
-
// fails. should treat "Silly" as the nickname or remove altogether
|
464 |
-
array(
|
465 |
-
"Not So Smarty Pants, Silly",
|
466 |
-
array(
|
467 |
-
"nickname" => "Silly",
|
468 |
-
"salutation" => "",
|
469 |
-
"fname" => "Not So Smarty",
|
470 |
-
"initials" => "",
|
471 |
-
"lname" => "Pants",
|
472 |
-
"suffix" => ""
|
473 |
-
)
|
474 |
-
)
|
475 |
-
);
|
476 |
-
}
|
477 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,27 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
|
3 |
-
<phpunit bootstrap="../parser.php"
|
4 |
-
backupGlobals="false"
|
5 |
-
backupStaticAttributes="false"
|
6 |
-
strict="true"
|
7 |
-
verbose="true">
|
8 |
-
|
9 |
-
<testsuites>
|
10 |
-
<testsuite name="Full Name Parser Test Suite">
|
11 |
-
<directory suffix="Test.php">./</directory>
|
12 |
-
</testsuite>
|
13 |
-
</testsuites>
|
14 |
-
|
15 |
-
<logging>
|
16 |
-
<log type="coverage-html"
|
17 |
-
target="./coverage"
|
18 |
-
title="Full Name Parser"
|
19 |
-
charset="UTF-8"
|
20 |
-
yui="true"
|
21 |
-
highlight="true"
|
22 |
-
lowUpperBound="35"
|
23 |
-
highLowerBound="70"/>
|
24 |
-
<log type="coverage-clover" target="./logs/clover.xml"/>
|
25 |
-
<log type="junit" target="./logs/junit.xml" logIncompleteSkipped="false"/>
|
26 |
-
</logging>
|
27 |
-
</phpunit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,21 +0,0 @@
|
|
1 |
-
table { border-collapse: collapse; border-spacing: 0; font-family: 'Open Sans', sans-serif; font-weight: 300 }
|
2 |
-
thead { display: table-header-group }
|
3 |
-
tr{ page-break-inside: avoid; }
|
4 |
-
.wrapper { width:75%; margin:30px auto; overflow: hidden; }
|
5 |
-
.unit-tests { float: left; width: 100%; border-bottom: 1px solid #ddd; }
|
6 |
-
.unit-tests thead{ background:#666; border: 1px solid #555; }
|
7 |
-
.unit-tests tr th{ padding: 0px 24px; height: 48px; line-height: 48px; font-weight: 900; color:#fff; border-right:1px solid #555 }
|
8 |
-
.unit-tests tbody td { padding: 0px 24px; height: 48px; line-height: 48px; text-align: center; border:1px solid #ddd; }
|
9 |
-
.unit-tests tbody tr:first-child td { border-top:0 none; }
|
10 |
-
.unit-tests tr td:first-child,
|
11 |
-
.unit-tests tr th:first-child{ text-align: left; }
|
12 |
-
.unit-tests tbody tr:first-child { border-top: 0 none; }
|
13 |
-
.unit-tests tbody tr:nth-child(even) { background:#f8f8f8; }
|
14 |
-
.unit-tests tbody tr:hover { cursor:default; border-color:rgba(0,0,0,0.04); }
|
15 |
-
.unit-tests tbody tr:hover td { border-color:rgba(0,0,0,0.06); }
|
16 |
-
.unit-tests tbody .pass td:last-child { background:#ecffc1; border-color:rgba(0,0,0,0.04); border-right-color:rgba(0,0,0,0.1); color:#7ec43c; }
|
17 |
-
.unit-tests tbody .fail td:last-child { background:#ffc1c1; border-color:rgba(0,0,0,0.03); border-right-color:rgba(0,0,0,0.1); color:#e53d3d; }
|
18 |
-
.unit-tests tbody .pass:hover { background:#ecffc1; color:#7ec43c; }
|
19 |
-
.unit-tests tbody .fail:hover { background:#ffc1c1; color:#e53d3d; }
|
20 |
-
.unit-tests tbody .pass td:hover { background:#c5f458; color:#8ec100; }
|
21 |
-
.unit-tests tbody .fail td:hover { background:#f25959; color:#c10000; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,4 +1,4 @@
|
|
1 |
-
# PayEx Payments API Library for PHP
|
2 |
|
3 |
## Description ##
|
4 |
PayEx Payments API Library for PHP provide library work with PayEx Payments API.
|
@@ -21,4 +21,4 @@ composer require payex/php-api
|
|
21 |
```
|
22 |
|
23 |
## Examples ##
|
24 |
-
TODO
|
1 |
+
# PayEx Payments API Library for PHP [![Build Status](https://travis-ci.org/PayEx/PayEx.Ecommerce.Php.svg?branch=master)](https://travis-ci.org/PayEx/PayEx.Ecommerce.Php)
|
2 |
|
3 |
## Description ##
|
4 |
PayEx Payments API Library for PHP provide library work with PayEx Payments API.
|
21 |
```
|
22 |
|
23 |
## Examples ##
|
24 |
+
TODO
|
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace PayEx;
|
4 |
|
5 |
class Px
|
@@ -23,18 +23,18 @@ class Px
|
|
23 |
|
24 |
/** @see http://www.payexpim.com/technical-reference/wsdl/wsdl-files/ */
|
25 |
/** @var array WSDL Files */
|
26 |
-
protected static $_wsdl =
|
27 |
'PxOrderWSDL' => '',
|
28 |
'PxVerificationWSDL' => '',
|
29 |
'PxAgreementWSDL' => '',
|
30 |
'PxRecurringWSDL' => '',
|
31 |
'PxConfinedWSDL' => ''
|
32 |
-
|
33 |
|
34 |
/** @var array PayEx SOAP API List */
|
35 |
-
protected static $_rules =
|
36 |
/** @see http://www.payexpim.com/category/pxorder/ */
|
37 |
-
'PxOrderWSDL' =>
|
38 |
'AddOrderAddress2', 'AddSingleOrderLine2', 'AuthorizeEVC', 'AuthorizeGC', 'AuthorizeInvoice',
|
39 |
'AuthorizeInvoiceLedger', 'Cancel2', 'Capture5', 'Check2', 'Complete', 'Credit5', 'CreditOrderLine3',
|
40 |
'FinalizeTransaction', 'GetAddressByPaymentMethod', 'GetApprovedDeliveryAddress', 'GetLowestMonthlyInvoiceSaleAmount',
|
@@ -42,24 +42,24 @@ class Px
|
|
42 |
'PurchaseFinancingInvoice', 'PurchaseInvoiceCorporate', 'PurchaseInvoicePrivate', 'PurchaseInvoiceSale',
|
43 |
'PurchasePartPaymentSale', 'PurchaseOTT', 'PurchaseInvoicePartPaymentSale', 'PurchasePX', 'SaleEVC',
|
44 |
'SaleInvoiceLedger', 'SaleGC', 'PurchaseWyWallet', 'PreparePurchaseWyWallet', 'PurchaseCreditAccount'
|
45 |
-
|
46 |
/** @see http://www.payexpim.com/category/pxverification/ */
|
47 |
-
'PxVerificationWSDL' =>
|
48 |
'CreditCheckCorporate2', 'CreditCheckPrivate2', 'GetConsumerLegalAddress', 'NameCheckPrivate'
|
49 |
-
|
50 |
/** @see http://www.payexpim.com/category/pxagreement/ */
|
51 |
-
'PxAgreementWSDL' =>
|
52 |
'ActivatePxAgreement', 'AutoPay3', 'AgreementCheck', 'CreateAgreement3', 'DeleteAgreement'
|
53 |
-
|
54 |
/** @see http://www.payexpim.com/category/pxagreement/ */
|
55 |
-
'PxRecurringWSDL' =>
|
56 |
'Check', 'Start', 'Stop'
|
57 |
-
|
58 |
/** @see http://www.payexpim.com/category/pxconfined/ */
|
59 |
-
'PxConfinedWSDL' =>
|
60 |
'PreparePurchaseCC', 'PurchaseCC'
|
61 |
-
|
62 |
-
|
63 |
|
64 |
/**
|
65 |
* Get Version
|
@@ -111,31 +111,31 @@ class Px
|
|
111 |
protected function getOptions()
|
112 |
{
|
113 |
// Stream Context Options
|
114 |
-
$stream_context_options =
|
115 |
|
116 |
// User Agent option
|
117 |
if (!empty($this->_user_agent)) {
|
118 |
-
$stream_context_options = array_merge($stream_context_options,
|
119 |
-
'http' =>
|
120 |
'header' => 'User-Agent: ' . $this->_user_agent
|
121 |
-
|
122 |
-
|
123 |
}
|
124 |
|
125 |
// SSL Verification option
|
126 |
if (!$this->_is_ssl_verify) {
|
127 |
-
$stream_context_options = array_merge($stream_context_options,
|
128 |
-
'ssl' =>
|
129 |
'verify_peer' => false,
|
130 |
'allow_self_signed' => true
|
131 |
-
|
132 |
-
|
133 |
}
|
134 |
|
135 |
// Create Stream Context
|
136 |
-
return
|
137 |
'stream_context' => stream_context_create($stream_context_options)
|
138 |
-
|
139 |
}
|
140 |
|
141 |
/**
|
@@ -190,8 +190,8 @@ class Px
|
|
190 |
return false;
|
191 |
}
|
192 |
|
193 |
-
$result =
|
194 |
-
$blacklisted =
|
195 |
$items = $doc->getElementsByTagName('payex')->item(0)->getElementsByTagName('*');
|
196 |
foreach ($items as $item) {
|
197 |
$key = $item->nodeName;
|
@@ -273,4 +273,4 @@ class Px
|
|
273 |
return strtoupper(md5($params . $this->_encryption_key));
|
274 |
}
|
275 |
|
276 |
-
}
|
1 |
<?php
|
2 |
+
// @codingStandardsIgnoreFile
|
3 |
namespace PayEx;
|
4 |
|
5 |
class Px
|
23 |
|
24 |
/** @see http://www.payexpim.com/technical-reference/wsdl/wsdl-files/ */
|
25 |
/** @var array WSDL Files */
|
26 |
+
protected static $_wsdl = array(
|
27 |
'PxOrderWSDL' => '',
|
28 |
'PxVerificationWSDL' => '',
|
29 |
'PxAgreementWSDL' => '',
|
30 |
'PxRecurringWSDL' => '',
|
31 |
'PxConfinedWSDL' => ''
|
32 |
+
);
|
33 |
|
34 |
/** @var array PayEx SOAP API List */
|
35 |
+
protected static $_rules = array(
|
36 |
/** @see http://www.payexpim.com/category/pxorder/ */
|
37 |
+
'PxOrderWSDL' => array(
|
38 |
'AddOrderAddress2', 'AddSingleOrderLine2', 'AuthorizeEVC', 'AuthorizeGC', 'AuthorizeInvoice',
|
39 |
'AuthorizeInvoiceLedger', 'Cancel2', 'Capture5', 'Check2', 'Complete', 'Credit5', 'CreditOrderLine3',
|
40 |
'FinalizeTransaction', 'GetAddressByPaymentMethod', 'GetApprovedDeliveryAddress', 'GetLowestMonthlyInvoiceSaleAmount',
|
42 |
'PurchaseFinancingInvoice', 'PurchaseInvoiceCorporate', 'PurchaseInvoicePrivate', 'PurchaseInvoiceSale',
|
43 |
'PurchasePartPaymentSale', 'PurchaseOTT', 'PurchaseInvoicePartPaymentSale', 'PurchasePX', 'SaleEVC',
|
44 |
'SaleInvoiceLedger', 'SaleGC', 'PurchaseWyWallet', 'PreparePurchaseWyWallet', 'PurchaseCreditAccount'
|
45 |
+
),
|
46 |
/** @see http://www.payexpim.com/category/pxverification/ */
|
47 |
+
'PxVerificationWSDL' => array(
|
48 |
'CreditCheckCorporate2', 'CreditCheckPrivate2', 'GetConsumerLegalAddress', 'NameCheckPrivate'
|
49 |
+
),
|
50 |
/** @see http://www.payexpim.com/category/pxagreement/ */
|
51 |
+
'PxAgreementWSDL' => array(
|
52 |
'ActivatePxAgreement', 'AutoPay3', 'AgreementCheck', 'CreateAgreement3', 'DeleteAgreement'
|
53 |
+
),
|
54 |
/** @see http://www.payexpim.com/category/pxagreement/ */
|
55 |
+
'PxRecurringWSDL' => array(
|
56 |
'Check', 'Start', 'Stop'
|
57 |
+
),
|
58 |
/** @see http://www.payexpim.com/category/pxconfined/ */
|
59 |
+
'PxConfinedWSDL' => array(
|
60 |
'PreparePurchaseCC', 'PurchaseCC'
|
61 |
+
)
|
62 |
+
);
|
63 |
|
64 |
/**
|
65 |
* Get Version
|
111 |
protected function getOptions()
|
112 |
{
|
113 |
// Stream Context Options
|
114 |
+
$stream_context_options = array();
|
115 |
|
116 |
// User Agent option
|
117 |
if (!empty($this->_user_agent)) {
|
118 |
+
$stream_context_options = array_merge($stream_context_options, array(
|
119 |
+
'http' => array(
|
120 |
'header' => 'User-Agent: ' . $this->_user_agent
|
121 |
+
)
|
122 |
+
));
|
123 |
}
|
124 |
|
125 |
// SSL Verification option
|
126 |
if (!$this->_is_ssl_verify) {
|
127 |
+
$stream_context_options = array_merge($stream_context_options, array(
|
128 |
+
'ssl' => array(
|
129 |
'verify_peer' => false,
|
130 |
'allow_self_signed' => true
|
131 |
+
)
|
132 |
+
));
|
133 |
}
|
134 |
|
135 |
// Create Stream Context
|
136 |
+
return array(
|
137 |
'stream_context' => stream_context_create($stream_context_options)
|
138 |
+
);
|
139 |
}
|
140 |
|
141 |
/**
|
190 |
return false;
|
191 |
}
|
192 |
|
193 |
+
$result = array();
|
194 |
+
$blacklisted = array('header', 'id', 'status');
|
195 |
$items = $doc->getElementsByTagName('payex')->item(0)->getElementsByTagName('*');
|
196 |
foreach ($items as $item) {
|
197 |
$key = $item->nodeName;
|
273 |
return strtoupper(md5($params . $this->_encryption_key));
|
274 |
}
|
275 |
|
276 |
+
}
|
@@ -1 +0,0 @@
|
|
1 |
-
*.local.ini
|
|
@@ -1,48 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace PayEx;
|
4 |
-
|
5 |
-
class ExceptionTest extends TestCase
|
6 |
-
{
|
7 |
-
public function testExceptionUndefinedEnvironment()
|
8 |
-
{
|
9 |
-
// Set empty environment
|
10 |
-
$this->px->setEnvironment('', '', TEST_MODE);
|
11 |
-
|
12 |
-
$e = null;
|
13 |
-
try {
|
14 |
-
$result = $this->px->Test([]);
|
15 |
-
} catch (\Exception $e) {
|
16 |
-
//
|
17 |
-
}
|
18 |
-
|
19 |
-
$this->assertEquals('Exception', get_class($e));
|
20 |
-
$this->assertEquals('Account number or Encryption key not defined. Use setEnvironment().', $e->getMessage());
|
21 |
-
}
|
22 |
-
|
23 |
-
public function testExceptionUnknownMethod()
|
24 |
-
{
|
25 |
-
$e = null;
|
26 |
-
try {
|
27 |
-
$result = $this->px->Test([]);
|
28 |
-
} catch (\Exception $e) {
|
29 |
-
//
|
30 |
-
}
|
31 |
-
|
32 |
-
$this->assertEquals('Exception', get_class($e));
|
33 |
-
$this->assertEquals('Unknown PayEx Method.', $e->getMessage());
|
34 |
-
}
|
35 |
-
|
36 |
-
public function testExceptionUnknownMethod1()
|
37 |
-
{
|
38 |
-
$e = null;
|
39 |
-
try {
|
40 |
-
$result = $this->px->__call('Initialize8', null);
|
41 |
-
} catch (\Exception $e) {
|
42 |
-
//
|
43 |
-
}
|
44 |
-
|
45 |
-
$this->assertEquals('Exception', get_class($e));
|
46 |
-
$this->assertEquals('Invalid PayEx Method params.', $e->getMessage());
|
47 |
-
}
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace PayEx;
|
4 |
-
|
5 |
-
class PaymentTest extends TestCase
|
6 |
-
{
|
7 |
-
public function testInitialize()
|
8 |
-
{
|
9 |
-
// Call PxOrder.Initialize8
|
10 |
-
$params = [
|
11 |
-
'accountNumber' => '',
|
12 |
-
'purchaseOperation' => 'AUTHORIZATION',
|
13 |
-
'price' => round(1 * 100),
|
14 |
-
'priceArgList' => '',
|
15 |
-
'currency' => 'USD',
|
16 |
-
'vat' => 0,
|
17 |
-
'orderID' => '10000001',
|
18 |
-
'productNumber' => '10000001',
|
19 |
-
'description' => 'Test Order (phpunit)',
|
20 |
-
'clientIPAddress' => '127.0.0.1',
|
21 |
-
'clientIdentifier' => 'USERAGENT=PHPUNIT',
|
22 |
-
'additionalValues' => 'NO3DS=true',
|
23 |
-
'externalID' => '',
|
24 |
-
'returnUrl' => 'http://localhost.no/return',
|
25 |
-
'view' => 'CREDITCARD',
|
26 |
-
'agreementRef' => '',
|
27 |
-
'cancelUrl' => 'http://localhost.no/cancel',
|
28 |
-
'clientLanguage' => 'en-US'
|
29 |
-
];
|
30 |
-
$result = $this->px->Initialize8($params);
|
31 |
-
|
32 |
-
// Array Check
|
33 |
-
$this->assertInternalType('array', $result);
|
34 |
-
|
35 |
-
// Response Check
|
36 |
-
$this->assertTrue($result['code'] === 'OK' && $result['description'] === 'OK' && $result['errorCode'] === 'OK');
|
37 |
-
|
38 |
-
// Result Check
|
39 |
-
$this->assertTrue(isset($result['orderRef']));
|
40 |
-
$this->assertTrue(isset($result['redirectUrl']));
|
41 |
-
}
|
42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace PayEx;
|
4 |
-
|
5 |
-
class SocialSecurityNumberTest extends TestCase
|
6 |
-
{
|
7 |
-
public function testSE()
|
8 |
-
{
|
9 |
-
$params = [
|
10 |
-
'accountNumber' => '',
|
11 |
-
'paymentMethod' => 'PXFINANCINGINVOICESE',
|
12 |
-
'ssn' => '590719-5662',
|
13 |
-
'zipcode' => '29620',
|
14 |
-
'countryCode' => 'SE',
|
15 |
-
'ipAddress' => '127.0.0.1'
|
16 |
-
];
|
17 |
-
$result = $this->px->GetAddressByPaymentMethod($params);
|
18 |
-
|
19 |
-
// Array Check
|
20 |
-
$this->assertInternalType('array', $result);
|
21 |
-
|
22 |
-
// Response Check
|
23 |
-
$this->assertTrue($result['code'] === 'OK' && $result['description'] === 'OK' && $result['errorCode'] === 'OK');
|
24 |
-
|
25 |
-
// Result Check
|
26 |
-
$this->assertEquals('Eva Dagmar Christina Tannerdal', $result['name']);
|
27 |
-
$this->assertEquals('Gunbritt Boden p12', $result['streetAddress']);
|
28 |
-
$this->assertEquals('', $result['coAddress']);
|
29 |
-
$this->assertEquals('29620', $result['zipCode']);
|
30 |
-
$this->assertEquals('Småbyen', $result['city']);
|
31 |
-
$this->assertEquals('SE', $result['countryCode']);
|
32 |
-
}
|
33 |
-
|
34 |
-
public function testNO()
|
35 |
-
{
|
36 |
-
$params = [
|
37 |
-
'accountNumber' => '',
|
38 |
-
'paymentMethod' => 'PXFINANCINGINVOICENO',
|
39 |
-
'ssn' => '12067543937',
|
40 |
-
'zipcode' => '3179',
|
41 |
-
'countryCode' => 'NO',
|
42 |
-
'ipAddress' => '127.0.0.1'
|
43 |
-
];
|
44 |
-
$result = $this->px->GetAddressByPaymentMethod($params);
|
45 |
-
|
46 |
-
// Array Check
|
47 |
-
$this->assertInternalType('array', $result);
|
48 |
-
|
49 |
-
// Response Check
|
50 |
-
$this->assertTrue($result['code'] === 'OK' && $result['description'] === 'OK' && $result['errorCode'] === 'OK');
|
51 |
-
|
52 |
-
// Result Check
|
53 |
-
$this->assertEquals('Are Eriksen', $result['name']);
|
54 |
-
$this->assertEquals('Strandsveien 560', $result['streetAddress']);
|
55 |
-
$this->assertEquals('Ares coAddress', $result['coAddress']);
|
56 |
-
$this->assertEquals('3179', $result['zipCode']);
|
57 |
-
$this->assertEquals('Oslo', $result['city']);
|
58 |
-
$this->assertEquals('NO', $result['countryCode']);
|
59 |
-
}
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace PayEx;
|
4 |
-
|
5 |
-
class TestCase extends \PHPUnit_Framework_TestCase
|
6 |
-
{
|
7 |
-
/** @var Px */
|
8 |
-
protected $px;
|
9 |
-
|
10 |
-
protected function setUp()
|
11 |
-
{
|
12 |
-
if (!defined('ACCOUNT_NUMBER') ||
|
13 |
-
!defined('ENCRYPTION_KEY')||
|
14 |
-
!defined('TEST_MODE'))
|
15 |
-
{
|
16 |
-
$this->fail('Test failed: Constants are not defined');
|
17 |
-
}
|
18 |
-
|
19 |
-
$this->px = new Px();
|
20 |
-
$this->px->setEnvironment(ACCOUNT_NUMBER, ENCRYPTION_KEY, TEST_MODE);
|
21 |
-
}
|
22 |
-
|
23 |
-
protected function tearDown()
|
24 |
-
{
|
25 |
-
$this->px = null;
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,15 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once __DIR__ . '/../src/PayEx/Px.php';
|
4 |
-
require_once __DIR__ . '/TestCase.php';
|
5 |
-
|
6 |
-
// Load config
|
7 |
-
if (file_exists(__DIR__ . '/config.local.ini')) {
|
8 |
-
$config = parse_ini_file(__DIR__ . '/config.local.ini', true);
|
9 |
-
} else {
|
10 |
-
$config = parse_ini_file(__DIR__ . '/config.ini', true);
|
11 |
-
}
|
12 |
-
|
13 |
-
define('ACCOUNT_NUMBER', $config['account_number']);
|
14 |
-
define('ENCRYPTION_KEY', $config['encryption_key']);
|
15 |
-
define('TEST_MODE', $config['test_mode']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,4 +0,0 @@
|
|
1 |
-
; PayEx Merchant Environment
|
2 |
-
account_number = 12345678
|
3 |
-
encryption_key = xxxxxxxxxxxxxxxxxxxx
|
4 |
-
test_mode = true
|
|
|
|
|
|
|
|
@@ -1,2 +0,0 @@
|
|
1 |
-
<phpunit bootstrap="bootstrap.php">
|
2 |
-
</phpunit>
|
|
|
|
@@ -1,14 +1,26 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>PayEx_Payments</name>
|
4 |
-
<version>3.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>PayEx Payments for Magento</summary>
|
10 |
<description>Official PayEx Payments Extension for Magento</description>
|
11 |
-
<notes>Version 3.1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
* Implemented Gift Card Method
|
13 |
* Implemented Electronic Value Codes Method
|
14 |

|
@@ -202,9 +214,9 @@ Version 1.2.0
|
|
202 |
* Bugfixes
|
203 |
</notes>
|
204 |
<authors><author><name>AAIT</name><user>aaight</user><email>info@aait.se</email></author></authors>
|
205 |
-
<date>
|
206 |
-
<time>12:
|
207 |
-
<contents><target name="magecommunity"><dir name="PayEx"><dir name="Payments"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><file name="Hint.php" hash="eb183968bc78ad610698149c2e43eee8"/></dir><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Totals"><file name="Fee.php" hash="8a2e94e150260233793bc234175860ca"/></dir></dir></dir></dir></dir><dir name="Bankdebit"><file name="Banks.php" hash="513151012cfc3b50ba664a4dd5ae0506"/></dir><dir name="Checkout"><file name="Fee.php" hash="c8f7e28a1994e1b19f61d1511dc2921a"/></dir><dir name="Creditmemo"><dir name="Totals"><file name="Fee.php" hash="fbb8dae687528f64c3f6b9b9415e4e48"/></dir></dir><dir name="Form"><file name="Bankdebit.php" hash="7ac259e42c1750b039333bdf8e251120"/><dir name="Billing"><file name="Agreement.php" hash="967b23eaf8e0ef1bc3260c68f170b535"/></dir><file name="CC.php" hash="300511caeed6b89245b217ce831738b3"/><file name="EVC.php" hash="94d1b719e555a93bff4d1168c7c865cf"/><file name="Financing.php" hash="407259a988ac5184d26530b196ef5fd6"/><file name="GC.php" hash="aefe5cfc0c6fcf66a648b56982639cb9"/><file name="Invoice.php" hash="da5b1a05319df937787fccb383d10603"/><file name="MasterPass.php" hash="c498e2a8348e69c38363bbfb4637a9db"/><file name="PartPayment.php" hash="5109b405a3bf50af8abef09382f9832d"/><file name="Swish.php" hash="3bafe7744b0d7b6d7cf58b801368da6c"/><file name="Wywallet.php" hash="6d93149b4708369cf9b162b28acf93ae"/></dir><dir name="Info"><file name="Bankdebit.php" hash="0adc20468181f262f96a85d0cc660294"/><dir name="Billing"><file name="Agreement.php" hash="4ec431a6b63f84ef4b7eac8fbb728a25"/></dir><file name="CC.php" hash="5e5719393bf435ad43262d8cff99ff7d"/><file name="EVC.php" hash="84d1cc336fd07dd99080e29f34fc9e43"/><file name="Financing.php" hash="3f00c97d360931ab26e43cf7fc51c802"/><file name="GC.php" hash="a16698cd89ec844380ce69de403361aa"/><file name="Invoice.php" hash="b5279f695dd4a3b2f03359d31024d715"/><file name="MasterPass.php" hash="e89dfab07bc90dbbde17add8ec86edd4"/><file name="PartPayment.php" hash="8af5c7d10d46f198835823a2246411e4"/><file name="Swish.php" hash="ced50c4956bbf1b47d75bf6e17add7a2"/><file name="Wywallet.php" hash="cf2ab25ee18ce1864d54295bce9c5413"/></dir><dir name="Invoice"><dir name="Totals"><file name="Fee.php" hash="cc7648e88cb10cf4cddbbe6fc0ad662f"/></dir></dir><dir name="MasterPass"><file name="Button.php" hash="a21664578bd2e64dd0da17c78d86acd4"/></dir><dir name="Order"><dir name="Totals"><file name="Fee.php" hash="bcffa4ba69a8dcc5a180ac72f83f97df"/></dir></dir></dir><dir name="Helper"><file name="Api.php" hash="1ce53e8839788869cef007e5c8757f1f"/><file name="Data.php" hash="822bc9d81bfc2688cb85b7f6d533a6bd"/><file name="Discount.php" hash="caaea480eb6983997957454fd35a068b"/><file name="Fee.php" hash="21a654132b640dad3e14b79481997d50"/><file name="Order.php" hash="6b89d4eb5f90eb30ff52a8983e181fe0"/><file name="Tools.php" hash="4462048a592cb1548eb48f7ed9739418"/></dir><dir name="Model"><dir name="Creditmemo"><file name="Tax.php" hash="d929e3eab0c4bf19dccd9f91a0cfc31a"/><file name="Total.php" hash="a8fb8f96a4aa26a66bdd1c605448f1c4"/></dir><dir name="Fee"><file name="Config.php" hash="9bcd18629425efff66fb7889b20bbd49"/></dir><file name="Feed.php" hash="f5da40677cf63bc951ef79b76cc5511d"/><dir name="Invoice"><dir name="Pdf"><file name="Total.php" hash="e50e44f88d8015792995c3fd9269e238"/></dir><file name="Tax.php" hash="59dc6b02e1ce3237165ff920093c3f18"/><file name="Total.php" hash="814d71354efb2366fdafd6e5176ef92e"/></dir><file name="Observer.php" hash="52c12adf027c894f61b865a884e4418f"/><dir name="Payment"><file name="Abstract.php" hash="ca596169a9f999e9cf2e41df37502c17"/><file name="Agreement.php" hash="b23c4d6fbbb9b8a21c52bada2d6dd1d2"/><file name="Bankdebit.php" hash="77427f17569fcc0bc00583a502721fce"/><file name="CC.php" hash="ac5ca8c454773c1908403631e45f4ff6"/><file name="EVC.php" hash="a6bc82c5c35530732970369d5cb9eaa7"/><file name="Financing.php" hash="d1bea52ff897a2116d2a018a9c2dfcf2"/><file name="GC.php" hash="b8da64d645c06c4583a84ab63bc81c20"/><file name="Invoice.php" hash="d087bd27bb8bf9b89fe89019689dd37e"/><file name="MasterPass.php" hash="f11be9e2e9c482fab1cd2394e6362560"/><file name="PartPayment.php" hash="466f21f2474adcb5b3fe13f230f95ab3"/><file name="Swish.php" hash="be74bffea41f5e06df86b114c390321e"/><file name="Wywallet.php" hash="8ab61565bc9c6e5181ed495ab0a3ffb1"/></dir><dir name="Quote"><file name="Tax.php" hash="f8457d99ecbc45569cdb5ed96da17ee3"/><file name="Total.php" hash="3078278ae4bc6398e67ed5cec3451597"/></dir><file name="Session.php" hash="1fecbc5cfae2895af571ec4f6bd94b77"/><dir name="Source"><file name="Banks.php" hash="0ef09b35734564738624c49124288429"/><file name="ClientLanguage.php" hash="6a62ed649614a3fdb8544d6a028518a1"/><file name="DiscountCalculation.php" hash="01f46845126c4fa97f6badb2821db8c6"/><file name="MediaDistribution.php" hash="f01d02d087d8d006b91ef542ad9bd3e7"/><file name="PaymentAction.php" hash="9dcb319d3987c285b297d40f0318f079"/><file name="PaymentView.php" hash="a1ed5ba1386ca6a294c53125fafe80fa"/><file name="ShippingMethod.php" hash="6c05068faae319ebb27319733ed5e95a"/><file name="TaxClasses.php" hash="b6ceeb12e575d6c1296cbc3850165a12"/></dir></dir><dir name="Test"><dir name="Block"><dir name="Form"><file name="Bankdebit.php" hash="2d36bf30e8d5f940b56f64513162075a"/><file name="CC.php" hash="8caed5ae1af2afbbb1a4fd8ba9a2bf51"/><file name="Financing.php" hash="1332bf659d4cc21e6e1a02f0f8e00523"/><file name="Invoice.php" hash="725f2a395570ce6f6659a61979e88e38"/><file name="MasterPass.php" hash="5134b69f8bab79128545e76265735131"/><file name="PartPayment.php" hash="234f78cb3ed0471b90f4e4ea52063bbb"/><file name="Swish.php" hash="4780efbd52b21544389196c18bc3574d"/><file name="Wywallet.php" hash="c484194c90c4b98ec222cea82abe8365"/></dir><dir name="Info"><file name="Bankdebit.php" hash="180f28d05b83770680f849c9ed0fb99b"/><file name="CC.php" hash="04a7e5449995cb2f9df295ca1b854be9"/><file name="MasterPass.php" hash="170f645c0a64e442fe94436bb36612f0"/><file name="PartPayment.php" hash="f5e056eb58b5c0f8d2cc88083aa98646"/><file name="Swish.php" hash="072e49173418fe53ea7b7011b7366269"/><file name="Wywallet.php" hash="6bb347e7b614bd78a96974e810beda43"/></dir></dir><dir name="Helper"><file name="Api.php" hash="895012e4ce797a458e13c33455b5f8f4"/><file name="Order.php" hash="88ce7813939433c0c19ed459bd75d857"/><file name="Tools.php" hash="49a00318fe0d2acfc714b503c19a7fc7"/></dir><dir name="Model"><dir name="Payment"><file name="Bankdebit.php" hash="5e3880162758fc6aeccaba9b3bc5c692"/><file name="CC.php" hash="bdfb02c0d8e3ee68eceb97363f363284"/><file name="Financing.php" hash="07c12d0ffa58c6ba296a352fdf78ab78"/><file name="Invoice.php" hash="ff113dd2ff846d8cdca48a74bfab8f04"/><file name="MasterPass.php" hash="259057fd9262fa60b0c85da84326dee1"/><file name="PartPayment.php" hash="85f73e8e06e16ac4186266befd50fe83"/><file name="Swish.php" hash="e288d7c93aa30a447a30571b12b04cf0"/><file name="Wywallet.php" hash="53732843df569fe985d563aa6c20da34"/></dir></dir></dir><dir name="controllers"><file name="BankdebitController.php" hash="70ffcc53b5fd45f57153c29e0d6269b1"/><file name="EvcController.php" hash="a396b97d81d6cb6432737f454630cbeb"/><file name="FinancingController.php" hash="9777fd538daf0ad5a70386b04a23a4c2"/><file name="GcController.php" hash="8b70991e3315596bed81ae02c8ebeb6d"/><file name="GetaddrController.php" hash="c119f5771b6b9f35b17bad472d0b1165"/><file name="InvoiceController.php" hash="59dcb499c0ff792fc31a87751d53f035"/><file name="MasterpassController.php" hash="078f8f71b7f1c28ef404f7023c41ccf3"/><file name="PartpaymentController.php" hash="5adccde9244fd6da6a667383f726bec4"/><file name="PaymentController.php" hash="0d876e6f8a6a1126aeab7ea9ae37a9b3"/><file name="SwishController.php" hash="040f8394796e59dc49f52b507d45afec"/><file name="TransactionController.php" hash="2b9b42ebd63e1f0202fb05881651269a"/><file name="WywalletController.php" hash="b41ca2f84d9304c21cbe97ea2e2e8bc8"/></dir><dir name="data"><dir name="payex_setup"><file name="data-install-3.0.0.php" hash="3a93c2049db69949fc615fddee97c818"/><file name="data-upgrade-3.0.2-3.0.3.php" hash="6a10340e6996eef25c18231142e18207"/><file name="data-upgrade-3.0.3-3.1.0.php" hash="108e447e57c2aac6f04f6a77bc644e11"/></dir></dir><dir name="etc"><file name="config.xml" hash="cf9cfebc3b3c8939fe5aafda1924e496"/><file name="system.xml" hash="4044a55d212b8b1be5af20d3a8ad89f5"/></dir><dir name="sql"><dir name="payex_setup"><file name="install-3.0.0.php" hash="3182c5ce1647a38e805f86abef05bc8a"/><file name="install-3.1.0.php" hash="b53f8362226e779698bc7093b3869bdb"/><file name="upgrade-3.0.2-3.0.3.php" hash="b0d9d6ee76bedd47ee7d707bbf8fedf0"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="PayEx_Payments.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="sv_SE"><file name="PayEx_Payments.csv" hash="c425c10c567f10fc903a25f397b8f70a"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="payex"><dir name="autopay"><file name="form.phtml" hash="eeff0becc642b3f2f468e80d96144dbc"/><file name="info.phtml" hash="d9b8f551ac4d53b1fe2e9b82d365e4c3"/><dir name="pdf"><file name="info.phtml" hash="1a7bb5d58cabb8a4a66234ffd3d6c230"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="bankdebit"><file name="form.phtml" hash="9840095a4d2f87dd955579cb053d6327"/><file name="info.phtml" hash="8b43e84bae9c4ffc96e57537c042bc42"/></dir><dir name="billing"><dir name="agreement"><file name="form.phtml" hash="b487001c6ae985d25efeda4cf7cf4ddc"/><file name="info.phtml" hash="2fba38394416ddc61c7462e7dd02207e"/></dir></dir><dir name="cc"><file name="form.phtml" hash="c479f42de3463b7957cee7063d6a200f"/><file name="info.phtml" hash="2a95b272b28f907c135f66d6452fa7a5"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="checkout"><file name="fee.phtml" hash="48d97cc321ed366ad89f618ca99f40a8"/><dir name="onepage"><file name="billing_with_ssn.phtml" hash="36d083f6c392822e5bfbd520f5aae5f0"/></dir></dir><dir name="evc"><file name="form.phtml" hash="60c9179a90f83bd2c29ad07f42552308"/><file name="info.phtml" hash="bfc60d6eb3dc16cef846928d39a04d12"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="financing"><file name="form.phtml" hash="8a7a8197d6de7fe076c12b51df13f8c2"/><file name="info.phtml" hash="c011e637ee4686535fd62024bc2445b6"/><dir name="pdf"><file name="info.phtml" hash="a4140bfd63a3c558e22935243b253ae9"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="gc"><file name="form.phtml" hash="cdf88b4007f1812487efe592f99b9365"/><file name="info.phtml" hash="0dad387a237d0fccc27dce39fa5c67c8"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="invoice"><file name="form.phtml" hash="56cb4dbc37962ee65228222d800a374d"/><file name="info.phtml" hash="a90f8aa90e56265c9e4533551bd3f1d2"/></dir><dir name="iwd_opc"><file name="billing_with_ssn.phtml" hash="de2d81f3aa1dcdab90845c4501f14029"/></dir><dir name="masterpass"><file name="button.phtml" hash="a845fe3f3965b4c151a87132a2560502"/><file name="form.phtml" hash="d7b01403fb3c58c2de79fdfa4ee38bc9"/><file name="info.phtml" hash="a3fe264db69fc49b65f05a7d2fc64590"/><dir name="pdf"><file name="info.phtml" hash="fbbe9f65f9e36ddb630ab9a9b019ed49"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="partpayment"><file name="form.phtml" hash="0d91898640f70c482a9a22370cc43fca"/><file name="info.phtml" hash="c88c8bc0bb3c1b1c030a3f621ceff66f"/><dir name="pdf"><file name="info.phtml" hash="a4140bfd63a3c558e22935243b253ae9"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="swish"><file name="form.phtml" hash="44a68dc45b8db91bfb715ca9467ab827"/><file name="info.phtml" hash="b2c51aa0a4383c5465cebdc50cda5ec4"/><dir name="pdf"><file name="info.phtml" hash="27f0335f7d9751c187d35a5837ba9d35"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="wywallet"><file name="form.phtml" hash="6e1bd3fb7bc50bfc3cf4e6808ebfb7b7"/><file name="info.phtml" hash="05703ddc8ac731023b5336c41865b343"/><dir name="pdf"><file name="info.phtml" hash="a36c05319049914f739485a80f44d9d8"/></dir></dir></dir></dir><dir name="layout"><dir name="payex"><file name="masterpass.xml" hash="d98963f85886570e21246f34d798ffa7"/><file name="payment_fee.xml" hash="d79c4ac5c4a9fddbadf8e156f67643bc"/><file name="social_security_number.xml" hash="f6df8d558fca12c5dc1871d1ca82f76a"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="payex"><dir name="adminhtml"><file name="hint.phtml" hash="e50c7fd0c9ea1fd315ea713a88e1b3e2"/></dir><dir name="autopay"><file name="form.phtml" hash="eeff0becc642b3f2f468e80d96144dbc"/><file name="info.phtml" hash="d9b8f551ac4d53b1fe2e9b82d365e4c3"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="bankdebit"><file name="form.phtml" hash="9840095a4d2f87dd955579cb053d6327"/><file name="info.phtml" hash="8b43e84bae9c4ffc96e57537c042bc42"/></dir><dir name="billing"><dir name="agreement"><file name="form.phtml" hash="b487001c6ae985d25efeda4cf7cf4ddc"/><file name="info.phtml" hash="f9ddb4fd74e952325a70ea47fd00b574"/></dir></dir><dir name="cc"><file name="form.phtml" hash="8286f66533534c36b1a8284dc55f543b"/><file name="info.phtml" hash="01f5da45f5a3668f3228a72bbd0b6aae"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="evc"><file name="form.phtml" hash="60c9179a90f83bd2c29ad07f42552308"/><file name="info.phtml" hash="bfc60d6eb3dc16cef846928d39a04d12"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="financing"><file name="form.phtml" hash="8a7a8197d6de7fe076c12b51df13f8c2"/><file name="info.phtml" hash="15700ce473736a214fc1aa41daf7f1e6"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="gc"><file name="form.phtml" hash="7aa7c4c50613fb225d0b8492fcf740ad"/><file name="info.phtml" hash="6b7eeb05bdb516cc27d4238883e767ee"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="invoice"><file name="form.phtml" hash="56cb4dbc37962ee65228222d800a374d"/><file name="info.phtml" hash="a90f8aa90e56265c9e4533551bd3f1d2"/></dir><dir name="masterpass"><file name="button.phtml" hash="a845fe3f3965b4c151a87132a2560502"/><file name="form.phtml" hash="d7b01403fb3c58c2de79fdfa4ee38bc9"/><file name="info.phtml" hash="a3fe264db69fc49b65f05a7d2fc64590"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="partpayment"><file name="form.phtml" hash="0d91898640f70c482a9a22370cc43fca"/><file name="info.phtml" hash="e8d0ef852c3b899bf305a9b486a253a7"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="swish"><file name="form.phtml" hash="44a68dc45b8db91bfb715ca9467ab827"/><file name="info.phtml" hash="8cab37ca1d161bc1751d26d6b647dd75"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="wywallet"><file name="form.phtml" hash="6e1bd3fb7bc50bfc3cf4e6808ebfb7b7"/><file name="info.phtml" hash="600d2c36c2691f1cddd3f05e4aafbc70"/></dir></dir></dir><dir name="layout"><dir name="payex"><file name="adminhtml.xml" hash="09843499521cc0d049e598af3bc93577"/><file name="payment_fee.xml" hash="b089c348af96916be2308e547a7aa541"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="PayEx_Payments.xml" hash="4112c8fcad299cf615f3c877541dbc23"/></dir></dir></dir><dir name="."><file name="Changelog_payex.txt" hash="b754e75cda48b07287ff3a2b4fc3f793"/></dir><dir name="js"><dir name="payex"><dir name="iwd_opc"><file name="social_security_number.js" hash="8be665ea511415c9a955db3454fc0110"/></dir><file name="social_security_number.js" hash="b7f6048ccc4834979745c41892810dfd"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="payex"><file name="american_express_64.png" hash="0e4379f8c5963b4eb550b1941b89821e"/><file name="diners_club_64.png" hash="76ad504729a6a86ed3be9a496a5def73"/><file name="financing-logo.gif" hash="601ac8ee1101dc6e83393c15b92f3761"/><file name="jcb_64.png" hash="79fd2798aa7c8695da293c25fa6e18a5"/><file name="mastercard_64.png" hash="a656e3028f69c593b4261555c75351d6"/><file name="masterpass-140.png" hash="b74662352d7a83ce5586ab26c3dafe91"/><file name="masterpass.png" hash="681673dd599a743a512a3697fc6576cc"/><file name="partpayment-logo.gif" hash="db8f8f8bcfb4decd106ff49dbe9a955e"/><file name="payex-invoice.png" hash="568683eca82952bf847e0b08d88274d7"/><file name="payex-small.gif" hash="b760e19d0024a994a0d07058038201db"/><file name="payex.gif" hash="b760e19d0024a994a0d07058038201db"/><file name="swish.png" hash="a21c66a591a13823a9b546a13f22c843"/><file name="visa_64.png" hash="2f263bca4b195b6b18eac60c5e889891"/><file name="ww_logo.png" hash="77f03db05e5c2c557fc7a69f778f94e1"/></dir></dir><dir name="css"><dir name="payex"><file name="masterpass.css" hash="9aabd17cdc8a0f58662d86581c418294"/><file name="social_security_number.css" hash="f4c6be59ab030a10eb364a203242e8a2"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="payex"><file name="swish.png" hash="a21c66a591a13823a9b546a13f22c843"/></dir></dir><dir name="payex"><file name="payex-logo.png" hash="5b493d130ef51483a3190d1285380242"/><file name="payex_admin.css" hash="bd5d31f628944b6b2e338b2bfcbf64ac"/></dir></dir></dir></dir></target><target name="magelib"><dir name="PayEx.Ecommerce.Php"><file name="LICENSE" hash="45fa4c0c9383cd79867ff84e3e09571f"/><file name="README.md" hash="54fce3564e1258d1e880ac5cc127c07c"/><file name="composer.json" hash="d992c25dd1a8eeeb4ca1f7609e84f0e0"/><dir name="src"><dir name="PayEx"><file name="Px.php" hash="9de27cca51ca7e8193eac57386973178"/></dir></dir><dir name="tests"><file name="ExceptionTest.php" hash="308c6aaa528c347bede31866814a52b8"/><file name="PaymentTest.php" hash="b65ea0baf888a022b46b2073a815b999"/><file name="SocialSecurityNumberTest.php" hash="716b81ccdf90dc86b1200bbd884bc733"/><file name="TestCase.php" hash="ecf7b761fcb13f3dfd0bbefd7f54cf3e"/><file name="bootstrap.php" hash="1513092b03d32908847972ce9f3f5de6"/><file name="config.ini" hash="b188ac7e751642a68acf8f85ef9ea29b"/><file name="phpunit.xml" hash="6ec124af67b56dba727ce95fa31346a1"/><file name=".gitignore" hash="c70c974c0e8123f383d38b3b0a02cf22"/></dir><file name=".git" hash="de008fb3d5fba327bd3166873e3eada5"/></dir><dir name="PHP-Name-Parser"><file name="README.md" hash="9e92e1a38faba55000f627ed0a71542e"/><file name="composer.json" hash="e5279f5f22785a33e165118d8031cb75"/><file name="examples.php" hash="d3d1948019c2a01fbb1a6394f39404df"/><file name="parser.php" hash="8c6f8764a4e372317cc7831f01b02353"/><dir name="tests"><file name="FullNameParserTest.php" hash="8b0428389df97b01341731b6b6dbeaac"/><file name="phpunit.xml" hash="5172e30007858dfcc4c23b77f97bc1e2"/><file name="style.css" hash="64301de4d41233d6da7d759df86e94f9"/></dir><file name=".git" hash="19d6fa68462e469ae8ca389195cb92ea"/></dir></target></contents>
|
208 |
<compatible/>
|
209 |
-
<dependencies><required><php><min>5.
|
210 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>PayEx_Payments</name>
|
4 |
+
<version>3.1.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>PayEx Payments for Magento</summary>
|
10 |
<description>Official PayEx Payments Extension for Magento</description>
|
11 |
+
<notes>Version 3.1.5
|
12 |
+
* Magento Code Standards Compliance
|
13 |
+

|
14 |
+
Version 3.1.4
|
15 |
+
* Implemented MobilePay Online payment method
|
16 |
+

|
17 |
+
Version 3.1.3
|
18 |
+
* Improved order lines and capture rounding issue workaround
|
19 |
+

|
20 |
+
Version 3.1.2
|
21 |
+
* Fixed install script bug
|
22 |
+

|
23 |
+
Version 3.1.1
|
24 |
* Implemented Gift Card Method
|
25 |
* Implemented Electronic Value Codes Method
|
26 |

|
214 |
* Bugfixes
|
215 |
</notes>
|
216 |
<authors><author><name>AAIT</name><user>aaight</user><email>info@aait.se</email></author></authors>
|
217 |
+
<date>2017-02-10</date>
|
218 |
+
<time>12:54:19</time>
|
219 |
+
<contents><target name="magecommunity"><dir name="PayEx"><dir name="Payments"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><file name="Hint.php" hash="925a39aea4f215f7cdfaa39b6e5dbdc6"/></dir><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Totals"><file name="Fee.php" hash="8a2e94e150260233793bc234175860ca"/></dir></dir></dir></dir></dir><dir name="Bankdebit"><file name="Banks.php" hash="009ed8b4c5ffbf45f51cca255b7551e2"/></dir><dir name="Checkout"><file name="Fee.php" hash="c8f7e28a1994e1b19f61d1511dc2921a"/></dir><dir name="Creditmemo"><dir name="Totals"><file name="Fee.php" hash="fbb8dae687528f64c3f6b9b9415e4e48"/></dir></dir><dir name="Form"><file name="Bankdebit.php" hash="7ac259e42c1750b039333bdf8e251120"/><dir name="Billing"><file name="Agreement.php" hash="0bd0c4be71e6ef4cb7ac949b01d1c657"/></dir><file name="CC.php" hash="fc755ffbfb1fc48117dd533f67b20c03"/><file name="EVC.php" hash="94d1b719e555a93bff4d1168c7c865cf"/><file name="Financing.php" hash="407259a988ac5184d26530b196ef5fd6"/><file name="GC.php" hash="aefe5cfc0c6fcf66a648b56982639cb9"/><file name="Invoice.php" hash="da5b1a05319df937787fccb383d10603"/><file name="MasterPass.php" hash="c498e2a8348e69c38363bbfb4637a9db"/><file name="Mobilepay.php" hash="aaeb8d8c41a2a8c2285736815030905f"/><file name="PartPayment.php" hash="5109b405a3bf50af8abef09382f9832d"/><file name="Swish.php" hash="3bafe7744b0d7b6d7cf58b801368da6c"/><file name="Wywallet.php" hash="6d93149b4708369cf9b162b28acf93ae"/></dir><dir name="Info"><file name="Bankdebit.php" hash="0adc20468181f262f96a85d0cc660294"/><dir name="Billing"><file name="Agreement.php" hash="89edf5ca413b56e8ec7fd86e00499f7e"/></dir><file name="CC.php" hash="5e5719393bf435ad43262d8cff99ff7d"/><file name="EVC.php" hash="84d1cc336fd07dd99080e29f34fc9e43"/><file name="Financing.php" hash="3f00c97d360931ab26e43cf7fc51c802"/><file name="GC.php" hash="a16698cd89ec844380ce69de403361aa"/><file name="Invoice.php" hash="b5279f695dd4a3b2f03359d31024d715"/><file name="MasterPass.php" hash="e89dfab07bc90dbbde17add8ec86edd4"/><file name="Mobilepay.php" hash="0b00da05cc3047ce1f814fc0dc7dd98b"/><file name="PartPayment.php" hash="8af5c7d10d46f198835823a2246411e4"/><file name="Swish.php" hash="ced50c4956bbf1b47d75bf6e17add7a2"/><file name="Wywallet.php" hash="cf2ab25ee18ce1864d54295bce9c5413"/></dir><dir name="Invoice"><dir name="Totals"><file name="Fee.php" hash="cc7648e88cb10cf4cddbbe6fc0ad662f"/></dir></dir><dir name="MasterPass"><file name="Button.php" hash="1e81d5be67ef6ad71e8e385c71273b9b"/></dir><dir name="Order"><dir name="Totals"><file name="Fee.php" hash="bcffa4ba69a8dcc5a180ac72f83f97df"/></dir></dir></dir><dir name="Helper"><file name="Api.php" hash="32cdba4796c53ade77c5a4c83b597985"/><file name="Data.php" hash="822bc9d81bfc2688cb85b7f6d533a6bd"/><file name="Discount.php" hash="caaea480eb6983997957454fd35a068b"/><file name="Fee.php" hash="21a654132b640dad3e14b79481997d50"/><file name="Order.php" hash="032628e3cef65756abcffd991fff78fa"/><file name="Tools.php" hash="73596437c91f57a35dd892fba43c0118"/></dir><dir name="Model"><dir name="Creditmemo"><file name="Tax.php" hash="d929e3eab0c4bf19dccd9f91a0cfc31a"/><file name="Total.php" hash="a8fb8f96a4aa26a66bdd1c605448f1c4"/></dir><dir name="Fee"><file name="Config.php" hash="9bcd18629425efff66fb7889b20bbd49"/></dir><file name="Feed.php" hash="f5da40677cf63bc951ef79b76cc5511d"/><dir name="Invoice"><dir name="Pdf"><file name="Total.php" hash="e50e44f88d8015792995c3fd9269e238"/></dir><file name="Tax.php" hash="59dc6b02e1ce3237165ff920093c3f18"/><file name="Total.php" hash="814d71354efb2366fdafd6e5176ef92e"/></dir><file name="Observer.php" hash="f109f99fb7d2cb83fce550bc33aa3095"/><dir name="Payment"><file name="Abstract.php" hash="ca596169a9f999e9cf2e41df37502c17"/><file name="Agreement.php" hash="b23c4d6fbbb9b8a21c52bada2d6dd1d2"/><file name="Bankdebit.php" hash="0a57899e621dcfbe8b278e63b52d7da5"/><file name="CC.php" hash="77ab4a2636b98f08922a8faf25725563"/><file name="EVC.php" hash="a6bc82c5c35530732970369d5cb9eaa7"/><file name="Financing.php" hash="1d4b731ebb88730dba152eda34ef69fc"/><file name="GC.php" hash="b8da64d645c06c4583a84ab63bc81c20"/><file name="Invoice.php" hash="5e68538aa05d6dc9fe1d2980e8fcafee"/><file name="MasterPass.php" hash="829aaebcec3a475f03c86dd41ff929ce"/><file name="Mobilepay.php" hash="75f70e24b12764787f693c867823060a"/><file name="PartPayment.php" hash="f07ffa0719dab761f11f6251d0f347a7"/><file name="Swish.php" hash="12cfe065125fd3bc7cf2ab373ee6aea8"/><file name="Wywallet.php" hash="d62feb309a0a225a72c4470cc27a26de"/></dir><dir name="Quote"><file name="Tax.php" hash="9ace7591d7fdd4f014aab07310f9571d"/><file name="Total.php" hash="0b45ccbf301c84135ccbd1fd4a62ceb6"/></dir><file name="Session.php" hash="1fecbc5cfae2895af571ec4f6bd94b77"/><dir name="Source"><file name="Banks.php" hash="0ef09b35734564738624c49124288429"/><file name="ClientLanguage.php" hash="6a62ed649614a3fdb8544d6a028518a1"/><file name="DiscountCalculation.php" hash="01f46845126c4fa97f6badb2821db8c6"/><file name="MediaDistribution.php" hash="f01d02d087d8d006b91ef542ad9bd3e7"/><file name="PaymentAction.php" hash="08c60807cef69fc8651b84a695f11770"/><file name="PaymentView.php" hash="a1ed5ba1386ca6a294c53125fafe80fa"/><file name="ShippingMethod.php" hash="0b462f6624408b7315c33194ea5a8154"/><file name="TaxClasses.php" hash="b6ceeb12e575d6c1296cbc3850165a12"/></dir></dir><dir name="Test"><dir name="Block"><dir name="Form"><file name="Bankdebit.php" hash="2d36bf30e8d5f940b56f64513162075a"/><file name="CC.php" hash="8caed5ae1af2afbbb1a4fd8ba9a2bf51"/><file name="Financing.php" hash="1332bf659d4cc21e6e1a02f0f8e00523"/><file name="Invoice.php" hash="725f2a395570ce6f6659a61979e88e38"/><file name="MasterPass.php" hash="5134b69f8bab79128545e76265735131"/><file name="PartPayment.php" hash="234f78cb3ed0471b90f4e4ea52063bbb"/><file name="Swish.php" hash="4780efbd52b21544389196c18bc3574d"/><file name="Wywallet.php" hash="c484194c90c4b98ec222cea82abe8365"/></dir><dir name="Info"><file name="Bankdebit.php" hash="180f28d05b83770680f849c9ed0fb99b"/><file name="CC.php" hash="04a7e5449995cb2f9df295ca1b854be9"/><file name="MasterPass.php" hash="170f645c0a64e442fe94436bb36612f0"/><file name="PartPayment.php" hash="f5e056eb58b5c0f8d2cc88083aa98646"/><file name="Swish.php" hash="072e49173418fe53ea7b7011b7366269"/><file name="Wywallet.php" hash="6bb347e7b614bd78a96974e810beda43"/></dir></dir><dir name="Helper"><file name="Api.php" hash="895012e4ce797a458e13c33455b5f8f4"/><file name="Order.php" hash="1be534980419a519cde160c9a8e5b534"/><file name="Tools.php" hash="866fb5990de920ca874a1e532244ecd8"/></dir><dir name="Model"><dir name="Payment"><file name="Bankdebit.php" hash="5e3880162758fc6aeccaba9b3bc5c692"/><file name="CC.php" hash="bdfb02c0d8e3ee68eceb97363f363284"/><file name="Financing.php" hash="07c12d0ffa58c6ba296a352fdf78ab78"/><file name="Invoice.php" hash="ff113dd2ff846d8cdca48a74bfab8f04"/><file name="MasterPass.php" hash="259057fd9262fa60b0c85da84326dee1"/><file name="PartPayment.php" hash="85f73e8e06e16ac4186266befd50fe83"/><file name="Swish.php" hash="e288d7c93aa30a447a30571b12b04cf0"/><file name="Wywallet.php" hash="53732843df569fe985d563aa6c20da34"/></dir></dir></dir><dir name="controllers"><file name="BankdebitController.php" hash="81f39635755e4d18e132b3fe73b692ea"/><file name="EvcController.php" hash="84f981cc710f113846b90012315d2981"/><file name="FinancingController.php" hash="0be858d6dbf331cdd78b457481f052a0"/><file name="GcController.php" hash="17256b591b9dd3d162f9eef011d4a6ad"/><file name="GetaddrController.php" hash="c119f5771b6b9f35b17bad472d0b1165"/><file name="InvoiceController.php" hash="c268c0baba45fe87ddd0c8005032f46f"/><file name="MasterpassController.php" hash="1fb19c64563d1304c98e225d51655b3f"/><file name="MobilepayController.php" hash="e262b711972f991d310b6fe285bd45aa"/><file name="PartpaymentController.php" hash="a6531216ad574cf72ecfff87da1ac8b9"/><file name="PaymentController.php" hash="45bb3d948f038d963bab6c164551deab"/><file name="SwishController.php" hash="ed333fd137e3a84e28ac5f87977005ca"/><file name="TransactionController.php" hash="8802670921e022ee466264dca3156bdf"/><file name="WywalletController.php" hash="3df83e59316988d87c1c00595c2bb363"/></dir><dir name="data"><dir name="payex_setup"><file name="data-install-3.0.0.php" hash="3a93c2049db69949fc615fddee97c818"/><file name="data-upgrade-3.0.2-3.0.3.php" hash="6a10340e6996eef25c18231142e18207"/><file name="data-upgrade-3.0.3-3.1.0.php" hash="ed991cd643e0e457ea33a00efadd6628"/></dir></dir><dir name="etc"><file name="config.xml" hash="81b9d9f55bc97936fa42307fefb44d21"/><file name="system.xml" hash="85a1e7137879bb04c64a5df5b7168ce2"/></dir><dir name="sql"><dir name="payex_setup"><file name="install-3.0.0.php" hash="d96e48cf5a2caedb9ac0273171fee5bd"/><file name="install-3.1.0.php" hash="b53f8362226e779698bc7093b3869bdb"/><file name="upgrade-3.0.2-3.0.3.php" hash="b0d9d6ee76bedd47ee7d707bbf8fedf0"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="PayEx_Payments.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="sv_SE"><file name="PayEx_Payments.csv" hash="c425c10c567f10fc903a25f397b8f70a"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="payex"><dir name="autopay"><file name="form.phtml" hash="eeff0becc642b3f2f468e80d96144dbc"/><file name="info.phtml" hash="d9b8f551ac4d53b1fe2e9b82d365e4c3"/><dir name="pdf"><file name="info.phtml" hash="1a7bb5d58cabb8a4a66234ffd3d6c230"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="bankdebit"><file name="form.phtml" hash="9840095a4d2f87dd955579cb053d6327"/><file name="info.phtml" hash="8b43e84bae9c4ffc96e57537c042bc42"/></dir><dir name="billing"><dir name="agreement"><file name="form.phtml" hash="b487001c6ae985d25efeda4cf7cf4ddc"/><file name="info.phtml" hash="2fba38394416ddc61c7462e7dd02207e"/></dir></dir><dir name="cc"><file name="form.phtml" hash="c479f42de3463b7957cee7063d6a200f"/><file name="info.phtml" hash="2a95b272b28f907c135f66d6452fa7a5"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="checkout"><file name="fee.phtml" hash="48d97cc321ed366ad89f618ca99f40a8"/><dir name="onepage"><file name="billing_with_ssn.phtml" hash="36d083f6c392822e5bfbd520f5aae5f0"/></dir></dir><dir name="evc"><file name="form.phtml" hash="60c9179a90f83bd2c29ad07f42552308"/><file name="info.phtml" hash="bfc60d6eb3dc16cef846928d39a04d12"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="financing"><file name="form.phtml" hash="8a7a8197d6de7fe076c12b51df13f8c2"/><file name="info.phtml" hash="c011e637ee4686535fd62024bc2445b6"/><dir name="pdf"><file name="info.phtml" hash="a4140bfd63a3c558e22935243b253ae9"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="gc"><file name="form.phtml" hash="cdf88b4007f1812487efe592f99b9365"/><file name="info.phtml" hash="0dad387a237d0fccc27dce39fa5c67c8"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="invoice"><file name="form.phtml" hash="56cb4dbc37962ee65228222d800a374d"/><file name="info.phtml" hash="a90f8aa90e56265c9e4533551bd3f1d2"/></dir><dir name="iwd_opc"><file name="billing_with_ssn.phtml" hash="de2d81f3aa1dcdab90845c4501f14029"/></dir><dir name="masterpass"><file name="button.phtml" hash="a845fe3f3965b4c151a87132a2560502"/><file name="form.phtml" hash="d7b01403fb3c58c2de79fdfa4ee38bc9"/><file name="info.phtml" hash="a3fe264db69fc49b65f05a7d2fc64590"/><dir name="pdf"><file name="info.phtml" hash="fbbe9f65f9e36ddb630ab9a9b019ed49"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="mobilepay"><file name="form.phtml" hash="f08c11af646f4c855317051cb727111b"/><file name="info.phtml" hash="7cc7342f76879280eba88cf7042bb1ac"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="partpayment"><file name="form.phtml" hash="0d91898640f70c482a9a22370cc43fca"/><file name="info.phtml" hash="c88c8bc0bb3c1b1c030a3f621ceff66f"/><dir name="pdf"><file name="info.phtml" hash="a4140bfd63a3c558e22935243b253ae9"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="swish"><file name="form.phtml" hash="44a68dc45b8db91bfb715ca9467ab827"/><file name="info.phtml" hash="b2c51aa0a4383c5465cebdc50cda5ec4"/><dir name="pdf"><file name="info.phtml" hash="27f0335f7d9751c187d35a5837ba9d35"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="wywallet"><file name="form.phtml" hash="6e1bd3fb7bc50bfc3cf4e6808ebfb7b7"/><file name="info.phtml" hash="05703ddc8ac731023b5336c41865b343"/><dir name="pdf"><file name="info.phtml" hash="a36c05319049914f739485a80f44d9d8"/></dir></dir></dir></dir><dir name="layout"><dir name="payex"><file name="masterpass.xml" hash="d98963f85886570e21246f34d798ffa7"/><file name="payment_fee.xml" hash="d79c4ac5c4a9fddbadf8e156f67643bc"/><file name="social_security_number.xml" hash="f6df8d558fca12c5dc1871d1ca82f76a"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="payex"><dir name="adminhtml"><file name="hint.phtml" hash="e50c7fd0c9ea1fd315ea713a88e1b3e2"/></dir><dir name="autopay"><file name="form.phtml" hash="eeff0becc642b3f2f468e80d96144dbc"/><file name="info.phtml" hash="d9b8f551ac4d53b1fe2e9b82d365e4c3"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="bankdebit"><file name="form.phtml" hash="9840095a4d2f87dd955579cb053d6327"/><file name="info.phtml" hash="8b43e84bae9c4ffc96e57537c042bc42"/></dir><dir name="billing"><dir name="agreement"><file name="form.phtml" hash="b487001c6ae985d25efeda4cf7cf4ddc"/><file name="info.phtml" hash="f9ddb4fd74e952325a70ea47fd00b574"/></dir></dir><dir name="cc"><file name="form.phtml" hash="8286f66533534c36b1a8284dc55f543b"/><file name="info.phtml" hash="01f5da45f5a3668f3228a72bbd0b6aae"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="evc"><file name="form.phtml" hash="60c9179a90f83bd2c29ad07f42552308"/><file name="info.phtml" hash="bfc60d6eb3dc16cef846928d39a04d12"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="financing"><file name="form.phtml" hash="8a7a8197d6de7fe076c12b51df13f8c2"/><file name="info.phtml" hash="15700ce473736a214fc1aa41daf7f1e6"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="gc"><file name="form.phtml" hash="7aa7c4c50613fb225d0b8492fcf740ad"/><file name="info.phtml" hash="6b7eeb05bdb516cc27d4238883e767ee"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="invoice"><file name="form.phtml" hash="56cb4dbc37962ee65228222d800a374d"/><file name="info.phtml" hash="a90f8aa90e56265c9e4533551bd3f1d2"/></dir><dir name="masterpass"><file name="button.phtml" hash="a845fe3f3965b4c151a87132a2560502"/><file name="form.phtml" hash="d7b01403fb3c58c2de79fdfa4ee38bc9"/><file name="info.phtml" hash="a3fe264db69fc49b65f05a7d2fc64590"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="mobilepay"><file name="form.phtml" hash="f08c11af646f4c855317051cb727111b"/><file name="info.phtml" hash="7cc7342f76879280eba88cf7042bb1ac"/><dir name="pdf"><file name="info.phtml" hash="010078bc76f687682f8a1d86eb5ae4ca"/></dir><file name="title.phtml" hash="6748faa7487a4e2281154c271cb8925a"/></dir><dir name="partpayment"><file name="form.phtml" hash="0d91898640f70c482a9a22370cc43fca"/><file name="info.phtml" hash="e8d0ef852c3b899bf305a9b486a253a7"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="swish"><file name="form.phtml" hash="44a68dc45b8db91bfb715ca9467ab827"/><file name="info.phtml" hash="8cab37ca1d161bc1751d26d6b647dd75"/><file name="title.phtml" hash="de64ade21290cd394a0dc7f0b356a131"/></dir><dir name="wywallet"><file name="form.phtml" hash="6e1bd3fb7bc50bfc3cf4e6808ebfb7b7"/><file name="info.phtml" hash="600d2c36c2691f1cddd3f05e4aafbc70"/></dir></dir></dir><dir name="layout"><dir name="payex"><file name="adminhtml.xml" hash="09843499521cc0d049e598af3bc93577"/><file name="payment_fee.xml" hash="b089c348af96916be2308e547a7aa541"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="PayEx_Payments.xml" hash="d65723b1eecbae4d21e6835450d8ec6a"/></dir></dir></dir><dir name="."><file name="Changelog_payex.txt" hash="bb170b6489ce6dfc88a170eb5187c4a5"/></dir><dir name="js"><dir name="payex"><dir name="iwd_opc"><file name="social_security_number.js" hash="af4e315bc0c4eb776edfd14f381efbb0"/></dir><file name="social_security_number.js" hash="20d3c35da569ed3b7f6c64aceb5c609b"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="payex"><file name="american_express_64.png" hash="0e4379f8c5963b4eb550b1941b89821e"/><file name="diners_club_64.png" hash="76ad504729a6a86ed3be9a496a5def73"/><file name="financing-logo.gif" hash="601ac8ee1101dc6e83393c15b92f3761"/><file name="jcb_64.png" hash="79fd2798aa7c8695da293c25fa6e18a5"/><file name="mastercard_64.png" hash="a656e3028f69c593b4261555c75351d6"/><file name="masterpass-140.png" hash="b74662352d7a83ce5586ab26c3dafe91"/><file name="masterpass.png" hash="681673dd599a743a512a3697fc6576cc"/><file name="mobilepay_online.png" hash="3fb62d0204b353f0e881d28e22a0749f"/><file name="partpayment-logo.gif" hash="db8f8f8bcfb4decd106ff49dbe9a955e"/><file name="payex-invoice.png" hash="568683eca82952bf847e0b08d88274d7"/><file name="payex-small.gif" hash="b760e19d0024a994a0d07058038201db"/><file name="payex.gif" hash="b760e19d0024a994a0d07058038201db"/><file name="swish.png" hash="a21c66a591a13823a9b546a13f22c843"/><file name="visa_64.png" hash="2f263bca4b195b6b18eac60c5e889891"/><file name="ww_logo.png" hash="77f03db05e5c2c557fc7a69f778f94e1"/></dir></dir><dir name="css"><dir name="payex"><file name="masterpass.css" hash="9aabd17cdc8a0f58662d86581c418294"/><file name="social_security_number.css" hash="f4c6be59ab030a10eb364a203242e8a2"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="payex"><file name="mobilepay_online.png" hash="3fb62d0204b353f0e881d28e22a0749f"/><file name="swish.png" hash="a21c66a591a13823a9b546a13f22c843"/></dir></dir><dir name="payex"><file name="payex-logo.png" hash="5b493d130ef51483a3190d1285380242"/><file name="payex_admin.css" hash="bd5d31f628944b6b2e338b2bfcbf64ac"/></dir></dir></dir></dir></target><target name="magelib"><dir name="PayEx.Ecommerce.Php"><file name="LICENSE" hash="45fa4c0c9383cd79867ff84e3e09571f"/><file name="README.md" hash="412cad2f9ee4409c30236e892e9ac348"/><file name="composer.json" hash="d992c25dd1a8eeeb4ca1f7609e84f0e0"/><dir name="src"><dir name="PayEx"><file name="Px.php" hash="88a60ba8bc7cb06b3e7105f452239d12"/></dir></dir></dir><dir name="PHP-Name-Parser"><file name="README.md" hash="32df9fbbc029ef4171cc91e3082d6b54"/><file name="composer.json" hash="e5279f5f22785a33e165118d8031cb75"/><file name="parser.php" hash="bd07e4eb69eb9e88bae3c03ff02f9b68"/></dir></target></contents>
|
220 |
<compatible/>
|
221 |
+
<dependencies><required><php><min>5.4.0</min><max>7.2.0</max></php><extension><name>soap</name><min/><max/></extension></required></dependencies>
|
222 |
</package>
|
Binary file
|
Binary file
|