@access_token=f890f065cec35612e60ac02359ede24ffksflak339393933lll @env=dev ### // Create a new subscription POST http://localhost:3000/{{env}}/subscriptions/subscribe HTTP/1.1 content-type: application/json Authorization: Bearer {{access_token}} { "input": { "plan_id": "0247ff29-2dc8-4f3f-893f-74dc6aed1bfd", "card": { "token": "0247ff29-2dc8-4f3f-893f-74dc6aed1bfd", "kind": "credit" }, "data": { "origin": "n2b", "sales_channel": "communication_guideline", "smartfit_unit_id": 1 } }, "session_variables": { "x-hasura-user-id": "4324141341", "x-hasura-role": "patient" } } ### POST http://localhost:3000/{{env}}/subscriptions/cancel HTTP/1.1 content-type: application/json Authorization: Bearer {{access_token}} { "input": { "patient_id": "n6Zs4bO0M6QEroNJLTpFnzRvq5w2", "cancellation_reason_id": "QNvwoy4MA3xZMYprIOVm", "cancellation_other_reason": "Usuário solicitou o cancelamento, no entanto tentamos cancelar após o trial", "ignore_trial": true, "cancellation_requested_by_patient_at": "2020-04-01T00:00:00.000Z" }, "session_variables": { "x-hasura-user-id": "ZdLgO48JNoe0ayjKTscA6Qx6MR52", "x-hasura-role": "users" } } ### POST http://localhost:3000/{{env}}/subscriptions/check HTTP/1.1 content-type: application/json Authorization: Bearer {{access_token}} { "session_variables": { "x-hasura-user-id": "0xbk0QkizCebRZCfJ13CBh5mecX2", "x-hasura-role": "patient" } } ### POST http://localhost:3000/{{env}}/subscriptions/check HTTP/1.1 content-type: application/json Authorization: Bearer {{access_token}} { "input": {}, "session_variables": { "x-hasura-user-id": "mwaaD8Qzx9forRHzZSoHMfURoGi2", "x-hasura-role": "patient", "x-hasura-language": "pt", "x-hasura-locale": "pt_br" } } ### POST http://localhost:3000/{{env}}/subscriptions/check HTTP/1.1 content-type: application/json Authorization: Bearer {{access_token}} { "event": { "session_variables": { "x-hasura-role": "admin" }, "op": "INSERT", "data": { "old": null, "new": { "email": "new_user3@gmail.com", "auth_token": "$2a$10$reApnWD.mjhdVkT6RuI5jOIJ/Muic8fO8xt7SeKMKec6afE0A4KZ6", "height": null, "goal_id": null, "other_restriction": null, "weight_goal": null, "country_code": "pt_BR", "gender_id": 1, "weight": null, "photo_url": null, "published_food_plan_id": null, "document_number": "46377141840", "birth_date": "1993-12-11", "auth_token_created_at": "2020-10-29T18:56:10.686+00:00", "subscription_id": null, "tenant": "smartfit", "name": "Samara", "updated_at": "2020-10-29T18:56:12.443909+00:00", "collaborator": false, "created_at": "2020-10-29T18:56:12.443909+00:00", "id": "0xbk0QkizCebRZCfJ13CBh5mecX2", "cell_phone": "44991274321", "sign_up_at": "2020-10-29T18:56:10.686+00:00", "notes": null, "telegram_id": null, "user_id": null, "level": null, "menu_id": null } } }, "created_at": "2020-10-29T18:56:12.443909Z", "id": "1c0c2986-5887-448a-97fb-261ace53155d", "delivery_info": { "max_retries": 5, "current_retry": 0 }, "trigger": { "name": "check_subscription" }, "table": { "schema": "public", "name": "patients" } } ### POST http://localhost:3000/{{env}}/subscriptions/upgrade HTTP/1.1 content-type: application/json Authorization: Bearer {{access_token}} { "input": { "plan_id": "9c50e4f7-6fbb-4bf9-8dd4-06b39d0bcd65" }, "session_variables": { "x-hasura-user-id": "h9snpRwfqifKPzKpTtHlT4yd50o1", "x-hasura-role": "patient" } } ### // Check the subscription on user creation POST http://localhost:3000/{{env}}/subscriptions/handle_patient_creation HTTP/1.1 content-type: application/json Authorization: Bearer {{access_token}} { "event": { "op": "INSERT", "data": { "old": null, "new": { "id": "0FbavbiG56cTK9tglNoLeI97aEl2" } } }, "trigger": { "name": "check_subscription" } } ### // Regularize overdue installments with new card POST http://localhost:3000/{{env}}/subscriptions/regularize-subscription HTTP/1.1 content-type: application/json Authorization: Bearer {{access_token}} { "input": { "token": "", "kind": "credit", }, "session_variables": { "x-hasura-user-id": "h9snpRwfqifKPzKpTtHlT4yd50o1", "x-hasura-role": "patient" } }