RUNMODAL and MODIFY

Hi all, I am calling a form to charge the clients VISA cards through a xml gateway. I need to read all payment lines and then save some data from the form, because they might pay with different cards. The code I have tried is: IF Simul.FIND(’-’) THEN REPEAT CLEAR(fTPV); fTPV.SetVar(Simul.“Importe (DL)”, Simul.“Nº documento”); IF fTPV.RUNMODAL = ACTION::Close THEN BEGIN fTPV.OperRes(Simul.“Nº Tarjeta”,Simul.Caducidad); END; Simul.MODIFY; UNTIL Simul.NEXT = 0; But of course Navision 3.70 (native db) doesn’t allow a runmodal without a COMMIT. As I prefer not to use COMMIT, I ask you if you have any suggestions. Thanks Soren

Even if you are in the wrong forum with this question: There is no way to work around that problem with your current way of doing it. Where is the code placed for sending and receiving the XML doc. ? Do you have to wait for a positive/negative answer ?

Hi Thomas, Sorry for being on the wrong forum. I didn’t see until it was sent. The xml is called through ocx on the form I am calling. The answer is an instant Navision saying that I cant use RUNMODAL in the middle of a transaction.

No, what I mean with “answer” is if you get a result back from the OCX saying that the payment has been performed or not.

It takes normally a couple of seconds from the request is sent to the bank until we get the answer.

But you ARE getting an answer back from the bank ? The reason why I’m asking such stupid questions is that we had a similar problem with online payment systems inside our retail solution. In fact the bank most brobably requires that you call a commit after every single positive payment (even if it was just a part of the total amount). The reason for this is that the bank is not working transaction oriented like we do in Navision. Once you are receiving a positive answer back you need to record the positive result regardeless if the next payments fail for whatever reason. Otherwise you are running out of sync between your own payment records and the payment records recorded at the bank. So every single day end procedure (if your payment system is supporting/requiring such procedure) will deliver a total for all payments done. You should compare this to the totals recorded in your own system then. They should never differ which you would risk by not calling the COMMIT after every single positive payment.

Soren, Thomas approach is the right one. COMMIT your data first and then Communicate to the bank the COMMITED Data. Imagine the worst scenario for a moment : You send your data to the bank, you get an ACKnowledgment from the bank confirming they did receive your data then a problem occurs(ie:you loose the client server connection to Navision) Then you will end up in a situation where you did send to the Bank unCOMMITted data which I believe is wrong and should never happen.

Soren : Just out of curiosity : Which POS solution are you using ? I’m Just guessing it’s a POS solution as TPV (Terminal Point de Vente) stands for POS in French [;)]

Hi Thomas and Tarek, Thanks for your replies. Yo have convinced me, I will continue with the COMMIT “solution”. You are right that TPV means POS, although in my case in Spanish (terminal punto de venta). We are using a solution from a Spanish bank, BBVA. Regards

Try running the form off of a tempory version of the table and then when you are done copy it to the real table and process.

quote:

Hi all, I am calling a form to charge the clients VISA cards through a xml gateway. I need to read all payment lines and then save some data from the form, because they might pay with different cards. The code I have tried is: IF Simul.FIND(’-’) THEN REPEAT CLEAR(fTPV); fTPV.SetVar(Simul.“Importe (DL)”, Simul.“Nº documento”); IF fTPV.RUNMODAL = ACTION::Close THEN BEGIN fTPV.OperRes(Simul.“Nº Tarjeta”,Simul.Caducidad); END; Simul.MODIFY; UNTIL Simul.NEXT = 0; But of course Navision 3.70 (native db) doesn’t allow a runmodal without a COMMIT. As I prefer not to use COMMIT, I ask you if you have any suggestions. Thanks Soren
Originally posted by shansen - 2005 Feb 24 : 08:15:20

Hi Shansen, have you tried to copy data in a temporary table variable and then INSERT the data in temporary table? I’m not sure if this will avoid the runmodal error, but it’s worth a try. After you have finished the repeat-until loop, do a loop with the temporary table and paste the values you received from the form in the table, then modify. Would look like this: IF Simul.FIND(’-’) THEN REPEAT CLEAR(fTPV); fTPV.SetVar(Simul.“Importe (DL)”, Simul.“Nº documento”); IF fTPV.RUNMODAL = ACTION::Close THEN BEGIN fTPV.OperRes(Simul.“Nº Tarjeta”,Simul.Caducidad); END; Simul.TRANSFERFIELDS(TempSimul); TempSimul.INSERT; UNTIL Simul.NEXT = 0; TempSimul.RESET; IF TempSimul.FIND(’-’) THEN BEGIN REPEAT Simul.GET([Key Values from TempSimul]); Simul.“Nº Tarjeta” := TempSimul.“Nº Tarjeta”; Simul.Caducidad := TempSimul.Caducidad; Simul.MODIFY; UNTIL TempSimul.NEXT = 0; END; Hope it works.

Jens, this will definitely work around the RUNMODAL problem, but it definitely does NOT work around the problem that the payment with one card goes well and the next card fails. So you are in an inconsistent transaction at this certain moment. This will not allow you to post the payments anyway. From a technical point of view you are right. From a logical point of view, you are wrong. In the end the only valid option is to only accept ONE card payment per document and only accept it as the LAST payment method. If more than one electronic payment is needed. Just sell a voucher with one document and redeem the voucher together with another credit card payment in the next document.