Openbravo Issue Tracking System - Retail Modules
View Issue Details
0031743Retail ModulesWeb POSpublic2015-12-17 15:152016-12-14 16:38
guillermogil 
ranjith_qualiantech_com 
normalmajoralways
closedfixed 
5
 
RR17Q1 
marvintm
No
0031743: Cancel a payment with paymentData after a refresh creates an error
Cancel a payment with paymentData after a refresh creates an error.
If you have an integration with a payment gateway a VoidTransactioni is a must but if you refresh the browser is not possible to cancel it.

On refresh voidTransaction object gets removed.

Error:
TypeError: voidTransaction is not a function
    at callVoidTransaction (be0f4d927c46422af6a36c62b754d774_WebPOS.js:38168)
    at Object.OB.UTIL.showConfirmation.display.action (be0f4d927c46422af6a36c62b754d774_WebPOS.js:38203)
    at Object.button.tap (be0f4d927c46422af6a36c62b754d774_WebPOS.js:10015)
    at Object.enyo.kind.dispatch (enyo.js:628)
    at Object.enyo.kind.dispatchEvent (enyo.js:612)
    at Object.enyo.kind.inherited (enyo.js:410)
    at Object.enyo.kind.dispatchEvent (enyo.js:1338)
    at Object.enyo.kind.dispatchBubble (enyo.js:616)
    at Object.enyo.kind.bubble (enyo.js:604)
    at Object.enyo.dispatcher.dispatchBubble (enyo.js:1783)
    at Object.enyo.dispatcher.dispatch [as dispatch] (enyo.js:1762)
    at Object.enyo.dispatch (enyo.js:1788); line: Object.OB.UTIL.showError (http://localhost:8080/openbravo/web/js/gen/be0f4d927c46422af6a36c62b754d774_WebPOS.js:10150:6 [^]) (*,+)processConsoleLevel @ be0f4d927c46422af6a36c62b754d774_WebPOS.js:2522
be0f4d927c46422af6a36c62b754d774_WebPOS.js:38168 Uncaught TypeError: voidTransaction is not a function
Add a Payment with paymentData and Void transaction function.
e.g.-
      OB.MobileApp.model.receipt.addPayment(new OB.Model.PaymentLine({
        kind: payment.payment.searchKey,
        name: OB.MobileApp.model.getPaymentName(payment.payment.searchKey),
        amount: OB.DEC.number(OB.DEC.div(amount, 100)),
        rate: payment.rate,
        mulrate: payment.mulrate,
        isocode: payment.isocode,
        isCash: payment.paymentMethod.iscash,
        allowOpenDrawer: payment.paymentMethod.allowopendrawer,
        openDrawer: payment.paymentMethod.openDrawer,
        printtwice: payment.paymentMethod.printtwice,
        paymentData: {
          voidConfirmation: false,
          serialNumber: voucherNumber,
          voidTransaction: function (callback) {
            callback();
          }
        }
      })

Refresh the browser
Try to cancel it
It is needed to create an structure that on Cancel a Payment if it is a Payment Provider it will look to a function defined on the prototype of the kind (Payment Provider) used.
If there is none it will call to void Transaction function.

It will be needed to update the Payment Provider Wiki also.
No tags attached.
related to defect 0031742 closed simbu94 Cancel a payment with paymentData and no VoidTransaction function creates an error 
png Screenshot from 2015-12-17 15:16:07.png (334,328) 2015-12-17 15:17
https://issues.openbravo.com/file_download.php?file_id=8815&type=bug
Issue History
2015-12-17 15:15guillermogilNew Issue
2015-12-17 15:15guillermogilAssigned To => Retail
2015-12-17 15:15guillermogilTriggers an Emergency Pack => No
2015-12-17 15:16guillermogilDescription Updatedbug_revision_view_page.php?rev_id=10502#r10502
2015-12-17 15:17guillermogilFile Added: Screenshot from 2015-12-17 15:16:07.png
2015-12-17 15:17guillermogilDescription Updatedbug_revision_view_page.php?rev_id=10503#r10503
2015-12-17 15:17guillermogilRelationship addedrelated to 0031742
2016-05-25 14:03ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2016-05-25 14:04ranjith_qualiantech_comStatusnew => scheduled
2016-05-25 14:31ranjith_qualiantech_comAssigned Toranjith_qualiantech_com => Retail
2016-05-25 14:31ranjith_qualiantech_comStatusscheduled => acknowledged
2016-05-26 10:15guillermogilProposed Solution updated
2016-05-26 10:18guillermogilProposed Solution updated
2016-11-02 15:52guillermogilRegression date => 2016-11-30
2016-11-07 13:06guillermogilResolution time => 1480460400
2016-11-07 13:06guillermogilRegression date2016-11-30 =>
2016-11-09 14:10ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2016-11-09 14:11ranjith_qualiantech_comStatusacknowledged => scheduled
2016-11-25 11:12hgbotCheckin
2016-11-25 11:12hgbotNote Added: 0091828
2016-11-25 11:12hgbotStatusscheduled => resolved
2016-11-25 11:12hgbotResolutionopen => fixed
2016-11-25 11:12hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/34c9be669bbc214ddc2221acfb6c5592251637dd [^]
2016-12-06 13:50ranjith_qualiantech_comNote Added: 0092141
2016-12-06 13:50ranjith_qualiantech_comStatusresolved => new
2016-12-06 13:50ranjith_qualiantech_comResolutionfixed => open
2016-12-06 13:50ranjith_qualiantech_comStatusnew => scheduled
2016-12-09 11:53hgbotCheckin
2016-12-09 11:53hgbotNote Added: 0092241
2016-12-09 11:53hgbotCheckin
2016-12-09 11:53hgbotNote Added: 0092242
2016-12-09 11:53hgbotStatusscheduled => resolved
2016-12-09 11:53hgbotResolutionopen => fixed
2016-12-09 11:53hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/34c9be669bbc214ddc2221acfb6c5592251637dd [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/820f74284a6718a8677a80c19fda6be9bdd21699 [^]
2016-12-12 11:51marvintmNote Added: 0092279
2016-12-12 11:51marvintmStatusresolved => new
2016-12-12 11:51marvintmResolutionfixed => open
2016-12-12 11:51marvintmStatusnew => scheduled
2016-12-14 15:46hgbotCheckin
2016-12-14 15:46hgbotNote Added: 0092357
2016-12-14 15:46hgbotStatusscheduled => resolved
2016-12-14 15:46hgbotResolutionopen => fixed
2016-12-14 15:46hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/820f74284a6718a8677a80c19fda6be9bdd21699 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/157a89812fe44aa1691883a2f41189c8700c2081 [^]
2016-12-14 15:47hgbotCheckin
2016-12-14 15:47hgbotNote Added: 0092358
2016-12-14 16:38marvintmReview Assigned To => marvintm
2016-12-14 16:38marvintmStatusresolved => closed
2016-12-14 16:38marvintmFixed in Version => RR17Q1

Notes
(0091828)
hgbot   
2016-11-25 11:12   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 34c9be669bbc214ddc2221acfb6c5592251637dd
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Nov 25 15:42:04 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/34c9be669bbc214ddc2221acfb6c5592251637dd [^]

Fixes issue 31743 : Adding condition to call Payment provider voidTransaction if it is not present in payment

* If payment added through External Payment Provider, after refreshing we lost instance of voidTransaction. So while voiding payment it should check the voidTransaction in paymentprovider through prototype

---
M web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
---
(0092141)
ranjith_qualiantech_com   
2016-12-06 13:50   
Issue Reopened, voidTransaction should be checked first through prototype of Payment Provider and then it should check through paymentData

Once issue fixed, Wiki & Sample module should be updated
(0092241)
hgbot   
2016-12-09 11:53   
Repository: erp/pmods/org.openbravo.retail.paymentprovider
Changeset: 9c344bda7f1ae37ba00cecedca65cd66eb044244
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Dec 09 15:46:25 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.paymentprovider/rev/9c344bda7f1ae37ba00cecedca65cd66eb044244 [^]

Related to issue 31743 : Modified voidTransaction API

* If voidTransaction is defined in top level, the it will be accessible through prototype

---
M web/org.openbravo.retail.paymentprovider/js/connector.js
---
(0092242)
hgbot   
2016-12-09 11:53   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 820f74284a6718a8677a80c19fda6be9bdd21699
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Dec 09 15:46:36 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/820f74284a6718a8677a80c19fda6be9bdd21699 [^]

Fixes issue 31743 : Modified API to call Payment provider voidTransaction

* While removing payment, in first to voidTransaction fn present in External Payment Provider throught prototype.
  If it not exists, it should check with payment Data
* New params receipt, payment added to voidTransacion function

---
M web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
---
(0092279)
marvintm   
2016-12-12 11:51   
There is a problem with the way the function voidTransaction is being called right now.

The problem is that we have changed the parameters which are sent to this function. Before, only the callback was sent. Now, the order, payment and callback are sent. As they are sent in this order, for voidTransaction functions which were defined at payment level, the API is now broken, as they will expect that the callback is the first parameter, and now this is not the case.

The solution is quite easy, just call the voidTransaction function with the callback first, and then the order and payment. This way, old voidTransaction functions will still work, and new ones will receive the three parameters correctly.

Don't forget also to change the existing payment provider module.
(0092357)
hgbot   
2016-12-14 15:46   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 157a89812fe44aa1691883a2f41189c8700c2081
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Dec 14 20:15:46 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/157a89812fe44aa1691883a2f41189c8700c2081 [^]

Fixes issue 31743 : Modified API to call Payment provider voidTransaction

* Moved new Params(receipt, payment) for voidTransaction fn to last to support old api for callback

---
M web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
---
(0092358)
hgbot   
2016-12-14 15:47   
Repository: erp/pmods/org.openbravo.retail.paymentprovider
Changeset: abdda8f527731e39f1b08d374a4a961de497f358
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Dec 14 20:17:08 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.paymentprovider/rev/abdda8f527731e39f1b08d374a4a961de497f358 [^]

Related to issue 31743 : Modified voidTransaction API

* Moved new Params(receipt, payment) for voidTransaction fn to last to support old api for callback

---
M web/org.openbravo.retail.paymentprovider/js/connector.js
---