Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/PLUG-3145
Browse files Browse the repository at this point in the history
# Conflicts:
#	upload/admin/language/de-de/extension/payment/paynl3.php
#	upload/admin/language/fr-fr/extension/payment/paynl3.php
#	upload/admin/view/template/extension/payment/paynl3.twig
  • Loading branch information
woutse committed Feb 19, 2024
2 parents 9b1198f + 69c3394 commit b989761
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 36 deletions.
6 changes: 3 additions & 3 deletions upload/Pay/Controller/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public function index()
'payment_paynl_general_gateway' => trim($settings['payment_paynl_general_gateway']),
'payment_paynl_general_prefix' => $settings['payment_paynl_general_prefix'],
'payment_paynl_general_refund_processing' => $settings['payment_paynl_general_refund_processing'],
'payment_paynl_general_follow_payment_method' => $settings['payment_paynl_general_follow_payment_method'],
'payment_paynl_general_display_icon' => $settings['payment_paynl_general_display_icon'],
'payment_paynl_general_icon_style' => $settings['payment_paynl_general_icon_style'],
'payment_paynl_general_custom_exchange_url' => $settings['payment_paynl_general_custom_exchange_url'],
'payment_paynl_general_test_ip' => $settings['payment_paynl_general_test_ip'],
'payment_paynl_general_logging' => $settings['payment_paynl_general_logging'],
Expand Down Expand Up @@ -114,7 +114,7 @@ public function index()
$data['gateway'] = $this->configGet('gateway');
$data['prefix'] = $this->configGet('prefix');
$data['refund_processing'] = $this->configGet('refund_processing');
$data['icon_style'] = $this->configGet('icon_style');
$data['follow_payment_method'] = $this->configGet('follow_payment_method');
$data['custom_exchange_url'] = $this->configGet('custom_exchange_url');
$data['test_ip'] = $this->configGet('test_ip');
$data['logging'] = $this->configGet('logging');
Expand Down Expand Up @@ -277,8 +277,8 @@ public function install()
'payment_paynl_general_gateway' => $this->config->get('payment_paynl_general_gateway'),
'payment_paynl_general_prefix' => 'Order ',
'payment_paynl_general_refund_processing' => $this->config->get('payment_paynl_general_refund_processing'),
'payment_paynl_general_follow_payment_method' => 1,
'payment_paynl_general_display_icon' => $this->config->get('payment_paynl_general_display_icon'),
'payment_paynl_general_icon_style' => $this->config->get('payment_paynl_general_icon_style'),
'payment_paynl_general_custom_exchange_url' => $this->config->get('payment_paynl_general_custom_exchange_url'),
'payment_paynl_general_test_ip' => $this->config->get('payment_paynl_general_test_ip'),
'payment_paynl_general_logging' => $this->config->get('payment_paynl_general_logging')
Expand Down
4 changes: 2 additions & 2 deletions upload/Pay/Controller/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ public function startTransaction()

$apiStart->setDescription($description);
$apiStart->setExtra1($order_info['order_id']);
$apiStart->setObject('opencart3 1.9.0');
$apiStart->setObject('opencart3 1.9.1');


// Klantdata verzamelen en meesturen
# Collect customer data
$strAddress = $order_info['shipping_address_1'] . ' ' . $order_info['shipping_address_2'];
list($street, $housenumber) = Pay_Helper::splitAddress($strAddress);
$arrShippingAddress = array(
Expand Down
38 changes: 35 additions & 3 deletions upload/Pay/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,24 @@ public function updateTransactionStatus($transactionId, $status)
return $this->db->query($sql);
}

/**
* @param $orderId
* @return string
*/
private function getCustomerGroupId($orderId)
{
$sql = "SELECT `customer_group_id` FROM `" . DB_PREFIX . "order` WHERE order_Id = '" . $this->db->escape($orderId) . "';";
$result = $this->db->query($sql);

$rows = $result->rows;

$result = '';
foreach ($rows as $row) {
$result = $row['customer_group_id'];
}
return $result;
}

/**
* @param string $key
* @param string $pm
Expand Down Expand Up @@ -332,10 +350,8 @@ public function getMethod($address = false, $orderAmount = false)
$icon = "";
if ($this->config->get('payment_paynl_general_display_icon') != '') {
$iconSize = $this->config->get('payment_paynl_general_display_icon') ;
$iconStyle = $this->config->get('payment_paynl_general_icon_style') ;
$icon = "<img class='paynl_icon' src=\"https://static.pay.nl/payment_profiles/$iconSize/$this->_paymentOptionId.png\"> ";

if ($iconStyle == 'newest' && !empty($paymentOptions['brand_id'])) {
if (!empty($paymentOptions['brand_id'])) {
$style = ' style="width:50px; height:50px;"';
switch ($iconSize) {
case '20x20':
Expand Down Expand Up @@ -425,6 +441,22 @@ public function processTransaction($transactionId)
# Order update
$order_info = $this->model_checkout_order->getOrder($transaction['orderId']);

if ($this->_paymentOptionId != $result['paymentDetails']['paymentOptionId'] && $this->config->get('payment_paynl_general_follow_payment_method') !== '0') {
$newPaymentMethod = $result['paymentDetails']['payment_profile_name'];
$oldPaymentMethod = $order_info['payment_method'];
$orderId = $transaction['orderId'];
$followPaymentMessage = "Pay. Updated payment method from " . $oldPaymentMethod . " to " . $newPaymentMethod . ".";

$order_info['customer_group_id'] = $this->getCustomerGroupId($orderId);
$order_info['payment_method'] = $newPaymentMethod;

if (!empty($order_info['customer_group_id'])) {
$this->model_checkout_order->editOrder($orderId, $order_info);
$this->log('addOrderHistory: ' . print_r(array($order_info['order_id'], $orderStatusId, $followPaymentMessage), true));
$this->model_checkout_order->addOrderHistory($order_info['order_id'], $orderStatusId, $followPaymentMessage, false);
}
}

if ($order_info['payment_code'] != $this->_paymentMethodName && $status == self::STATUS_CANCELED) {
return 'Not cancelling because the last used method is not this method';
}
Expand Down
2 changes: 2 additions & 0 deletions upload/admin/language/de-de/extension/payment/paynl3.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
$_['text_prefix'] = 'Präfix der Bestellbeschreibung';
$_['text_prefix_tooltip'] = 'Ändern Sie hier das Präfix der Bestellbeschreibung. Wenn dieses Feld leer ist, ist die Beschreibung die Bestellnummer.';

$_['text_follow_payment_method'] = 'Follow payment method';
$_['text_follow_payment_method_tooltip'] = 'Dadurch wird sichergestellt, dass die Bestellung mit der tatsächlichen Zahlungsmethode aktualisiert wird, die zum Abschluss der Bestellung verwendet wurde. Diese kann von der ursprünglich gewählten Zahlungsart abweichen'; // phpcs:ignore
$_['text_advanced_settings'] = 'Erweiterte Einstellungen';

$_['text_coc'] = 'Feld mit der Nummer der Handelskammer anzeigen';
Expand Down
10 changes: 4 additions & 6 deletions upload/admin/language/en-gb/extension/payment/paynl3.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
$_['text_refund_processing'] = 'Refund processing';
$_['text_refund_processing_tooltip'] = 'Process refunds that are initiated in My.pay';

$_['text_follow_payment_method'] = 'Follow payment method';
$_['text_follow_payment_method_tooltip'] = 'This will ensure the order is updated with the actual payment method used to complete the order. This can differ from the payment method initially selected'; // phpcs:ignore

$_['text_coc'] = 'Show COC number field';
$_['text_coc_tooltip'] = 'When enabled the customer can additionally enter their COC number before finishing the transaction';
$_['text_coc_disabled'] = 'No';
Expand All @@ -67,11 +70,6 @@
$_['text_display_icon'] = 'Display icon';
$_['text_display_icon_tooltip'] = 'Select if you want to display an icon and the size';

$_['text_icon_style'] = 'Icon style';
$_['text_icon_style_tooltip'] = 'Select whether you want to use the classic or newest images during checkout.';
$_['text_classic'] = 'Classic';
$_['text_newest'] = 'Newest';

$_['text_custom_exchange_url'] = 'Alternatieve Exchange URL';
$_['text_custom_exchange_url_tooltip'] = 'Use your own exchange-handler. Requests will be send as GET.<br/>
Example: https://www.yourdomain.nl/exchange_handler?action=#action#&order_id=#order_id#';
Expand Down Expand Up @@ -129,7 +127,7 @@
$_['text_suggestions_success_modal'] = 'Sent! Thank you for your contribution.';
$_['text_suggestions_fail_modal'] = 'E-mail could not be sent, please try again later.';

$version = '1.9.0';
$version = '1.9.1';
$_['version'] = $version;
$css = 'position: relative;top:0px;display: inline;left: 10px;';
$paynl_logo = '<a href="https://www.pay.nl" target="paynl"><img style="width: 30px;"
Expand Down
7 changes: 2 additions & 5 deletions upload/admin/language/fr-fr/extension/payment/paynl3.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
$_['text_prefix'] = 'Préfixe de description de la commande';
$_['text_prefix_tooltip'] = 'Modifiez le préfixe de description de la commande ici. Si elle est laissée vide, la description de la commande sera simplement le numéro de commande.';

$_['text_follow_payment_method'] = 'Follow payment method';
$_['text_follow_payment_method_tooltip'] = 'Cela garantira que la commande est mise à jour avec le mode de paiement réel utilisé pour finaliser la commande. Celui-ci peut différer du mode de paiement initialement sélectionné'; // phpcs:ignore
$_['text_advanced_settings'] = 'Réglages avancés';

$_['text_coc'] = 'Afficher le champ du numéro de la Chambre de Commerce';
Expand All @@ -64,11 +66,6 @@
$_['text_display_icon'] = 'Icône d\'affichage';
$_['text_display_icon_tooltip'] = 'Sélectionnez si vous souhaitez afficher une icône et la taille';

$_['text_icon_style'] = 'Style d\'icône';
$_['text_icon_style_tooltip'] = 'Choisissez si vous souhaitez utiliser les images classiques ou les plus récentes lors du paiement.';
$_['text_classic'] = 'Classique';
$_['text_newest'] = 'Le plus récent';

$_['text_custom_exchange_url'] = 'URL d\'échange alternative';
$_['text_custom_exchange_url_tooltip'] = 'Utilisez votre propre gestionnaire d\'échange. Les demandes seront envoyées sous forme de GET.<br/>
Exemple: https://www.yourdomain.nl/exchange_handler?action=#action#&order_id=#order_id#';
Expand Down
10 changes: 4 additions & 6 deletions upload/admin/language/nl-nl/extension/payment/paynl3.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
$_['text_refund_processing'] = 'Verwerking terugbetaling';
$_['text_refund_processing_tooltip'] = 'Verwerk terugbetalingen die gestart zijn vanuit Pay.';

$_['text_follow_payment_method'] = 'Follow payment method';
$_['text_follow_payment_method_tooltip'] = 'Dit zorgt ervoor dat de bestelling wordt bijgewerkt met de daadwerkelijke betaalmethode die is gebruikt om de bestelling te voltooien. Dit kan afwijken van de aanvankelijk gekozen betaalmethode'; // phpcs:ignore

$_['text_coc'] = 'Toon KVK nummer veld';
$_['text_coc_tooltip'] = 'Wanneer dit aan staat zal de klant een optie hebben om hun KVK nummer in te voeren voordat ze de transactie afmaken';
$_['text_coc_disabled'] = 'nee';
Expand All @@ -67,11 +70,6 @@
$_['text_display_icon'] = 'Icoon weergeven';
$_['text_display_icon_tooltip'] = 'Selecteer hier of je een icoon wilt weergeven en welke grootte.';

$_['text_icon_style'] = 'Icoon stijl';
$_['text_icon_style_tooltip'] = 'Selecteer hier of u de klassieke of de nieuwste afbeeldingen wilt gebruiken.';
$_['text_classic'] = 'Klassiek';
$_['text_newest'] = 'Nieuwste';

$_['text_custom_exchange_url'] = 'Alternatieve Exchange URL';
$_['text_custom_exchange_url_tooltip'] = 'Gebruik je eigen exchange-handler. Requests zullen verzonden worden al een GET.<br/>
Voorbeeld: https://www.yourdomain.nl/exchange_handler?action=#action#&order_id=#order_id#';
Expand Down Expand Up @@ -129,7 +127,7 @@
$_['text_suggestions_success_modal'] = 'Verstuurd! Bedankt voor het delen van jouw input.';
$_['text_suggestions_fail_modal'] = 'E-mail kon niet worden verzonden. Probeer het later opnieuw.';

$version = '1.9.0';
$version = '1.9.1';
$_['version'] = $version;
$css = 'position: relative;top:0px;display: inline;left: 10px;';
$paynl_logo = '<a href="https://www.pay.nl" target="paynl"><img style="width: 30px;"
Expand Down
30 changes: 19 additions & 11 deletions upload/admin/view/template/extension/payment/paynl3.twig
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,25 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"
for="payment_paynl_general_follow_payment_method">
<span data-toggle="tooltip" title="{{ text_follow_payment_method_tooltip }}">
{{ text_follow_payment_method }}
</span></label>
<div class="col-sm-10">
<select name="payment_paynl_general_follow_payment_method"
id="payment_paynl_general_follow_payment_method" class="form-control">
{% if follow_payment_method %}
<option value="1" selected="selected">{{ text_enabled }}</option>
<option value="0">{{ text_disabled }}</option>
{% else %}
<option value="1">{{ text_enabled }}</option>
<option value="0" selected="selected">{{ text_disabled }}</option>
{% endif %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="payment_paynl_general_display_icon">
<span data-toggle="tooltip" title="{{ text_display_icon_tooltip }}">{{ text_display_icon }}</span>
Expand All @@ -150,17 +169,6 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="payment_paynl_general_icon_style">
<span data-toggle="tooltip" title="{{ text_icon_style_tooltip }}">{{ text_icon_style }}</span>
</label>
<div class="col-sm-10">
<select class="form-control" name="payment_paynl_general_icon_style">
<option value="classic" {{ icon_style == 'classic' ? 'selected="selected"': '' }}>{{ text_classic }}</option>
<option value="newest" {{ icon_style == 'newest' ? 'selected="selected"': '' }}>{{ text_newest }}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="payment_paynl_general_custom_exchange_url">
<span data-toggle="tooltip" title="{{ text_custom_exchange_url_tooltip }}">{{ text_custom_exchange_url }}</span>
Expand Down
Binary file modified upload/image/Pay/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added upload/image/Pay/149.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified upload/image/Pay/176.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified upload/image/Pay/20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added upload/image/Pay/255.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added upload/image/Pay/291.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified upload/image/Pay/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b989761

Please sign in to comment.