From 125686307fcf251ededab9fe07b9551360b957db Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 10 Oct 2017 13:58:25 +0200 Subject: [PATCH] Backup --- forms/account/conf/ui.xml | 8 -- forms/ecomerce/catalog/catalog.js | 45 +++--- forms/ecomerce/catalog/ui.xml | 82 +++++------ forms/ecomerce/invoices/invoices.js | 13 ++ forms/ecomerce/invoices/locale/ca.json | 2 + forms/ecomerce/invoices/locale/en.json | 2 + forms/ecomerce/invoices/locale/es.json | 2 + forms/ecomerce/invoices/locale/fr.json | 2 + forms/ecomerce/invoices/locale/mn.json | 2 + forms/ecomerce/invoices/locale/pt.json | 2 + forms/ecomerce/invoices/ui.xml | 43 +++--- forms/ecomerce/orders/locale/ca.json | 4 - forms/ecomerce/orders/locale/en.json | 4 - forms/ecomerce/orders/locale/es.json | 4 - forms/ecomerce/orders/locale/fr.json | 4 - forms/ecomerce/orders/locale/mn.json | 4 - forms/ecomerce/orders/locale/pt.json | 4 - forms/ecomerce/orders/orders.js | 16 ++- forms/ecomerce/orders/ui.xml | 6 +- js/db/connection.js | 12 ++ js/db/model.js | 43 +++--- js/hedera/locale/ca.json | 4 + js/hedera/locale/en.json | 4 + js/hedera/locale/es.json | 4 + js/hedera/locale/fr.json | 4 + js/hedera/locale/mn.json | 4 + js/hedera/locale/pt.json | 4 + js/hedera/tpv.js | 23 ++-- js/htk/field/combo.js | 15 -- js/htk/widget.js | 15 ++ js/sql/string.js | 14 +- js/vn/value.js | 184 +++++++++++++------------ package.json | 10 +- rest/tpv/transaction.php | 11 +- webpack.config.js | 5 +- 35 files changed, 339 insertions(+), 266 deletions(-) diff --git a/forms/account/conf/ui.xml b/forms/account/conf/ui.xml index 8d7045b1..c2eb1f1d 100755 --- a/forms/account/conf/ui.xml +++ b/forms/account/conf/ui.xml @@ -14,14 +14,6 @@ ON u.id = c.user_id - - SELECT a.id, a.consignee, p.name province, - a.zip_code, a.city, a.name, a.active, c.Pais country - FROM address_view a - LEFT JOIN vn2008.province p ON a.province_id = p.province_id - JOIN vn2008.Paises c ON c.Id = p.Paises_Id - WHERE active -

Configuration diff --git a/forms/ecomerce/catalog/catalog.js b/forms/ecomerce/catalog/catalog.js index 34636feb..9800b09d 100644 --- a/forms/ecomerce/catalog/catalog.js +++ b/forms/ecomerce/catalog/catalog.js @@ -107,30 +107,29 @@ Hedera.Catalog = new Class this.hideMenu (); } - - ,shouldRefresh: function () - { - var params = this.params.$; - - if (params.search) - return true; - - var refresh = params.realm && ( - params.type || - params.color || - params.origin || - params.category || - params.producer - ); - - return refresh; - } ,onLotChange: function () { - if (this.shouldRefresh ()) + function shouldRefresh (params) + { + return params.search || + params.realm && ( + params.type || + params.color || + params.origin || + params.category || + params.producer + ); + } + + function refreshItems () { this.$('items').refresh (); + } + + if (shouldRefresh (this.params.$)) + { + refreshItems (); this.hideMenu (); this.$('order').style.display = 'block'; } @@ -326,7 +325,7 @@ Hedera.Catalog = new Class this.$('card').row = -1; this.$('card-item').value = undefined; } - + ,onStatusChange: function () { this.$('card-popup').reset (); @@ -438,7 +437,13 @@ Vn.Filter = new Class ,_onMouseDown: function () { if (this._model && this._model.status === Db.Model.Status.CLEAN) + { + var params = { + filter: this._filter + }; + this._model.refresh (); + } } ,_onUnselectClick: function () diff --git a/forms/ecomerce/catalog/ui.xml b/forms/ecomerce/catalog/ui.xml index c13684eb..391bf4b3 100755 --- a/forms/ecomerce/catalog/ui.xml +++ b/forms/ecomerce/catalog/ui.xml @@ -41,8 +41,8 @@ CREATE TEMPORARY TABLE tmp.bionic_calc (INDEX (item_id)) @@ -50,7 +50,7 @@ SELECT a.Id_Article item_id FROM vn2008.Articles a JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id - WHERE $filter; + WHERE #filter; CALL bionic_calc (); SELECT a.Id_Article item_id, a.description, b.available, b.price, b.producer, a.Foto, a.Article, a.Categoria, a.Medida, @@ -77,7 +77,6 @@ FROM basket_item GROUP BY warehouse_id - +
+

Order by

+ +

Choose a realm

@@ -305,44 +342,6 @@
-
-

Order by

- -
@@ -355,6 +354,7 @@ id="card-popup" modal="true" on-closed="onPopupClose"> +
+ + +

Invoices

-
-
- - - SELECT invoice_id, serial_num, issued, amount - FROM invoice_view - ORDER BY issued DESC - LIMIT 100 - - - - - - +
+
+ + +
+
+ + + SELECT invoice_id, serial_num, issued, amount + FROM invoice_view + WHERE issued >= #from + ORDER BY issued DESC + + + + + +
diff --git a/forms/ecomerce/orders/locale/ca.json b/forms/ecomerce/orders/locale/ca.json index 30bdcaa2..27e5ec66 100755 --- a/forms/ecomerce/orders/locale/ca.json +++ b/forms/ecomerce/orders/locale/ca.json @@ -30,10 +30,6 @@ ,"Pending": "Pendent" ,"PayOrder": "Pagar encàrrec" - ,"AmountToPay:": "Quantitat a pagar (€):" - ,"AmountError": "La quantitat ha de ser un nombre positiu i inferior o igual a l'import pendent" - ,"PayError": "Error al realitzar el pagament" - ,"An error has been in the payment": "Sembla que hi ha hagut un error en el pagament" ,"Retry": "Reintenta" ,"Accept": "Acceptar" diff --git a/forms/ecomerce/orders/locale/en.json b/forms/ecomerce/orders/locale/en.json index 29c9e19c..473884b9 100755 --- a/forms/ecomerce/orders/locale/en.json +++ b/forms/ecomerce/orders/locale/en.json @@ -29,10 +29,6 @@ ,"TotalWithVAT": "Total with VAT" ,"Pending": "Pending" ,"PayOrder": "Pay order" - - ,"AmountToPay:": "Amount to pay (€):" - ,"AmountError": "The amount must be a positive number less than or equal to the outstanding amount" - ,"PayError": "Failed to make the payment" ,"An error has been in the payment": "It seems that there has been an error in the payment" ,"Retry": "Retry" diff --git a/forms/ecomerce/orders/locale/es.json b/forms/ecomerce/orders/locale/es.json index 9f1010c5..35942d97 100755 --- a/forms/ecomerce/orders/locale/es.json +++ b/forms/ecomerce/orders/locale/es.json @@ -29,10 +29,6 @@ ,"TotalWithVAT": "Total con IVA" ,"Pending": "Pendiente" ,"PayOrder": "Pagar pedido" - - ,"AmountToPay:": "Cantidad a pagar (€):" - ,"AmountError": "La cantidad debe ser un número positivo e inferior o igual al importe pendiente" - ,"PayError": "Error al realizar el pago" ,"An error has been in the payment": "Parece que ha habido un error en el pago" ,"Retry": "Reintentar" diff --git a/forms/ecomerce/orders/locale/fr.json b/forms/ecomerce/orders/locale/fr.json index 7640cf58..2f8c4df7 100755 --- a/forms/ecomerce/orders/locale/fr.json +++ b/forms/ecomerce/orders/locale/fr.json @@ -30,10 +30,6 @@ ,"Pending": "En attente" ,"PayOrder": "Payer la commande" - ,"AmountToPay:": "Montant à payer (€):" - ,"AmountError": "La quantité doit être un neméro positif et inférieur ou égal à la somme restant à payer" - ,"PayError": "Impossible d'effectuer le paiement" - ,"An error has been in the payment": "Il semble qu'il ya eu une erreur dans le paiement" ,"Retry": "Réessayez" ,"Accept": "Accepter" diff --git a/forms/ecomerce/orders/locale/mn.json b/forms/ecomerce/orders/locale/mn.json index dfd1d44d..9cdd66eb 100755 --- a/forms/ecomerce/orders/locale/mn.json +++ b/forms/ecomerce/orders/locale/mn.json @@ -29,10 +29,6 @@ ,"TotalWithVAT": "Total with VAT" ,"Pending": "Pending" ,"PayOrder": "Pay order" - - ,"AmountToPay:": "Amount to pay (€):" - ,"AmountError": "The amount must be a positive number less than or equal to the outstanding amount" - ,"PayError": "Failed to make the payment" ,"An error has been in the payment": "It seems that there has been an error in the payment" ,"Retry": "Retry" diff --git a/forms/ecomerce/orders/locale/pt.json b/forms/ecomerce/orders/locale/pt.json index d0d338f6..82476967 100644 --- a/forms/ecomerce/orders/locale/pt.json +++ b/forms/ecomerce/orders/locale/pt.json @@ -29,10 +29,6 @@ ,"TotalWithVAT": "Total com IVA" ,"Pending": "Pendente" ,"PayOrder": "Pagar pedido" - - ,"AmountToPay:": "Quantidade a pagar (€):" - ,"AmountError": "A quantidade deve ser um número positivo e inferior ou igual ao importe pendiente" - ,"PayError": "Erro ao realizar o pagamento" ,"An error has been in the payment": "Parece que não houve um erro no pagamento" ,"Retry": "Tentar novamente" diff --git a/forms/ecomerce/orders/orders.js b/forms/ecomerce/orders/orders.js index 2eb73b1e..6ebb8db2 100644 --- a/forms/ecomerce/orders/orders.js +++ b/forms/ecomerce/orders/orders.js @@ -11,12 +11,14 @@ Hedera.Orders = new Class }); this.tpv.check (this._onTpvCheck.bind (this)); - if (!this.hash.get ('from')) + var params = this.params; + + if (!params.$.from) { var from = new Date (); from.setDate (from.getDate () - 30); from.setHours (0, 0, 0, 0); - this.hash.assign ({from: from}); + params.assign ({from: from}); } } @@ -60,9 +62,13 @@ Hedera.Orders = new Class if (amount !== null) defaultAmountStr = Vn.Value.format (amount, '%.2d'); - amount = parseFloat (prompt (_('AmountToPay:'), defaultAmountStr)); - - this.tpv.pay (amount, null); + amount = prompt (_('AmountToPay:'), defaultAmountStr); + + if (amount != null) + { + amount = parseFloat (amount.replace (',', '.')); + this.tpv.pay (amount, null); + } } ,onDialogResponse: function (dialog, response) diff --git a/forms/ecomerce/orders/ui.xml b/forms/ecomerce/orders/ui.xml index 2c90c19e..896c9355 100755 --- a/forms/ecomerce/orders/ui.xml +++ b/forms/ecomerce/orders/ui.xml @@ -60,15 +60,15 @@

+

+ +

-

- -

diff --git a/js/db/connection.js b/js/db/connection.js index 35510be9..750df0e7 100644 --- a/js/db/connection.js +++ b/js/db/connection.js @@ -87,6 +87,18 @@ Connection.implement return new Sql.String ({query: query}).render (params); } + /** + * Renders an SQL statement object. + * + * @param {string} stmt The SQL statement + * @param {Object} params The statement parameters + * @return {string} The rendered statement + */ + ,renderStmt: function (stmt, params) + { + return stmt.render (params); + } + /* * Parses a value to date. */ diff --git a/js/db/model.js b/js/db/model.js index 21886425..557049b4 100644 --- a/js/db/model.js +++ b/js/db/model.js @@ -278,14 +278,14 @@ Klass.implement this.query = child.textContent; } - ,_getParams: function () + ,_getLotParams: function () { if (!this._stmt) return null; - var ids = this._stmt.findHolders (); + var holders = this._stmt.findHolders (); - if (!ids) + if (!holders) return null; var lotParams = this._lot ? this._lot.params : {}; @@ -295,17 +295,17 @@ Klass.implement var params = {}; - for (var i = 0; i < ids.length; i++) - params[ids[i]] = lotParams[ids[i]]; + for (var i = 0; i < holders.length; i++) + params[holders[i]] = lotParams[holders[i]]; return params; } ,_onLotChange: function () { - var params = this._getParams (); + var lotParams = this._getLotParams (); - if (!Vn.Value.equals (params, this._lastParams)) + if (!Vn.Value.equals (lotParams, this._lastLotParams)) this._autoLoad (); } @@ -316,16 +316,19 @@ Klass.implement else this.clean (); } - + ,_isReady: function (params) { if (!this._stmt || !this._conn) return false; - if (!params) + + var holders = this._stmt.findHolders (); + + if (!holders) return true; - for (var key in params) - if (params[key] === undefined) + for (var i = 0; i < holders.length; i++) + if (params[holders[i]] === undefined) return false; return true; @@ -334,16 +337,22 @@ Klass.implement /** * Refresh the model data reexecuting the query on the database. */ - ,refresh: function () + ,refresh: function (params) { - var params = this._getParams (); + var lotParams = this._getLotParams (); - if (this._isReady (params)) + var myParams = {}; + Object.assign (myParams, lotParams); + Object.assign (myParams, params); + + if (this._filter && (!params || params.filter === undefined)) + myParams.filter = this._filter; + + if (this._isReady (myParams)) { - this._lastParams = params; + this._lastLotParams = lotParams; this._setStatus (Status.LOADING); - this._conn.execStmt (this._stmt, this._selectDone.bind (this), - this._lot ? this._lot.params : null); + this._conn.execStmt (this._stmt, this._selectDone.bind (this), myParams); } else this.clean (); diff --git a/js/hedera/locale/ca.json b/js/hedera/locale/ca.json index 4e07c231..74d4d783 100644 --- a/js/hedera/locale/ca.json +++ b/js/hedera/locale/ca.json @@ -60,4 +60,8 @@ ,"Configuration": "Configuració" ,"Account": "Compte" ,"Addresses": "Direccions" + + ,"AmountToPay:": "Quantitat a pagar (€):" + ,"AmountError": "La quantitat ha de ser un nombre positiu" + ,"PayError": "Error al realitzar el pagament" } diff --git a/js/hedera/locale/en.json b/js/hedera/locale/en.json index 2f599146..fbedb0e6 100644 --- a/js/hedera/locale/en.json +++ b/js/hedera/locale/en.json @@ -60,4 +60,8 @@ ,"Configuration": "Configuration" ,"Account": "Account" ,"Addresses": "Addresses" + + ,"AmountToPay:": "Amount to pay (€):" + ,"AmountError": "The amount must be a positive number" + ,"PayError": "Failed to make the payment" } diff --git a/js/hedera/locale/es.json b/js/hedera/locale/es.json index 6efbf899..bf755ed0 100644 --- a/js/hedera/locale/es.json +++ b/js/hedera/locale/es.json @@ -60,4 +60,8 @@ ,"Configuration": "Configuración" ,"Account": "Cuenta" ,"Addresses": "Direcciones" + + ,"AmountToPay:": "Cantidad a pagar (€):" + ,"AmountError": "La cantidad debe ser un número positivo" + ,"PayError": "Error al realizar el pago" } diff --git a/js/hedera/locale/fr.json b/js/hedera/locale/fr.json index e3c46d25..49370e0e 100644 --- a/js/hedera/locale/fr.json +++ b/js/hedera/locale/fr.json @@ -60,4 +60,8 @@ ,"Configuration": "Configuration" ,"Account": "Compte" ,"Addresses": "Adresses" + + ,"AmountToPay:": "Montant à payer (€):" + ,"AmountError": "La quantité doit être un neméro positif" + ,"PayError": "Impossible d'effectuer le paiement" } diff --git a/js/hedera/locale/mn.json b/js/hedera/locale/mn.json index 53ada016..59fe70db 100644 --- a/js/hedera/locale/mn.json +++ b/js/hedera/locale/mn.json @@ -60,4 +60,8 @@ ,"Configuration": "Тохиргоо" ,"Account": "Дансны" ,"Addresses": "хаягууд" + + ,"AmountToPay:": "Amount to pay (€):" + ,"AmountError": "The amount must be a positive number" + ,"PayError": "Failed to make the payment" } diff --git a/js/hedera/locale/pt.json b/js/hedera/locale/pt.json index e8fe2c92..37af5e6d 100644 --- a/js/hedera/locale/pt.json +++ b/js/hedera/locale/pt.json @@ -60,4 +60,8 @@ ,"Configuration": "Configuração" ,"Account": "Conta" ,"Addresses": "Endereços" + + ,"AmountToPay:": "Quantidade a pagar (€):" + ,"AmountError": "A quantidade deve ser um número positivo" + ,"PayError": "Erro ao realizar o pagamento" } diff --git a/js/hedera/tpv.js b/js/hedera/tpv.js index eec452ce..07c64154 100644 --- a/js/hedera/tpv.js +++ b/js/hedera/tpv.js @@ -32,7 +32,7 @@ module.exports = new Class ,_realPpay: function (amount, company) { - if (amount > 0) + if (isNumeric (amount) && amount > 0) { var params = { amount: parseInt (amount) @@ -44,7 +44,7 @@ module.exports = new Class this.conn.send ('tpv/transaction', params, this._onTransactionStart.bind (this)); } - else if (!isNaN (amount)) + else Htk.Toast.showError (_('AmountError')); } @@ -52,27 +52,22 @@ module.exports = new Class { if (json) { + var postValues = json.postValues; + var form = document.createElement ('form'); form.method = 'post'; form.action = json.url; document.body.appendChild (form); - - var fieldsMap = - { - Ds_SignatureVersion: 'HMAC_SHA256_V1' - ,Ds_MerchantParameters: json.params - ,Ds_Signature: json.signature - }; - for (var field in fieldsMap) + for (var field in postValues) { var input = document.createElement ('input'); input.type = 'hidden'; input.name = field; form.appendChild (input); - if (fieldsMap[field]) - input.value = fieldsMap[field]; + if (postValues[field]) + input.value = postValues[field]; } form.submit (); @@ -118,3 +113,7 @@ module.exports = new Class } }); +function isNumeric (n) +{ + return !isNaN (parseFloat(n)) && isFinite (n); +} diff --git a/js/htk/field/combo.js b/js/htk/field/combo.js index 6f9bd383..3a232a76 100644 --- a/js/htk/field/combo.js +++ b/js/htk/field/combo.js @@ -1,12 +1,6 @@ var ColumnText = require ('../column/text'); -var nativeEvents = { - 'click' : 1 - ,'mousedown' : 1 - ,'focusout' : 1 -}; - module.exports = new Class ({ Extends: Htk.Field @@ -149,15 +143,6 @@ module.exports = new Class button.className = 'htk-select input'; button.addEventListener ('mousedown', this._onButtonMouseDown.bind (this)); } - - ,on: function (id, callback, instance) - { - if (nativeEvents[id] !== undefined) - this.node.addEventListener (id, - callback.bind (instance, this)); - else - this.parent (id, callback, instance); - } ,_setRow: function (row) { diff --git a/js/htk/widget.js b/js/htk/widget.js index 0aa50362..b1970700 100644 --- a/js/htk/widget.js +++ b/js/htk/widget.js @@ -1,6 +1,12 @@ var NodeBuilder = require ('./node-builder'); +var nativeEvents = { + 'click' : 1 + ,'mousedown' : 1 + ,'focusout' : 1 +}; + module.exports = new Class ({ Extends: NodeBuilder @@ -45,6 +51,15 @@ module.exports = new Class this.parent (props); } + ,on: function (id, callback, instance) + { + if (nativeEvents[id]) + this.node.addEventListener (id, + callback.bind (instance, this)); + else + this.parent (id, callback, instance); + } + ,createRoot: function (tagName) { return this._node = this.createElement (tagName); diff --git a/js/sql/string.js b/js/sql/string.js index 54015f29..ebf089b6 100644 --- a/js/sql/string.js +++ b/js/sql/string.js @@ -18,19 +18,19 @@ module.exports = new Class } ,regexp: /#\w+/g - - ,replaceFunc: function (params, token) - { - var holder = new Holder ({id: token.substr (1)}); - return holder.render (params); - } ,render: function (params) { if (!this.query) return null; + + function replaceFunc (token) + { + var holder = new Holder ({id: token.substr (1)}); + return holder.render (params); + } - return this.query.replace (this.regexp, this.replaceFunc.bind (this, params)); + return this.query.replace (this.regexp, replaceFunc); } ,findHolders: function () diff --git a/js/vn/value.js b/js/vn/value.js index 87acb1fe..d8932866 100644 --- a/js/vn/value.js +++ b/js/vn/value.js @@ -1,6 +1,103 @@ var VnDate = require ('./date'); +/** + * Clones a simple value. A simple value is any value that is not an array, + * object or function. If non-simple value is passed, the same object reference + * is returned. + * + * @param {*} value The value to be copied + * @return {*} The value copy + */ +function simpleClone (value) +{ + if (value instanceof Date) + return value.clone (); + + return value; +} + +/** + * Checks if two simple values are equal using the strict equality operator. For + * information about simple values see simpleClone() function. + * + * @param {*} a Value to compare to + * @param {*} b Value to compare with + * @return {boolean} %true if they are equal, %false otherwise + */ +function simpleEquals (a, b) +{ + if (a === b) + return true; + if (a instanceof Date && b instanceof Date) + return a.getTime () === b.getTime (); + + return false; +} + +/** + * Calculates differences between two simple key-value objects. + * + * @param {Object} orgObject Value to compare to + * @param {Object} newObject Value to compare with + * @return {Object} The differences or %null if there are no differences + */ +function diff (orgObject, newObject) +{ + var diff = {}; + + for (var key in orgObject) + if (!simpleEquals (orgObject[key], newObject[key])) + diff[key] = simpleClone (newObject[key]); + + for (var key in newObject) + if (orgObject[key] === undefined && newObject[key] !== undefined) + diff[key] = simpleClone (newObject[key]); + + if (Object.keys (diff).length > 0) + return diff; + + return null; +} + +/** + * Calculates new differences between two simple key-value objects. + * + * @param {Object} orgObject Value to compare to + * @param {Object} newObject Value to compare with + * @return {Object} The differences or %null if there are no differences + */ +function partialDiff (orgObject, newObject) +{ + var diff = {}; + + for (var key in newObject) + if (!simpleEquals (orgObject[key], newObject[key])) + diff[key] = simpleClone (newObject[key]); + + if (Object.keys (diff).length > 0) + return diff; + + return null; +} + +/** + * Clones a simple key-value object in wich properties are simple values. For + * information about simple values see simpleClone() function. + * + * @param {*} object The object to be cloned + * @return The cloned object + */ +function kvClone (object) +{ + var copy = {}; + + for (var key in object) + copy[key] = simpleClone (object[key]); + + return copy; +} + /** * Checks if two values are equal, it also checks objects. Basic values are * compared using the strict equality operator. @@ -31,93 +128,6 @@ function equals (a, b) return false; } -/** - * Calculates differences between two key-value objects. - * - * @param {Object} orgObject Value to compare to - * @param {Object} newObject Value to compare with - * @return {Object} The differences or %null if there are no differences - */ -function diff (orgObject, newObject) -{ - var diff = {}; - - for (var key in orgObject) - if (!simpleEquals (orgObject[key], newObject[key])) - diff[key] = simpleClone (newObject[key]); - - for (var key in newObject) - if (orgObject[key] === undefined && newObject[key] !== undefined) - diff[key] = simpleClone (newObject[key]); - - if (Object.keys (diff).length > 0) - return diff; - - return null; -} - -/** - * Calculates new differences between two key-value objects. - * - * @param {Object} orgObject Value to compare to - * @param {Object} newObject Value to compare with - * @return {Object} The differences or %null if there are no differences - */ -function partialDiff (orgObject, newObject) -{ - var diff = {}; - - for (var key in newObject) - if (!simpleEquals (orgObject[key], newObject[key])) - diff[key] = simpleClone (newObject[key]); - - if (Object.keys (diff).length > 0) - return diff; - - return null; -} - -function kvClone (object) -{ - var copy = {}; - - for (var key in object) - copy[key] = simpleClone (object[key]); - - return copy; -} - -/** - * Copies a simple value. - * - * @param {*} value The value to be copied - * @return {*} The value copy - */ -function simpleClone (value) -{ - if (value instanceof Date) - return value.clone (); - - return value; -} - -/** - * Checks if two simple values are equal using the strict equality operator. - * - * @param {*} a Value to compare to - * @param {*} b Value to compare with - * @return {boolean} %true if they are equal, %false otherwise - */ -function simpleEquals (a, b) -{ - if (a === b) - return true; - if (a instanceof Date && b instanceof Date) - return a.getTime () === b.getTime (); - - return false; -} - /** * Returns a formated string. * diff --git a/package.json b/package.json index b79f9a3c..28d7ebf3 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,12 @@ "file-loader": "^0.9.0", "json-loader": "^0.5.4", "raw-loader": "^0.5.1", - "style-loader": "^0.13.1", + "style-loader": "^0.19.0", "url-loader": "^0.5.7", - "webpack": "^3.0.0", - "webpack-chunk-hash": "^0.4.0", - "webpack-dev-server": "^2.5.0", - "webpack-merge": "^3.0.0" + "webpack": "^3.6.0", + "webpack-chunk-hash": "^0.5.0", + "webpack-dev-server": "^2.9.1", + "webpack-merge": "^4.1.0" }, "dependencies": { "mootools": "^1.5.2", diff --git a/rest/tpv/transaction.php b/rest/tpv/transaction.php index 5d32cbde..331c3cdf 100755 --- a/rest/tpv/transaction.php +++ b/rest/tpv/transaction.php @@ -44,12 +44,17 @@ class Transaction extends Vn\Web\JsonRequest $key = mcrypt_encrypt (MCRYPT_3DES, $key, $transactionId, MCRYPT_MODE_CBC, $iv); $signature = base64_encode (hash_hmac ('sha256', $encodedParams, $key, TRUE)); + $url = $row['url']; + $postValues = [ + 'Ds_SignatureVersion' => 'HMAC_SHA256_V1' + ,'Ds_MerchantParameters' => $encodedParams + ,'Ds_Signature' => $signature + ]; return [ - 'url' => $url - ,'params' => $encodedParams - ,'signature' => $signature + 'url' => $url + ,'postValues' => $postValues ]; } } diff --git a/webpack.config.js b/webpack.config.js index 6fe67e63..63525f35 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -39,7 +39,10 @@ var baseConfig = { new webpack.optimize.CommonsChunkPlugin ({ names: ['vendor', 'manifest'] }) - ] + ], + watchOptions: { + ignored: /node_modules/ + } }; var prodConfig = {