Skip to content

Commit

Permalink
Partial refund added and update to SDK 1.3.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
XYG6 authored and XYG6 committed May 4, 2022
1 parent 665af4b commit c14c381
Show file tree
Hide file tree
Showing 25 changed files with 2,470 additions and 96 deletions.
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config_fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>easytransac</name>
<displayName><![CDATA[Paiement par carte bancaire Easytransac]]></displayName>
<version><![CDATA[3.3.0]]></version>
<version><![CDATA[3.3.1]]></version>
<description><![CDATA[Acceptez les paiements par carte bancaire, en une ou plusieurs fois, avec le module d'encaissement 100% français EasyTransac]]></description>
<author><![CDATA[EasyTransac]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
8 changes: 7 additions & 1 deletion controllers/front/notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,18 @@ public function postProcess()

$this->module->addOrderMessage($existing_order->id, $payment_message);

$amount = $response->getContent()->getAmount() * 100;

if($payment_status == 7){
$amount = $response->getContent()->AmountRefund() * 100;
}

# for Prestashop >= 1.7.7
$this->module->addTransactionMessage(
$existing_order_id,
$response->getTid(),
$payment_message,
$response->getAmount() *100,
$amount,
$response->getStatus());

$this->module->debugLog('Notification : order state changed to', $payment_status);
Expand Down
33 changes: 23 additions & 10 deletions easytransac.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct()
{
$this->name = 'easytransac';
$this->tab = 'payments_gateways';
$this->version = '3.3.0';
$this->version = '3.3.1';
$this->author = 'EasyTransac';
$this->is_eu_compatible = 1;
$this->need_instance = 0;
Expand Down Expand Up @@ -259,15 +259,17 @@ public function displayForm()
array(
'type' => 'text',
'label' => $this->l('Api Key'),
'desc' => $this->l('Your Easytransac application API Key is available in your back office in E-commerce > Applications.'),
'desc' => $this->l('Your Easytransac application API Key is available in your back office, by editing ')
.'<a target="_blank" href="https://www.easytransac.com/'.$this->l('en').'/login/application/all">'.$this->l('your application').'</a>.',
'name' => 'EASYTRANSAC_API_KEY',
'size' => 20,
'required' => true
),
array(
'type' => 'free',
'label' => $this->l('Notification URL'),
'desc' => $this->l('Notification URL to copy paste in your EasyTransac appplication settings'),
'desc' => $this->l('Enter this notification URL when editing ')
.'<a target="_blank" href="https://www.easytransac.com/'.$this->l('en').'/login/application/all">'.$this->l('your application').'</a>.',
'name' => 'EASYTRANSAC_NOTIFICATION_URL',
'size' => 20,
),
Expand Down Expand Up @@ -695,15 +697,26 @@ public function hookActionOrderSlipAdd($params){
->write('product map '. json_encode($item));
}

$items = $params['order']->getOrderSlipsCollection()->getResults();
$total_refund_amount = 0;
// $items = $params['order']->getOrderSlipsCollection()->getResults();
// $total_refund_amount = 0;

foreach ($items as $key => $item) {
EasyTransac\Core\Logger::getInstance()
->write('refund amount for item '. $item->amount);
// foreach ($items as $key => $item) {
// EasyTransac\Core\Logger::getInstance()
// ->write('refund amount for item '. $item->amount);

$total_refund_amount += $item->amount;
}
// $total_refund_amount += $item->amount;
// }

$orderSlip = $params['order']->getOrderSlipsCollection()
->orderBy('date_upd', 'desc')
->getFirst();

$total_refund_amount = $orderSlip->amount + $orderSlip->shipping_cost_amount;

EasyTransac\Core\Logger::getInstance()
->write('refund amount for order slip: '. $orderSlip->amount
.' - shipping cost amount: '.$orderSlip->shipping_cost_amount
.' - total: '.$total_refund_amount);

if($total_refund_amount > 0){
$logMsg = json_encode(print_r($params['order'], true));
Expand Down
20 changes: 9 additions & 11 deletions translations/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
$_MODULE['<{easytransac}prestashop>easytransac_f4f70727dc34561dfde1a3c529b6205c'] = 'Paramètres';
$_MODULE['<{easytransac}prestashop>easytransac_5a2ebfb8baa378cfcfcba58bbb1380c2'] = 'Éléments requis';
$_MODULE['<{easytransac}prestashop>easytransac_2e5e61c17add3609c6786a4c9ce1a279'] = 'Clé d\'API ';
$_MODULE['<{easytransac}prestashop>easytransac_bd81a5e203876503df7e2ac6b04f6c1b'] = 'Votre clé d\'API Easytransac, disponible sur votre espace client dans E-commerce > Applications.';
$_MODULE['<{easytransac}prestashop>easytransac_8d308a3184a7afba4d8ab126f6e0f9c9'] = 'Votre clé d\'API Easytransac est disponible sur votre espace client, en éditant';
$_MODULE['<{easytransac}prestashop>easytransac_9cfefed8fb9497baa5cd519d7d2bb5d7'] = 'fr';
$_MODULE['<{easytransac}prestashop>easytransac_6ba802436d75ea03dbc684ca197ff684'] = 'votre application';
$_MODULE['<{easytransac}prestashop>easytransac_a2b787ad97ab6f553dded04fc19dab01'] = 'URL de notification';
$_MODULE['<{easytransac}prestashop>easytransac_cb664514b802ab38b8cae3092c6cf15f'] = 'Saisissez cette URL sur votre espace client, dans la partie E-commerce > Applications puis en cliquant sur \"Editer\".';
$_MODULE['<{easytransac}prestashop>easytransac_95b0570d99a749ae466225b77eb31558'] = 'Saisissez cette URL de notification en éditant';
$_MODULE['<{easytransac}prestashop>easytransac_302e197c5035435162398179ab21cbf5'] = 'Paiements en 1 clic';
$_MODULE['<{easytransac}prestashop>easytransac_f611890ac19b437ed2d695b7637f09ae'] = 'La carte bancaire du client est sauvegardée pour de futurs paiements.';
$_MODULE['<{easytransac}prestashop>easytransac_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
Expand All @@ -43,7 +45,6 @@
$_MODULE['<{easytransac}prestashop>notification_ea397fa1032ee2c3a2eb37aeea8081df'] = 'Montant payé différent du montant de la commande';
$_MODULE['<{easytransac}prestashop>notification_6b804acc24887be2487ee67d55c48eed'] = 'Paiement en plusieurs fois';
$_MODULE['<{easytransac}prestashop>notification_ec234a2ac7acc640c6b795c71e4ad8c6'] = 'Paiement en plusieurs fois complété';
$_MODULE['<{easytransac}prestashop>checkout_payment_67e796341942b590723681410200029f'] = 'Payez avec votre carte bancaire';
$_MODULE['<{easytransac}prestashop>confirmation_f403ac95a07ddae169d88c4833ace3ce'] = 'Merci pour votre commande';
$_MODULE['<{easytransac}prestashop>confirmation_e6dc7945b557a1cd949bea92dd58963e'] = 'Votre commande sera livrée bientôt.';
$_MODULE['<{easytransac}prestashop>confirmation_0db71da7150c27142eef9d22b843b4a9'] = 'Pour toute demande d\'information, merci de contacter notre';
Expand All @@ -52,23 +53,20 @@
$_MODULE['<{easytransac}prestashop>confirmation_2e2117b7c81aa9ea6931641ea2c6499f'] = 'Votre commande du ';
$_MODULE['<{easytransac}prestashop>confirmation_ecaa952cb16a3aa256995cee0ccdee54'] = 'est en cours de traitement';
$_MODULE['<{easytransac}prestashop>confirmation_50918aa8e5ee2c48f236547845cc4394'] = 'Veuillez attendre la confirmation du paiement par EasyTransac';
$_MODULE['<{easytransac}prestashop>multiple_payments_6b804acc24887be2487ee67d55c48eed'] = 'Paiement en plusieurs fois';
$_MODULE['<{easytransac}prestashop>multiple_payments_794a84d799ba259008e1ab4da089b0ae'] = 'Payer en 2 fois';
$_MODULE['<{easytransac}prestashop>multiple_payments_bb9be692a920f347a0273ab51442a61e'] = 'Payer en 3 fois';
$_MODULE['<{easytransac}prestashop>multiple_payments_b9f4ca4ebe2f9bf614036cd5f8587171'] = 'Payer en 4 fois';
$_MODULE['<{easytransac}prestashop>adminordertab_44749712dbec183e983dcd78a7736c41'] = 'Date';
$_MODULE['<{easytransac}prestashop>adminordertab_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Message';
$_MODULE['<{easytransac}prestashop>adminordertab_ec53a8c4f07baed5d8825072c89799be'] = 'Statut';
$_MODULE['<{easytransac}prestashop>adminordertab_88427ec035734b45aae9f7d8859a5008'] = 'ID transaction';
$_MODULE['<{easytransac}prestashop>adminordertab_b2f40690858b404ed10e62bdf422c704'] = 'Montant';
$_MODULE['<{easytransac}prestashop>multiple_payments_6b804acc24887be2487ee67d55c48eed'] = 'Paiement en plusieurs fois';
$_MODULE['<{easytransac}prestashop>multiple_payments_794a84d799ba259008e1ab4da089b0ae'] = 'Payer en 2 fois';
$_MODULE['<{easytransac}prestashop>multiple_payments_bb9be692a920f347a0273ab51442a61e'] = 'Payer en 3 fois';
$_MODULE['<{easytransac}prestashop>multiple_payments_b9f4ca4ebe2f9bf614036cd5f8587171'] = 'Payer en 4 fois';
$_MODULE['<{easytransac}prestashop>oneclick_payment_95552c6d802066c1fc546b3f7fe7b1f7'] = 'Paiement en 1 clic';
$_MODULE['<{easytransac}prestashop>oneclick_payment_b22528f7f0c20d75a9a3f951a58dd72b'] = 'Sélectionnez une carte bancaire';
$_MODULE['<{easytransac}prestashop>oneclick_payment_8bd4837a76cf443ab523a51895e23c36'] = 'Payer maintenant';
$_MODULE['<{easytransac}prestashop>oneclick_payment_8fd89eaea3816dc99d21701581e0800a'] = 'Merci de patienter quelques instants ...';
$_MODULE['<{easytransac}prestashop>admin_order_tab_44749712dbec183e983dcd78a7736c41'] = 'Date';
$_MODULE['<{easytransac}prestashop>admin_order_tab_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Message';
$_MODULE['<{easytransac}prestashop>admin_order_tab_88427ec035734b45aae9f7d8859a5008'] = 'ID transaction';
$_MODULE['<{easytransac}prestashop>admin_order_tab_b2f40690858b404ed10e62bdf422c704'] = 'Montant';
$_MODULE['<{easytransac}prestashop>checkout_payment_67e796341942b590723681410200029f'] = 'Payez avec votre carte bancaire';
$_MODULE['<{easytransac}prestashop>error_a40cab5994f36d4c48103a22ca082e8f'] = 'Votre panier';
$_MODULE['<{easytransac}prestashop>error_1d7d452aefd53cb905743fdf611a9306'] = 'EasyTransac';
$_MODULE['<{easytransac}prestashop>error_f47106270a2928f350f357e255a2c2ac'] = 'Merci de contacter le marchand:';
Expand Down
5 changes: 5 additions & 0 deletions vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit885adfb13f80d7aad1adc0abce42e2fa::getLoader();
2 changes: 1 addition & 1 deletion vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function getFallbackDirsPsr4()

/**
* @return string[] Array of classname => path
* @psalm-var array<string, string>
* @psalm-return array<string, string>
*/
public function getClassMap()
{
Expand Down
2 changes: 2 additions & 0 deletions vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_classmap.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);

return array(
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/autoload_namespaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);

return array(
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);

return array(
Expand Down
25 changes: 3 additions & 22 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,11 @@ public static function getLoader()
require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInit885adfb13f80d7aad1adc0abce42e2fa', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit885adfb13f80d7aad1adc0abce42e2fa', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInit885adfb13f80d7aad1adc0abce42e2fa::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}

$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}

$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit885adfb13f80d7aad1adc0abce42e2fa::getInitializer($loader));

$loader->register(true);

Expand Down
16 changes: 8 additions & 8 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"packages": [
{
"name": "easytransac/easytransac-sdk-php",
"version": "1.3.0",
"version_normalized": "1.3.0.0",
"version": "1.3.2",
"version_normalized": "1.3.2.0",
"source": {
"type": "git",
"url": "https://github.com/easytransac/easytransac-sdk-php.git",
"reference": "f464c796c4205a0e672fa5829ad13cfd26439583"
"reference": "e75c11c70bc7a9b742340047ceb73c4948812363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/easytransac/easytransac-sdk-php/zipball/f464c796c4205a0e672fa5829ad13cfd26439583",
"reference": "f464c796c4205a0e672fa5829ad13cfd26439583",
"url": "https://api.github.com/repos/easytransac/easytransac-sdk-php/zipball/e75c11c70bc7a9b742340047ceb73c4948812363",
"reference": "e75c11c70bc7a9b742340047ceb73c4948812363",
"shasum": ""
},
"require": {
Expand All @@ -22,7 +22,7 @@
"phpunit/phpunit": "^5",
"squizlabs/php_codesniffer": "^3.6"
},
"time": "2021-11-22T11:07:05+00:00",
"time": "2022-04-25T09:57:58+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -39,15 +39,15 @@
"name": "Easytransac"
}
],
"description": "A SDK to make payment with the EasyTransac API",
"description": "Easytransac payment gateway PHP SDK",
"keywords": [
"easytransac",
"php",
"sdk"
],
"support": {
"issues": "https://github.com/easytransac/easytransac-sdk-php/issues",
"source": "https://github.com/easytransac/easytransac-sdk-php/tree/1.3.0"
"source": "https://github.com/easytransac/easytransac-sdk-php/tree/1.3.2"
},
"install-path": "../easytransac/easytransac-sdk-php"
}
Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'f734dec3cb16eaef5107d58f7d0ad88ee9ee7b78',
'reference' => '665af4b720dfe1c4eed1d8a9a02c6550115c9d65',
'name' => '__root__',
'dev' => true,
),
Expand All @@ -16,16 +16,16 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'f734dec3cb16eaef5107d58f7d0ad88ee9ee7b78',
'reference' => '665af4b720dfe1c4eed1d8a9a02c6550115c9d65',
'dev_requirement' => false,
),
'easytransac/easytransac-sdk-php' => array(
'pretty_version' => '1.3.0',
'version' => '1.3.0.0',
'pretty_version' => '1.3.2',
'version' => '1.3.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../easytransac/easytransac-sdk-php',
'aliases' => array(),
'reference' => 'f464c796c4205a0e672fa5829ad13cfd26439583',
'reference' => 'e75c11c70bc7a9b742340047ceb73c4948812363',
'dev_requirement' => false,
),
),
Expand Down
3 changes: 0 additions & 3 deletions vendor/easytransac/easytransac-sdk-php/.coveralls.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PHP Unit coverage badge

on:
# Run on all pushes and on all pull requests.
# Prevent the build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: phpunit-coverage-badge
uses: timkrase/[email protected]
with:
push_badge: true
repo_token: ${{ secrets.GITHUB_TOKEN }}

Loading

0 comments on commit c14c381

Please sign in to comment.