Skip to content

Commit

Permalink
1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dyd committed Jul 5, 2024
1 parent daa4715 commit 93d4982
Show file tree
Hide file tree
Showing 416 changed files with 2,959 additions and 5,831 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Requirements
------------

* OpenCart 4.0.2.X (due to architectural changes, this module is __incompatible__ with older OpenCart versions)
* [GenesisPHP v1.24.6](https://github.com/GenesisGateway/genesis_php/tree/1.24.6) - (Integrated in Module)
* [GenesisPHP v2.0.0](https://github.com/GenesisGateway/genesis_php/tree/2.0.0) - (Integrated in Module)
* PCI-certified server in order to use ```emerchantpay Direct```

GenesisPHP Requirements
Expand Down Expand Up @@ -81,7 +81,6 @@ Supported Transactions & Payment Methods
* __iDeal__
* __iDebit__
* __InstaDebit__
* __InstantTransfer__
* __InitRecurringSale__
* __InitRecurringSale (3D-Secure)__
* __Intersolve__
Expand Down
8 changes: 4 additions & 4 deletions admin/model/payment/emerchantpay/base_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

namespace Opencart\Admin\Model\Extension\Emerchantpay\Payment\emerchantpay;

use Genesis\API\Constants\Endpoints;
use Genesis\API\Constants\Environments;
use Genesis\API\Constants\Transaction\Parameters\ScaExemptions;
use Genesis\Api\Constants\Endpoints;
use Genesis\Api\Constants\Environments;
use Genesis\Api\Constants\Transaction\Parameters\ScaExemptions;
use Genesis\Config;
use Genesis\Exceptions\InvalidArgument;
use Opencart\System\Engine\Model;
Expand All @@ -39,7 +39,7 @@ class BaseModel extends Model
*
* @var string
*/
protected $module_version = '1.1.5';
protected $module_version = '1.1.6';

/**
* Returns formatted array with available SCA Exemptions
Expand Down
19 changes: 10 additions & 9 deletions admin/model/payment/emerchantpay_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

namespace Opencart\Admin\Model\Extension\Emerchantpay\Payment;

use Genesis\API\Constants\Endpoints;
use Genesis\API\Constants\Environments;
use Genesis\API\Constants\Payment\Methods;
use Genesis\API\Constants\Transaction\Names;
use Genesis\API\Constants\Transaction\Types;
use Genesis\API\Constants\Transaction\Parameters\Mobile\GooglePay\PaymentTypes as GooglePayPaymentTypes;
use Genesis\API\Constants\Transaction\Parameters\Mobile\ApplePay\PaymentTypes as ApplePayPaymentTypes;
use Genesis\API\Constants\Transaction\Parameters\Wallets\PayPal\PaymentTypes as PayPalPaymentTypes;
use Genesis\API\Request\Financial\Alternatives\Klarna\Items as KlarnaItems;
use Genesis\Api\Constants\Endpoints;
use Genesis\Api\Constants\Environments;
use Genesis\Api\Constants\Payment\Methods;
use Genesis\Api\Constants\Transaction\Names;
use Genesis\Api\Constants\Transaction\Types;
use Genesis\Api\Constants\Transaction\Parameters\Mobile\GooglePay\PaymentTypes as GooglePayPaymentTypes;
use Genesis\Api\Constants\Transaction\Parameters\Mobile\ApplePay\PaymentTypes as ApplePayPaymentTypes;
use Genesis\Api\Constants\Transaction\Parameters\Wallets\PayPal\PaymentTypes as PayPalPaymentTypes;
use Genesis\Api\Request\Financial\Alternatives\Klarna\Items as KlarnaItems;
use Genesis\Config;
use Genesis\Exceptions\InvalidArgument;
use Genesis\Genesis;
Expand All @@ -39,6 +39,7 @@
* Backend model for the "emerchantpay Checkout" module
*
* @package EMerchantpayCheckout
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class EmerchantpayCheckout extends BaseModel
{
Expand Down
8 changes: 4 additions & 4 deletions admin/model/payment/emerchantpay_direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

namespace Opencart\Admin\Model\Extension\Emerchantpay\Payment;

use Genesis\API\Constants\Endpoints;
use Genesis\API\Constants\Environments;
use Genesis\API\Constants\Transaction\Names;
use Genesis\API\Constants\Transaction\Types;
use Genesis\Api\Constants\Endpoints;
use Genesis\Api\Constants\Environments;
use Genesis\Api\Constants\Transaction\Names;
use Genesis\Api\Constants\Transaction\Types;
use Genesis\Config;
use Genesis\Genesis;
use Opencart\Admin\Model\Extension\Emerchantpay\Payment\emerchantpay\BaseModel;
Expand Down
13 changes: 10 additions & 3 deletions catalog/controller/payment/emerchantpay_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

namespace Opencart\Catalog\Controller\Extension\Emerchantpay\Payment;

use Genesis\API\Constants\Transaction\States;
use Genesis\API\Notification;
use Genesis\Api\Constants\Transaction\States;
use Genesis\Api\Notification;
use Opencart\Extension\Emerchantpay\System\Catalog\BaseController;
use Exception;
use Opencart\System\Engine\Controller;
Expand Down Expand Up @@ -153,8 +153,13 @@ function ($value) {

$this->populateAddresses($order_info, $data);

$transaction = $this->model_extension_emerchantpay_payment_emerchantpay_checkout->create($data);
$transaction_response = $this->model_extension_emerchantpay_payment_emerchantpay_checkout->create($data);

if (!$transaction_response->isSuccessful()) {
throw new Exception($transaction_response->getErrorDescription());
}

$transaction = $transaction_response->getResponseObject();
if (isset($transaction->unique_id)) {
$this->prepareRedirect($transaction, $order_info);

Expand All @@ -179,6 +184,8 @@ function ($value) {
* Process Gateway Notification
*
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function callback(): void {
$this->load->model('checkout/order');
Expand Down
12 changes: 9 additions & 3 deletions catalog/controller/payment/emerchantpay_direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
namespace Opencart\Catalog\Controller\Extension\Emerchantpay\Payment;

use Exception;
use Genesis\API\Notification;
use Genesis\Api\Notification;
use Opencart\Extension\Emerchantpay\System\Catalog\BaseController;
use Genesis\API\Constants\Transaction\States;
use Genesis\Api\Constants\Transaction\States;

/**
* Front-end controller for the "emerchantpay Direct" module
Expand Down Expand Up @@ -144,8 +144,13 @@ function ($value) {
$data += $this->buildActionUrls($this->module_name);
$this->populateAddresses($order_info, $data);

$transaction = $model->sendTransaction($data);
$transaction_response = $model->sendTransaction($data);

if (!$transaction_response->isSuccessful()) {
throw new Exception($transaction_response->getErrorDescription());
}

$transaction = $transaction_response->getResponseObject();
if (isset($transaction->unique_id)) {
$data = $this->populateDataUniqIdTrx($transaction, $order_info);

Expand Down Expand Up @@ -181,6 +186,7 @@ function ($value) {
* Process Gateway Notification
*
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function callback(): void {
$this->load->model('checkout/order');
Expand Down
23 changes: 12 additions & 11 deletions catalog/model/payment/emerchantpay/base_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@
}

use DateTime;
use Genesis\API\Constants\Endpoints;
use Genesis\API\Constants\Environments;
use Genesis\API\Request\WPF\Create;
use Genesis\Api\Constants\Endpoints;
use Genesis\Api\Constants\Environments;
use Genesis\Api\Request\Wpf\Create;
use Genesis\Config;
use Genesis\Exceptions\ErrorAPI;
use Genesis\Exceptions\InvalidArgument;
use Genesis\Genesis;
use Genesis\API\Constants\Transaction\Parameters\Mobile\ApplePay\PaymentTypes as ApplePayPaymentTypes;
use Genesis\API\Constants\Transaction\Parameters\Mobile\GooglePay\PaymentTypes as GooglePayPaymentTypes;
use Genesis\API\Constants\Transaction\Parameters\Wallets\PayPal\PaymentTypes as PayPalPaymentTypes;
use Genesis\API\Constants\Transaction\States;
use Genesis\API\Constants\Transaction\Types;
use Genesis\Api\Constants\Transaction\Parameters\Mobile\ApplePay\PaymentTypes as ApplePayPaymentTypes;
use Genesis\Api\Constants\Transaction\Parameters\Mobile\GooglePay\PaymentTypes as GooglePayPaymentTypes;
use Genesis\Api\Constants\Transaction\Parameters\Wallets\PayPal\PaymentTypes as PayPalPaymentTypes;
use Genesis\Api\Constants\Transaction\States;
use Genesis\Api\Constants\Transaction\Types;
use Opencart\Extension\Emerchantpay\System\DbHelper;
use Opencart\Extension\Emerchantpay\System\EmerchantpayHelper;
use Opencart\System\Engine\Model;
Expand All @@ -46,6 +45,10 @@
* Class BaseModel
*
* @package Opencart\Catalog\Model\Extension\Emerchantpay\Payment\Emerchantpay
*
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
abstract class BaseModel extends Model
{
Expand Down Expand Up @@ -849,8 +852,6 @@ protected function sendRecurringSale($data): mixed {
$genesis->execute();

return $genesis->response()->getResponseObject();
} catch (ErrorAPI $api) {
throw $api;
} catch (\Exception $exception) {
$this->logEx($exception);

Expand Down
28 changes: 12 additions & 16 deletions catalog/model/payment/emerchantpay_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

namespace Opencart\Catalog\Model\Extension\Emerchantpay\Payment;

use Genesis\API\Constants\Endpoints;
use Genesis\API\Constants\Environments;
use Genesis\API\Constants\Payment\Methods;
use Genesis\API\Constants\Transaction\States;
use Genesis\API\Constants\Transaction\Types;
use Genesis\Api\Constants\Endpoints;
use Genesis\Api\Constants\Environments;
use Genesis\Api\Constants\Payment\Methods;
use Genesis\Api\Constants\Transaction\States;
use Genesis\Api\Constants\Transaction\Types;
use Genesis\Config;
use Genesis\Exceptions\ErrorAPI;
use Genesis\Exceptions\InvalidArgument;
use Genesis\Genesis;
use Genesis\Utils\Common as CommonUtils;
Expand All @@ -36,6 +35,8 @@
* Front-end model for the "emerchantpay Checkout" module
*
* @package EMerchantPayCheckout
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
class EmerchantpayCheckout extends BaseModel
{
Expand Down Expand Up @@ -157,13 +158,12 @@ public function getTransactionById($unique_id): mixed {
* @return mixed
*
* @throws \Exception
* @throws ErrorAPI
*/
public function create($data): mixed {
try {
$this->bootstrap();

$genesis = new Genesis('WPF\Create');
$genesis = new Genesis('Wpf\Create');

$genesis
->request()
Expand Down Expand Up @@ -216,9 +216,7 @@ public function create($data): mixed {

$this->saveWpfTokenizationData($genesis);

return $genesis->response()->getResponseObject();
} catch (ErrorAPI $api) {
throw $api;
return $genesis->response();
} catch (\Exception $exception) {
$this->logEx($exception);

Expand All @@ -234,21 +232,18 @@ public function create($data): mixed {
* @return mixed
*
* @throws \Exception
* @throws ErrorAPI
*/
public function reconcile($unique_id): mixed {
try {
$this->bootstrap();

$genesis = new Genesis('WPF\Reconcile');
$genesis = new Genesis('Wpf\Reconcile');

$genesis->request()->setUniqueId($unique_id);

$genesis->execute();

return $genesis->response()->getResponseObject();
} catch (ErrorAPI $api) {
throw $api;
} catch (\Exception $exception) {
$this->logEx($exception);

Expand Down Expand Up @@ -401,6 +396,7 @@ public function addTransactionTypesToGatewayRequest(Genesis $genesis, $order): v
* @return array
*
* @throws \Genesis\Exceptions\ErrorParameter
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function getCustomRequiredAttributes($type, $order): array {
$parameters = array();
Expand Down Expand Up @@ -484,7 +480,7 @@ public function getLanguage(): string {

$this->bootstrap();

$constant_name = '\Genesis\API\Constants\i18n::' . strtoupper($language_code);
$constant_name = '\Genesis\Api\Constants\i18n::' . strtoupper($language_code);
if (defined($constant_name) && constant($constant_name)) {
return strtolower($language_code);
}
Expand Down
19 changes: 7 additions & 12 deletions catalog/model/payment/emerchantpay_direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

namespace Opencart\Catalog\Model\Extension\Emerchantpay\Payment;

use Genesis\API\Constants\Endpoints;
use Genesis\API\Constants\Environments;
use Genesis\API\Constants\Transaction\Parameters\Threeds\V2\Control\ChallengeWindowSizes;
use Genesis\API\Constants\Transaction\Parameters\Threeds\V2\Control\DeviceTypes;
use Genesis\API\Constants\Transaction\Types;
use Genesis\Api\Constants\Endpoints;
use Genesis\Api\Constants\Environments;
use Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Control\ChallengeWindowSizes;
use Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Control\DeviceTypes;
use Genesis\Api\Constants\Transaction\Types;
use Genesis\Config;
use Genesis\Exceptions\ErrorAPI;
use Genesis\Exceptions\InvalidArgument;
use Genesis\Genesis;
use Opencart\Catalog\Model\Extension\Emerchantpay\Payment\Emerchantpay\BaseModel;
Expand Down Expand Up @@ -175,9 +174,7 @@ public function sendTransaction($data): mixed {

$genesis->execute();

return $genesis->response()->getResponseObject();
} catch (ErrorAPI $api) {
throw $api;
return $genesis->response();
} catch (\Exception $exception) {
$this->logEx($exception);

Expand All @@ -198,15 +195,13 @@ public function reconcile($unique_id): mixed {
try {
$this->bootstrap();

$genesis = new Genesis('WPF\Reconcile');
$genesis = new Genesis('Wpf\Reconcile');

$genesis->request()->setUniqueId($unique_id);

$genesis->execute();

return $genesis->response()->getResponseObject();
} catch (ErrorAPI $api) {
throw $api;
} catch (\Exception $exception) {
$this->logEx($exception);

Expand Down
6 changes: 3 additions & 3 deletions catalog/view/javascript/emerchantpay/card.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "emerchantpay Gateway Module for OpenCart",
"type": "opencart-module",
"license": "GPL-2.0",
"version": "1.1.5",
"version": "1.1.6",
"authors": [
{
"name": "emerchantpay",
Expand Down
2 changes: 1 addition & 1 deletion install.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "emerchantpay Payments",
"version": "1.1.5",
"version": "1.1.6",
"author": "emerchantpay Ltd.",
"link": "https://emerchantpay.com"
}
12 changes: 9 additions & 3 deletions system/admin/base_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
}

use Exception;
use Genesis\API\Constants\Transaction\Parameters\ScaExemptions;
use Genesis\API\Constants\Transaction\States;
use Genesis\API\Constants\Transaction\Types;
use Genesis\Api\Constants\Transaction\Parameters\ScaExemptions;
use Genesis\Api\Constants\Transaction\States;
use Genesis\Api\Constants\Transaction\Types;
use Opencart\Extension\Emerchantpay\System\Catalog\SettingsHelper;
use Opencart\Extension\Emerchantpay\System\Catalog\ThreedsHelper;
use Opencart\Extension\Emerchantpay\System\EmerchantpayHelper;
Expand All @@ -36,6 +36,11 @@
* Base Abstract Class for Method Admin Controllers
*
* Class BaseController
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings(PHPMD.ExcessiveClassLength)
*/
abstract class BaseController extends Controller
{
Expand Down Expand Up @@ -159,6 +164,7 @@ public function getTokenParam(): string {
* Get transactions list
*
* @return mixed
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function order() {
if ($this->config->get("{$this->module_name}_status")) {
Expand Down
Loading

0 comments on commit 93d4982

Please sign in to comment.