augustin-wien / augustina-backend

An open-source web shop designed for selling magazines on the street.
GNU Affero General Public License v3.0
4 stars 0 forks source link

PaymentOrder API #32

Closed jofmi closed 1 year ago

jofmi commented 1 year ago

Type of change

Description

Checklist:

jofmi commented 1 year ago

To make your whole concept work the frontend also has to send the parameter s back, which is the orderCode of VivaWallet and in your code declared as transactionID. I gave two suggestions in the comments below.

So the OrderCode is generated by the backend when it creates the Order and the TransactionID is generated by the Frontend when the payment is made?

lebe1 commented 1 year ago

To make your whole concept work the frontend also has to send the parameter s back, which is the orderCode of VivaWallet and in your code declared as transactionID. I gave two suggestions in the comments below.

So the OrderCode is generated by the backend when it creates the Order and the TransactionID is generated by the Frontend when the payment is made?

Kind of true since all ID's are actually generated by VivaWallet but the backend receives the OrderCode and the frontend the TransactionID. I think it is more intuitive to also include VivaWallet's part in this process. First, the orderCode created by VivaWallet is received by the backend and the backend can therefore send the checkout url to the frontend. At this point VivaWallet has noticed that a payment will be made soon and lets a timeout run and other security stuff probably. When the checkout is finished VivaWallet creates a transactionID and redirects the user to the success page with transactionID and orderCode as param t and s. This transactionID can then be used for verification. This url is extracted by the frontend and for now only sends a POST-request for verification with the transactionID. To make our concept work, we need the transactionID for verification and the orderCode for the database queries. This diagram also helped me a lot to understand it.

jofmi commented 1 year ago

image

jofmi commented 1 year ago

ah yes, it should both be strings

jofmi commented 1 year ago

I still had the editor open so i fixed it @lebe1

jofmi commented 1 year ago

No, since I had trouble with the testing DB the handler isn't tested yet - so there's likely a few issues left. I think this one was connected to the router, tried to fix it

lebe1 commented 1 year ago

No, since I had trouble with the testing DB the handler isn't tested yet - so there's likely a few issues left. I think this one was connected to the router, tried to fix it

Yes just figured this one also out on my own... Maybe I stop posting all my swagger and try solving it on my own before I annoy you again :upside_down_face:

jofmi commented 1 year ago

I would always look at the logs in docker, they give you a error trace with the line of code and everything

jofmi commented 1 year ago

I just realize how valuable the tests usually are to prevent this kind of gradual fixing. Sorry that you have to review without it being properly tested in this case! In any case, I think I found the error

lebe1 commented 1 year ago

I just realize how valuable the tests usually are to prevent this kind of gradual fixing. Sorry that you have to review without it being properly tested in this case! In any case, I think I found the error

Yes looks good! And good point using docker logs! I just realized the specific line is meant by the numbers on the end of each log like "/app/database/queries.go:196"

jofmi commented 1 year ago

Yes, please add as a future todo then that the CreateAccount query needs a validation check that prevents these from being created a second time