AndriyMal / Keleya-website

GNU General Public License v2.0
0 stars 0 forks source link

[online payment] Check-the end-points. The user is not converted to the premium one #9

Open AndriyMal opened 4 years ago

samaronybarros commented 4 years ago

@AndriyMal and @nferbey

Can you guys give me an example of how are you guys calling the endpoint?

The endpoint is working on the mobile side, maybe it's just a parameter missing that is causing this small issue.

nferbei commented 4 years ago

Hello. Sure, examples below: 1 - update user:

PATCH /api/V4/user HTTP/1.1

Host: app-stage.keleya.de https://slack-redir.net/link?url=http%3A%2F%2Fapp-stage.keleya.deAuthorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImVkNDc3OWY5LTM5ZGYtNDI0MS04NmQ1LWE2YTM3Y2VlZTUyOCIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNTgyOTc1Mzg2fQ.fBVBZQ6N4j9uT36iW852rg1xQujWr8xFuluAg6JU-b4 Content-Type: application/json Cache-Control: no-cache Postman-Token: 8d1e95b8-5ce6-caa2-1c58-e3b17f2c0ae9 { "id": "ed4779f9-39df-4241-86d5-a6a37ceee528", "status": "subscribed-1", "name": "Mama", "email": "test@te.st", "birthPrep": "subscribed", "pregnancyWeek": 11, "dueDate": "2020-09-21T09:00:00.000Z", "pregnancyStatus": "pregnant", "activityLevel": 1, "imageUrl": null, "dislikedIngredients": [], "allergies": [], "foodPreference": { "fishAllowed": true, "meatAllowed": false }, "onboardingDone": true, "allowNewsletter": null, "allowNotification": null, "language": "en", "country": "ua", "badges": [], "hasAccessToCore": false, "hasAccessToBirthPrep": true, "workoutGoal": "4" }

2 - Payment

POST /api/V1/payments HTTP/1.1 Host: app-stage.keleya.de https://slack-redir.net/link?url=http%3A%2F%2Fapp-stage.keleya.deAuthorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImVkNDc3OWY5LTM5ZGYtNDI0MS04NmQ1LWE2YTM3Y2VlZTUyOCIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNTgyOTc1Mzg2fQ.fBVBZQ6N4j9uT36iW852rg1xQujWr8xFuluAg6JU-b4 Content-Type: application/json Cache-Control: no-cache Postman-Token: 2c71351c-b2e8-f31b-9e36-587307c9a5aa { "subscription": "1m", "purchaseType": "stripe", "receipt": "ZW5kcMSF" }

пн, 16 мар. 2020 г. в 20:33, Sam Barros notifications@github.com:

@AndriyMal https://github.com/AndriyMal and @nferbey https://github.com/nferbey

Can you guys give me an example of how are you guys calling the endpoint?

The endpoint is working on the mobile side, maybe it's just a parameter missing that is causing this small issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-599696487, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVBKWD54GAT53K6XOFBU2LRHZWIPANCNFSM4LFBS34A .

-- 👤 Назарий Фербей 📞 +380664335158 📞 +380933646024 ✉️ https://t.me/ferbey ferbeyofficial@gmail.com

samaronybarros commented 4 years ago

Hey @nferbey

I didn't reproduce your test yet, but I realized that you are using POST /api/V1/payments, why are you not using POST /api/V4/payments?

nferbei commented 4 years ago

@samaronybarros at the time of integration in API doc was be V1 and i did not receive info about update. Maybe you can just export your working requset example from postman? Maybe error in request

nferbei commented 4 years ago

in V4 it is dont working too

nferbei commented 4 years ago

Code for update user status here: https://github.com/AndriyMal/Keleya-website/blob/master/payment-system/inc/userManager.php I getting current user, just changing one field and make request to update.

The most better example: HTTP request for updating user statusfrom free to subscribed-1m

PATCH /api/V4/user HTTP/1.1

Host: app-stage.keleya.de Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImVkNDc3OWY5LTM5ZGYtNDI0MS04NmQ1LWE2YTM3Y2VlZTUyOCIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNTgyOTc1Mzg2fQ.fBVBZQ6N4j9uT36iW852rg1xQujWr8xFuluAg6JU-b4 Content-Type: application/json Cache-Control: no-cache Postman-Token: ef2a93a4-a885-4ade-312e-58ca005c45c1 { "id": "ed4779f9-39df-4241-86d5-a6a37ceee528", "status": "subscribed-1m", "name": "Mama2", "email": "test@te.st", "birthPrep": "subscribed", "pregnancyWeek": 11, "dueDate": "2020-09-21T09:00:00.000Z", "pregnancyStatus": "pregnant", "activityLevel": 3, "imageUrl": null, "dislikedIngredients": [], "allergies": [], "foodPreference": { "fishAllowed": false, "meatAllowed": false }, "onboardingDone": true, "allowNewsletter": null, "allowNotification": null, "language": "en", "country": "ua", "badges": [], "hasAccessToCore": false, "hasAccessToBirthPrep": true, "workoutGoal": "4" }

пн, 16 мар. 2020 г. в 21:42, Sam Barros notifications@github.com:

Hey @nferbey https://github.com/nferbey

I didn't reproduce your test yet, but I realized that you are using POST /api/V1/payments, why are you not using POST /api/V4/payments?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-599725714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVBKWBJF4MVV4F65WAFFSDRHZ6I3ANCNFSM4LFBS34A .

-- 👤 Назарий Фербей 📞 +380664335158 📞 +380933646024 ✉️ https://t.me/ferbey ferbeyofficial@gmail.com

samaronybarros commented 4 years ago

Hey @nferbey

Sorry if you got the wrong version, I'll take a look at it.

Can you send me the response of this request POST /api/V4/payments?

nferbei commented 4 years ago

I havent response body, because code is 400. Request:

POST /api/V4/payments HTTP/1.1 Host: app-stage.keleya.de Content-Type: application/json Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImVkNDc3OWY5LTM5ZGYtNDI0MS04NmQ1LWE2YTM3Y2VlZTUyOCIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNTgyOTc1Mzg2fQ.fBVBZQ6N4j9uT36iW852rg1xQujWr8xFuluAg6JU-b4 Cache-Control: no-cache Postman-Token: 0974e756-2e70-e59c-82ee-d2933d6573dd

{ "subscription": "3m", "purchaseType": "stripe", "receipt": "ZW5kcMSF"

}

ср, 18 мар. 2020 г. в 20:08, Sam Barros notifications@github.com:

Hey @nferbey https://github.com/nferbey

Sorry if you got the wrong version, I'll take a look at it.

Can you send me the response of this request POST /api/V4/payments?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-600782411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVBKWAZMKWIP4DSCDYPP2TRIEEX7ANCNFSM4LFBS34A .

-- 👤 Назарий Фербей 📞 +380664335158 📞 +380933646024 ✉️ https://t.me/ferbey ferbeyofficial@gmail.com

AndriyMal commented 4 years ago

@samaronybarros. Did you find anything suspicious with the user status?

Sam, If you need sth, we are here (me and Nazar) to support you. Fixing online payment is of paramount importance right now)

nferbei commented 4 years ago

@samaronybarros maybe I can help you with something else?

samaronybarros commented 4 years ago

Hey @nferbey and @AndriyMal ,

Sorry, I have just seen your messages too late. However, I made some changes to the code and now it will work properly.

The body structure should be like this

{
 "subscriptionType": "3m",
 "purchaseType": "stripe",
 "receipt": {"forever": false, "expirationDate": "2020-06-18T20:00:00.297Z"}
}

The receipt will just need the time if it will be forever or not. In the case of the core purchase, we always have "forever": false but we'll need it for legacy reasons.

The URL should be on version 4, so something like this: /api/v4/payments.

Here is a simulation on Postman.

stripe

I've created many tests and all of them passed, as you guys can see here.

Screenshot 2020-03-18 at 21 02 14

If you need anything, feel free to talk to me.

samaronybarros commented 4 years ago

Ah,

I will add this in the documentation, I put it here just making the things run faster

samaronybarros commented 4 years ago

Another thing,

If you try to do this now and it doesn't work, it's because I'm still deploying on Staging.

nferbei commented 4 years ago

Thanks. But what about updating user status? If you can't reproduce error maybe you can send me request example? I sended my example earlier

On Wed, 18 Mar 2020, 22:13 Sam Barros, notifications@github.com wrote:

Hey @nferbey https://github.com/nferbey and @AndriyMal https://github.com/AndriyMal ,

Sorry, I have just seen your messages too late. However, I made some changes to the code and now it will work properly.

The body structure should be like this

{ "subscriptionType": "3m", "purchaseType": "stripe", "receipt": {"forever": false, "expirationDate": "2020-06-18T20:00:00.297Z"} }

The receipt will just need the time if it will be forever or not. In the case of the core purchase, we always have "forever": false but we'll need it for legacy reasons.

The URL should be on version 4, so something like this: /api/v4/payments.

Here is a simulation on Postman.

[image: stripe] https://user-images.githubusercontent.com/10220629/77003255-4cd31b80-695d-11ea-8856-87501ebe71d3.gif

I've created many tests and all of them passed, as you guys can see here.

[image: Screenshot 2020-03-18 at 21 02 14] https://user-images.githubusercontent.com/10220629/77002936-b7d02280-695c-11ea-823a-5978a196e536.png

If you need anything, feel free to talk to me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-600836352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVBKWHKZ5CIGR2KSUHIVZDRIETPVANCNFSM4LFBS34A .

samaronybarros commented 4 years ago

Hey @nferbey, take a look at the GIF. You'll see the user being updated.

nferbei commented 4 years ago

I understood, sorry. Thank you

On Wed, 18 Mar 2020, 22:28 Sam Barros, notifications@github.com wrote:

Hey @nferbey https://github.com/nferbey, take a look at the GIF. You'll see the user being updated.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-600842631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVBKWHLMPNAJFF75EFLXJ3RIEVGNANCNFSM4LFBS34A .

nferbei commented 4 years ago

I used your example but it is still dont working. I attached screenshot. What same payment required? I must make something else before sending this request? [image: image.png]

ср, 18 мар. 2020 г. в 22:29, Назарий Фербей ferbeyofficial@gmail.com:

I understood, sorry. Thank you

On Wed, 18 Mar 2020, 22:28 Sam Barros, notifications@github.com wrote:

Hey @nferbey https://github.com/nferbey, take a look at the GIF. You'll see the user being updated.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-600842631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVBKWHLMPNAJFF75EFLXJ3RIEVGNANCNFSM4LFBS34A .

-- 👤 Назарий Фербей 📞 +380664335158 📞 +380933646024 ✉️ https://t.me/ferbey ferbeyofficial@gmail.com

AndriyMal commented 4 years ago

Sam, thanks a lot for your sacrifice. We will test tomorrow, once the new code is deployed, hope it works:)

AndriyMal commented 4 years ago

Hi, @samaronybarros I hope you are feeling well because I've got a small temperature and a cough.

Please, when you are done with deployment, let's test since everyone including Vici wants it badly to make the online payment live.

samaronybarros commented 4 years ago

Hey @nferbey ,

I came here to write a message to you 🙂

This morning I finished the deployment on the Staging environment. So, feel free to work on int.

Besides, take care of yourself, with this coronavirus pandemic we need to stay alert. Wash your hands and stay at home. Have a good evening.

I will move this PR to User testing because it's regarding to backend.

nferbei commented 4 years ago

@samaronybarros Thanks you a lot, it is working! And thank for you care, be healthy! It was a pleasure working with you, thanks for the help and for the answers.

nferbei commented 4 years ago

@samaronybarros Hello. We have 2 issues and realy need your help. 1 - we have a problem with endpoint. I already sent detail with example of JSON to your email. Please, check it 2 - We need data for connection to production environments. I have access only to staging now. So i need:

samaronybarros commented 4 years ago

Hey @nferbey ,

I've just reproduced your test and it worked

Screenshot 2020-03-21 at 10 19 26

What was the response you got?

AndriyMal commented 4 years ago

Sam, let me check, yesterday due to failed data request, the content on the app was unavailable, I mean no content at all.

On Sat, 21 Mar 2020 at 10:21, Sam Barros notifications@github.com wrote:

Hey @nferbey https://github.com/nferbey ,

I've just reproduced your test and it worked

[image: Screenshot 2020-03-21 at 10 19 26] https://user-images.githubusercontent.com/10220629/77223521-a30ead00-6b5d-11ea-827e-063d9624a693.png

What was the response you got?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-602018049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMCAOBKBFT5LQA3V2EOT633RISBJBANCNFSM4LFBS34A .

samaronybarros commented 4 years ago

Please, do it.

If you need to deploy this on production, let me know.

nferbei commented 4 years ago

Yes, I have the same response. But if you will send get request you can see that updating don't working.

On Sat, 21 Mar 2020, 11:21 Sam Barros, notifications@github.com wrote:

Hey @nferbey https://github.com/nferbey ,

I've just reproduced your test and it worked

[image: Screenshot 2020-03-21 at 10 19 26] https://user-images.githubusercontent.com/10220629/77223521-a30ead00-6b5d-11ea-827e-063d9624a693.png

What was the response you got?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-602018049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVBKWH7YHC4UGT2MWTS5HLRISBJBANCNFSM4LFBS34A .

nferbei commented 4 years ago

Maybe you can just share me your postman project? Using worked example from your project we will have less issues

On Sat, 21 Mar 2020, 11:53 Назарий Фербей, ferbeyofficial@gmail.com wrote:

Yes, I have the same response. But if you will send get request you can see that updating don't working.

On Sat, 21 Mar 2020, 11:21 Sam Barros, notifications@github.com wrote:

Hey @nferbey https://github.com/nferbey ,

I've just reproduced your test and it worked

[image: Screenshot 2020-03-21 at 10 19 26] https://user-images.githubusercontent.com/10220629/77223521-a30ead00-6b5d-11ea-827e-063d9624a693.png

What was the response you got?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndriyMal/Keleya-website/issues/9#issuecomment-602018049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVBKWH7YHC4UGT2MWTS5HLRISBJBANCNFSM4LFBS34A .

samaronybarros commented 4 years ago

Hey Nazar, here is an example

Screenshot 2020-03-21 at 11 02 47
samaronybarros commented 4 years ago

We have a flag that, if you want only the latest symptoms, you can do this

/api/v4/symptoms?latest=true

Screenshot 2020-03-21 at 11 02 20