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

Add ability to change the status of an order according to the 3DS protocol #19

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
30 changes: 29 additions & 1 deletion app/code/community/Quadra/Cybermut/Controller/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,31 @@ public function notifyAction()
$returnedMAC = $postData['MAC'];
$correctMAC = $model->getResponseMAC($postData);

$returned3DSStatus = (int) $postData['status3ds'];
switch ($returned3DSStatus) {
// la transaction ne s'est pas faite selon le protocole 3DSecure
case -1:
default:
$orderStatusPaymentAccepted = 'order_status_payment_accepted_no_3ds';
break;
// la transaction s'est faite selon le protocole 3DS et le niveau de risque est faible
case 1:
$orderStatusPaymentAccepted = 'order_status_payment_accepted_3ds_low_risk';
break;
// la transaction ne peut se faire selon le protocole 3DSecure, le porteur a cependant été authentifié par le biais de 3DSecure
case 2:
$orderStatusPaymentAccepted = 'order_status_payment_accepted_no_3ds_but_user_authentified';
break;
// la transaction s'est faite selon le protocole 3DS et le niveau de risque est élevé
case 3:
$orderStatusPaymentAccepted = 'order_status_payment_accepted_3ds_high_risk';
break;
// la transaction s'est faite selon le protocole 3DS et le niveau de risque est très élevé
case 4:
$orderStatusPaymentAccepted = 'order_status_payment_accepted_3ds_very_high_risk';
break;
}

foreach ($this->getRealOrderIds() as $realOrderId) {
$order = Mage::getModel('sales/order')->loadByIncrementId($realOrderId);

Expand All @@ -176,7 +201,10 @@ public function notifyAction()
$order->unhold();
}

if (!$status = $model->getConfigData('order_status_payment_accepted')) {
if (!$status = $model->getConfigData($orderStatusPaymentAccepted)) {
$status = $model->getConfigData('order_status_payment_accepted');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For compatibility purpose

}
if (!$status) {
$status = $order->getStatus();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* 1997-2016 Quadra Informatique
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0) that is available
* through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author Quadra Informatique
* @copyright 1997-2016 Quadra Informatique
* @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
class Quadra_Cybermut_Model_System_Config_Source_Order_Status_Accepted_3DSRisky extends Quadra_Cybermut_Model_System_Config_Source_Order_Status
{

// set null to enable all possible
protected $_stateStatuses = array(
Mage_Sales_Model_Order::STATE_NEW,
Mage_Sales_Model_Order::STATE_PROCESSING,
Mage_Sales_Model_Order::STATE_COMPLETE,
Mage_Sales_Model_Order::STATE_HOLDED,
Mage_Sales_Model_Order::STATE_CANCELED
);

}
48 changes: 42 additions & 6 deletions app/code/community/Quadra/Cybermut/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,56 @@
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status>
<order_status_payment_accepted translate="label">
<label>Order status when payment accepted by Cybermut</label>
<order_status_payment_accepted_no_3ds translate="label">
<label>Order status when payment accepted by Cybermut but the transaction was not done according to the 3DSecure protocol</label>
<frontend_type>select</frontend_type>
<source_model>cybermut/system_config_source_order_status_accepted_3dsrisky</source_model>
<sort_order>122</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status_payment_accepted_no_3ds>
<order_status_payment_accepted_3ds_low_risk translate="label">
<label>Order status when payment accepted by Cybermut, the transaction was done according 3DS protocol and the level of risk is low</label>
<frontend_type>select</frontend_type>
<source_model>cybermut/system_config_source_order_status_accepted</source_model>
<sort_order>121</sort_order>
<sort_order>123</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status_payment_accepted>
</order_status_payment_accepted_3ds_low_risk>
<order_status_payment_accepted_no_3ds_but_user_authentified translate="label">
<label>Order status when payment accepted by Cybermut, the transaction can not be done according to the 3DSecure protocol, the carrier has however been authenticated through 3DSecure</label>
<frontend_type>select</frontend_type>
<source_model>cybermut/system_config_source_order_status_accepted_3dsrisky</source_model>
<sort_order>124</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status_payment_accepted_no_3ds_but_user_authentified>
<order_status_payment_accepted_3ds_high_risk translate="label">
<label>Order status when payment accepted by Cybermut, the transaction was done according 3DS protocol and the level of risk is high</label>
<frontend_type>select</frontend_type>
<source_model>cybermut/system_config_source_order_status_accepted_3dsrisky</source_model>
<sort_order>125</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status_payment_accepted_3ds_high_risk>
<order_status_payment_accepted_3ds_very_high_risk translate="label">
<label>Order status when payment accepted by Cybermut, the transaction was done according 3DS protocol and the level of risk is very high</label>
<frontend_type>select</frontend_type>
<source_model>cybermut/system_config_source_order_status_accepted_3dsrisky</source_model>
<sort_order>126</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</order_status_payment_accepted_3ds_very_high_risk>
<order_status_payment_refused translate="label">
<label>Order status when payment refused by Cybermut</label>
<frontend_type>select</frontend_type>
<source_model>cybermut/system_config_source_order_status_refused</source_model>
<sort_order>122</sort_order>
<sort_order>127</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
Expand All @@ -156,7 +192,7 @@
<label>Order status when payment canceled by customer</label>
<frontend_type>select</frontend_type>
<source_model>cybermut/system_config_source_order_status_canceled</source_model>
<sort_order>123</sort_order>
<sort_order>128</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
Expand Down
5 changes: 5 additions & 0 deletions app/locale/fr_FR/Quadra_Cybermut.csv
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
"Payment from Specific countries","Mode de paiement autorisé pour les pays spécifiques"
"Order status when payment canceled by customer", "Statut des commandes dont le paiement a été annulé par le client"
"Order status when payment accepted by Cybermut", "Statut des commandes dont le paiement est accepté par Cybermut"
"Order status when payment accepted by Cybermut but the transaction was not done according to the 3DSecure protocol", "Statut des commandes dont le paiement est accepté par Cybermut mais la transaction ne s'est pas faite selon le protocole 3DSecure"
"Order status when payment accepted by Cybermut, the transaction was done according 3DS protocol and the level of risk is low", "Statut des commandes dont le paiement est accepté par Cybermut et la transaction s'est faite selon le protocole 3DS et le niveau de risque est faible"
"Order status when payment accepted by Cybermut, the transaction can not be done according to the 3DSecure protocol, the carrier has however been authenticated through 3DSecure", "Statut des commandes dont le paiement est accepté par Cybermut et la transaction ne peut se faire selon le protocole 3DSecure, le porteur a cependant été authentifié par le biais de 3DSecure"
"Order status when payment accepted by Cybermut, the transaction was done according 3DS protocol and the level of risk is high", "Statut des commandes dont le paiement est accepté par Cybermut et la transaction s'est faite selon le protocole 3DS et le niveau de risque est élevé"
"Order status when payment accepted by Cybermut, the transaction was done according 3DS protocol and the level of risk is very high", "Statut des commandes dont le paiement est accepté par Cybermut et la transaction s'est faite selon le protocole 3DS et le niveau de risque est très élevé"
"Order status when payment refused by Cybermut", "Statut des commandes dont le paiement est refusé par Cybermut"
"Site code","Code du site"
"Default Cybermut Interface language","Langue par défaut de l'interface Cybermut"
Expand Down