Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opencart2.0-payfort #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions upload/admin/controller/payment/payfort_fort.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ public function index() {
$data['entry_naps'] = $this->language->get('entry_naps');
$data['entry_credit_card'] = $this->language->get('entry_credit_card');
$data['entry_cc_integration_type'] = $this->language->get('entry_cc_integration_type');
$data['entry_cc_mada_branding'] = $this->language->get('entry_cc_mada_branding');
$data['entry_installments_integration_type'] = $this->language->get('entry_installments_integration_type');
$data['help_cc_integration_type'] = $this->language->get('help_cc_integration_type');
$data['help_cc_mada_branding'] = $this->language->get('help_cc_mada_branding');
$data['help_installments_integration_type'] = $this->language->get('help_installments_integration_type');
$data['text_merchant_page'] = $this->language->get('text_merchant_page');
$data['text_merchant_page2'] = $this->language->get('text_merchant_page2');
Expand All @@ -100,6 +102,8 @@ public function index() {
$data['text_front_currency'] = $this->language->get('text_front_currency');
$data['help_gateway_currency'] = $this->language->get('help_gateway_currency');
$data['text_store_language'] = $this->language->get('text_store_language');
$data['text_cc_with_mada'] = $this->language->get('text_cc_with_mada');


$data['button_save'] = $this->language->get('button_save');
$data['button_cancel'] = $this->language->get('button_cancel');
Expand Down Expand Up @@ -281,6 +285,12 @@ public function index() {
$data['payfort_fort_cc_integration_type'] = $this->config->get('payfort_fort_cc_integration_type');
}

if (isset($this->request->post['payfort_fort_cc_mada_branding'])) {
$data['payfort_fort_cc_mada_branding'] = $this->request->post['payfort_fort_cc_mada_branding'];
} else {
$data['payfort_fort_cc_mada_branding'] = $this->config->get('payfort_fort_cc_mada_branding');
}

if (isset($this->request->post['payfort_fort_status'])) {
$data['payfort_fort_status'] = $this->request->post['payfort_fort_status'];
} else {
Expand Down
3 changes: 3 additions & 0 deletions upload/admin/language/arabic/payment/payfort_fort.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$_['text_merchant_page2'] = 'Merchant Page 2.0';
$_['text_store_language'] = 'Store Language';


$_['entry_merchant_identifier'] = 'معرف التاجر';
$_['entry_purchase'] = 'شراء';
$_['entry_authorization'] = 'تخويل';
Expand All @@ -38,12 +39,14 @@
$_['entry_request_sha_phrase'] = 'عبارة طلب تشفير (SHA)';
$_['entry_response_sha_phrase'] = 'عبارة رد تشفير (SHA)';
$_['entry_cc_integration_type'] = 'Integration Type';
$_['entry_cc_mada_branding'] = 'mada option';
$_['entry_installments_integration_type'] = 'Integration Type';
$_['entry_debug'] = 'Debug mode:';
$_['entry_gateway_currency'] = 'Gateway Currency';
$_['text_base_currency'] = 'Base Currency';
$_['text_front_currency'] = 'Front Currency';
$_['help_gateway_currency'] = 'The Currency should be sent to payment gateway.';
$_['help_cc_mada_branding'] = 'تفعيل بطاقة مدى البنكية في المتجر';

$_['entry_order_placement'] = 'Order Placement';
$_['text_on_success'] = 'On Success';
Expand Down
3 changes: 3 additions & 0 deletions upload/admin/language/english/payment/payfort_fort.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@
$_['entry_request_sha_phrase'] = 'Request SHA Phrase';
$_['entry_response_sha_phrase'] = 'Response SHA Phrase';
$_['entry_cc_integration_type'] = 'Integration Type';
$_['entry_cc_mada_branding'] = 'Mada option';
$_['entry_installments_integration_type'] = 'Integration Type';
$_['entry_debug'] = 'Debug mode:';
$_['entry_gateway_currency'] = 'Gateway Currency';
$_['text_base_currency'] = 'Base Currency';
$_['text_front_currency'] = 'Front Currency';
$_['help_gateway_currency'] = 'The Currency should be sent to payment gateway.';
$_['help_cc_mada_branding'] = 'Enables mada bank card in store view';


$_['entry_order_placement'] = 'Order Placement';
$_['text_on_success'] = 'On Success';
Expand Down
11 changes: 11 additions & 0 deletions upload/admin/view/template/payment/payfort_fort.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@
</select>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label" for="input-cc-mada-option"><span data-toggle="tooltip" title="<?php echo $help_cc_mada_branding; ?>"><?php echo $entry_cc_mada_branding ?></span></label>
<div class="col-sm-10">
<select name="payfort_fort_cc_mada_branding" id="input-cc-mada-branding" class="form-control">
<option value="Disabled" <?php echo ($payfort_fort_cc_mada_branding == 'Disabled') ? 'selected="selected"' : '' ?>><?php echo $text_disabled; ?></option>
<option value="Enabled" <?php echo ($payfort_fort_cc_mada_branding == 'Enabled') ? 'selected="selected"' : '' ?>><?php echo $text_enabled; ?></option>
</select>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label" for=""><?php echo $entry_sort_order; ?></label>
<div class="col-sm-10">
Expand Down
15 changes: 14 additions & 1 deletion upload/catalog/controller/payment/payfort_fort.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ControllerPaymentPayfortFort extends Controller {
public $pfPayment;
public $pfHelper;
public $pfOrder;
public $madaBranding;

public function __construct($registry)
{
Expand All @@ -19,6 +20,7 @@ public function __construct($registry)
$this->pfHelper = Payfort_Fort_Helper::getInstance($registry);
$this->pfOrder = new Payfort_Fort_Order($registry);
$this->integrationType = $this->pfConfig->getCcIntegrationType();
$this->madaBranding = $this->pfConfig->getCcMadaBranding();
$this->paymentMethod = PAYFORT_FORT_PAYMENT_METHOD_CC;
}

Expand All @@ -33,7 +35,17 @@ public function index() {

//$this->load->model('setting/setting');
$data['payfort_fort_cc_integration_type'] = $this->integrationType;

$frontCurrency = $this->pfHelper->getFrontCurrency();
$baseCurrency = $this->pfHelper->getBaseCurrency();
$currency = $this->pfHelper->getFortCurrency($baseCurrency, $frontCurrency);
if ($currency == 'SAR') {
$data['payfort_fort_cc_mada_branding'] = $this->madaBranding;
}
else
{
$data['payfort_fort_cc_mada_branding'] = 'Disabled';
}

$this->load->model('payment/payfort_fort');
$data['payment_request_params'] = '';
$template = 'payfort_fort.tpl';
Expand All @@ -47,6 +59,7 @@ public function index() {
$data['payment_request_params'] = $this->pfPayment->getPaymentRequestParams($this->paymentMethod, $this->integrationType);

$data['text_credit_card'] = $this->language->get('text_credit_card');
$data['text_cc_with_mada'] = $this->language->get('text_cc_with_mada');
$data['text_card_holder_name'] = $this->language->get('text_card_holder_name');
$data['text_card_number'] = $this->language->get('text_card_number');
$data['text_expiry_date'] = $this->language->get('text_expiry_date');
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/language/arabic/payment/payfort_fort.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$_['text_title'] = 'بطاقة ائتمان';
$_['text_wait'] = 'يرجى الانتظار';
$_['text_credit_card'] = 'تفاصيل بطاقة الائتمان';
$_['text_cc_with_mada'] = 'بطاقة الائتمان / بطاقة مدى البنكية';
$_['text_loading'] = 'جاري التحميل';
$_['heading_failed_title'] = 'فشلت عملية الدفع!';
$_['heading_success_title'] = 'تمت عملية الدفع بنجاح';
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/language/english/payment/payfort_fort.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$_['text_title'] = 'Credit / Debit Card';
$_['text_wait'] = 'Please wait!';
$_['text_credit_card'] = 'Credit Card Details';
$_['text_cc_with_mada'] = 'Credit Card / mada Bank Card Details';
$_['text_loading'] = 'Loading';
$_['heading_failed_title'] = 'Payment Failed!';
$_['heading_success_title'] = 'Your Order Has Been Processed!';
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@
<?php foreach ($payment_request_params['params'] as $k => $v): ?>
<input type="hidden" name="<?php echo $k?>" value="<?php echo $v?>">
<?php endforeach; ?>
<legend><?php echo $text_credit_card; ?></legend>
<legend><?php if ($payfort_fort_cc_mada_branding=='Enabled') echo $text_cc_with_mada;else echo $text_credit_card; ?></legend>



<div class="form-group">
<label class="col-sm-2 control-label" for="payfort_fort_card_holder_name"></label>
<div class="col-sm-10">
<?php if ($payfort_fort_cc_mada_branding=='Enabled') { ?>
<img src="catalog/view/theme/default/image/payfort_mada.jpeg" alt="mada" height="26" width="50"/>
<?php } ?>
<img src="catalog/view/theme/default/image/payfort_visa.png" alt="visa" height="26" width="42"/>
<img src="catalog/view/theme/default/image/payfort_mastercard.jpeg" alt="mc" height="26" width="42"/>
</div>
</div>



<div class="form-group">
<label class="col-sm-2 control-label" for="payfort_fort_card_holder_name"><?php echo $text_card_holder_name; ?></label>
<div class="col-sm-10">
Expand Down
9 changes: 8 additions & 1 deletion upload/system/library/payfortFort/classes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Payfort_Fort_Config
private $status;
private $ccStatus;
private $ccIntegrationType;
private $ccMadaBranding;
private $sadadStatus;
private $napsStatus;
private $gatewayProdHost;
Expand Down Expand Up @@ -62,9 +63,10 @@ public function __construct($registry)
$this->debugMode = $this->_getShoppingCartConfig('debug');
$this->successOrderStatusId = $this->_getShoppingCartConfig('order_status_id');
$this->orderPlacement = $this->_getShoppingCartConfig('order_placement');
$this->status = $this->_getShoppingCartConfig('status');
$this->status = $this->_getShoppingCartConfig('status');
$this->ccStatus = $this->_getShoppingCartConfig('credit_card');
$this->ccIntegrationType = $this->_getShoppingCartConfig('cc_integration_type');
$this->ccMadaBranding = $this->_getShoppingCartConfig('cc_mada_branding');
$this->sadadStatus = $this->_getShoppingCartConfig('sadad');
$this->napsStatus = $this->_getShoppingCartConfig('naps');
// installments
Expand Down Expand Up @@ -224,6 +226,11 @@ public function getCcIntegrationType()
return $this->ccIntegrationType;
}

public function getCcMadaBranding()
{
return $this->ccMadaBranding;
}

public function isCcMerchantPage()
{
if ($this->ccIntegrationType == PAYFORT_FORT_INTEGRATION_TYPE_MERCAHNT_PAGE) {
Expand Down