Skip to content

Commit

Permalink
Merge branch 'master' into Feature/PLUG-256
Browse files Browse the repository at this point in the history
  • Loading branch information
woutse authored Jan 18, 2021
2 parents 5146659 + 7b1fc36 commit 1f0ce4d
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 344 deletions.
27 changes: 22 additions & 5 deletions Controller/Checkout/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ public function execute()
\Paynl\Config::setApiToken($this->config->getApiToken());

$params = $this->getRequest()->getParams();
$action = !empty($params['action']) ? strtolower($params['action']) : '';

if ($action == 'pending') {
return $this->result->setContents('TRUE| Ignore pending');
}

if (!isset($params['order_id'])) {
$this->logger->critical('Exchange: order_id is not set in the request', $params);

Expand All @@ -136,7 +142,7 @@ public function execute()
}

if ($transaction->isPending()) {
if (isset($params['action']) && $params['action'] == 'new_ppt') {
if ($action == 'new_ppt') {
return $this->result->setContents("FALSE| Payment is pending");
}
return $this->result->setContents("TRUE| Ignoring pending");
Expand All @@ -152,16 +158,27 @@ public function execute()
return $this->result->setContents('FALSE| Cannot load order');
}
if ($order->getTotalDue() <= 0) {
$this->logger->debug('Total due <= 0, so iam not touching the status of the order: ' . $orderEntityId);
$this->logger->debug('Total due <= 0, so not touching the status of the order: ' . $orderEntityId);

return $this->result->setContents('TRUE| Total due <= 0, so iam not touching the status of the order');
return $this->result->setContents('TRUE| Ignoring: order has already been paid');
}
if ($action == 'capture') {
$payment = $order->getPayment();
if(!empty($payment) && $payment->getAdditionalInformation('manual_capture')){
$this->logger->debug('Already captured.');

return $this->result->setContents('TRUE| Already captured.');
}
}

if ($transaction->isPaid() || $transaction->isAuthorized()) {
return $this->processPaidOrder($transaction, $order);

} elseif ($transaction->isCanceled()) {
return $this->cancelOrder($order);
if ($order->isCanceled()) {
return $this->result->setContents("TRUE| ALLREADY CANCELED");
} else {
return $this->cancelOrder($order);
}
}

}
Expand Down
8 changes: 5 additions & 3 deletions Controller/Checkout/Finish.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,16 @@ public function execute()
return $resultRedirect;
}

$this->messageManager->addNoticeMessage(__('Payment canceled'));

$orderStatus = empty($params['orderStatusId']) ? null : $params['orderStatusId'];
$cancelMessage = $orderStatus == -63 ? __('Payment denied') : __('Payment canceled');
$this->messageManager->addNoticeMessage($cancelMessage);

if ($payment->getMethod() == 'paynl_payment_paylink') {
$cancelURL = Config::FINISH_PAYLINK . '?cancel=1';
} else {
$cancelURL = $this->config->getCancelURL();
}

$resultRedirect->setPath($cancelURL);


Expand Down
4 changes: 4 additions & 0 deletions Model/Paymentmethod/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ public function capture(InfoInterface $payment, $amount)
{
$this->paynlConfig->configureSDK();

$payment->setAdditionalInformation('manual_capture', 'true');
$order = $payment->getOrder();
$order->save();

$transactionId = $payment->getParentTransactionId();

Transaction::capture($transactionId);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "paynl/magento2-plugin",
"description": "PAY. Magento2 Payment methods",
"type": "magento2-module",
"version": "1.6.8",
"version": "1.6.9",
"require": {
"magento/module-sales": "100 - 103",
"magento/module-payment": "100 - 103",
Expand Down
54 changes: 53 additions & 1 deletion etc/adminhtml/paymentmethods/creditclick.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,59 @@
<field id="active">1</field>
</depends>
</field>
<field id="disallowedshipping" translate="label" type="multiselect" sortOrder="110" showInDefault="1"
<field id="instructions" translate="label" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Instructions</label>
<depends>
<field id="active">1</field>
</depends>
<config_path>payment/paynl_payment_creditclick/instructions</config_path>
</field>
<field id="min_order_total" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Minimum Order Total</label>
<config_path>payment/paynl_payment_creditclick/min_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="max_order_total" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Maximum Order Total</label>
<config_path>payment/paynl_payment_creditclick/max_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/paynl_payment_creditclick/sort_order</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="70" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<config_path>payment/paynl_payment_creditclick/allowspecific</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="80" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
<config_path>payment/paynl_payment_creditclick/specificcountry</config_path>
<depends>
<field id="allowspecific">1</field>
<field id="active">1</field>
</depends>
</field>
<field id="disallowedshipping" translate="label" type="multiselect" sortOrder="90" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Disallowed Shipping Methods</label>
<source_model>Magento\Shipping\Model\Config\Source\Allmethods</source_model>
Expand Down
1 change: 1 addition & 0 deletions i18n/nl_NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"Invalid return, no transactionId specified","Ongeldige return, geen transactieId meegegeven"
"There was an error checking the transaction status","Fout bij het controleren van de transactie status"
"Payment canceled","Betaling geannuleerd"
"Payment denied","Betaling afgewezen"
"Something went wrong, please try again later","Er is iet mis gegaan, probeer het later nogmaals"
"Enter your API-token and ServiceId first","Voer eerst je API-token en Service Id in"
"No","Nee"
Expand Down
14 changes: 6 additions & 8 deletions view/frontend/web/js/view/payment/method-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ define(
rendererList) {
'use strict';

var defaultComponent = 'Paynl_Payment/js/view/payment/method-renderer/default';
var idealComponent = 'Paynl_Payment/js/view/payment/method-renderer/ideal';
var billinkComponent = 'Paynl_Payment/js/view/payment/method-renderer/billink';
var defaultComponent = 'Paynl_Payment/js/view/payment/method-renderer/default';

var methods = [
{type: 'paynl_payment_afterpay', component: defaultComponent},
{type: 'paynl_payment_alipay', component: defaultComponent},
{type: 'paynl_payment_amex', component: defaultComponent},
{type: 'paynl_payment_billink', component: billinkComponent},
{type: 'paynl_payment_billink', component: defaultComponent},
{type: 'paynl_payment_capayable', component: defaultComponent},
{type: 'paynl_payment_capayable_gespreid', component: defaultComponent},
{type: 'paynl_payment_cartasi', component: defaultComponent},
Expand All @@ -35,10 +33,10 @@ define(
{type: 'paynl_payment_giropay', component: defaultComponent},
{type: 'paynl_payment_givacard', component: defaultComponent},
{type: 'paynl_payment_huisentuincadeau', component: defaultComponent},
{type: 'paynl_payment_ideal', component: idealComponent},
{type: 'paynl_payment_instore', component: idealComponent},
{type: 'paynl_payment_klarna', component: idealComponent},
{type: 'paynl_payment_klarnakp', component: idealComponent},
{type: 'paynl_payment_ideal', component: defaultComponent},
{type: 'paynl_payment_instore', component: defaultComponent},
{type: 'paynl_payment_klarna', component: defaultComponent},
{type: 'paynl_payment_klarnakp', component: defaultComponent},
{type: 'paynl_payment_maestro', component: defaultComponent},
{type: 'paynl_payment_mistercash', component: defaultComponent},
{type: 'paynl_payment_multibanco', component: defaultComponent},
Expand Down
145 changes: 0 additions & 145 deletions view/frontend/web/js/view/payment/method-renderer/billink.js

This file was deleted.

Loading

0 comments on commit 1f0ce4d

Please sign in to comment.