Skip to content

Conversation

sai-harsha-vardhan
Copy link
Contributor

@sai-harsha-vardhan sai-harsha-vardhan commented Nov 8, 2023

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

add gateway_status_map CRUD APIs

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Tested Manually

  1. GSM Create
    CURL
 curl --location --request POST 'https://sandbox.hyperswitch.io/gsm' \
--header 'api-key: {ADMIN_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "connector": "stripe",
    "flow": "Authorize",
    "sub_flow": "sub_flow",
    "code": "incorrect_cvc",
    "message": "incorrect_cvc",
    "status": "failure",
    "decision": "retry",
    "step_up_possible": true
}' 

image
image

  1. GSM Update
    CURL
curl --location --request POST 'https://sandbox.hyperswitch.io/gsm/update' \
--header 'api-key: {ADMIN_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "connector": "stripe",
    "flow": "Authorize",
    "sub_flow": "sub_flow",
    "code": "incorrect_cvc",
    "message": "incorrect_cvc",
    "decision": "do_default"
}' 

image

  1. GSM Retrieve
    CURL
curl --location --request POST 'https://sandbox.hyperswitch.io/gsm/get' \
--header 'api-key: {ADMIN_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "connector": "stripe",
    "flow": "Authorize",
    "sub_flow": "sub_flow",
    "code": "incorrect_cvc",
    "message": "incorrect_cvc"
}' 

image

  1. GSM Delete
    CURL
curl --location --request POST 'https://sandbox.hyperswitch.io/gsm/delete' \
--header 'api-key: {ADMIN_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "connector": "stripe",
    "flow": "Authorize",
    "sub_flow": "sub_flow",
    "code": "incorrect_cvc",
    "message": "incorrect_cvc"
}'

image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@sai-harsha-vardhan sai-harsha-vardhan added A-core Area: Core flows C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Nov 8, 2023
@sai-harsha-vardhan sai-harsha-vardhan self-assigned this Nov 8, 2023
@sai-harsha-vardhan sai-harsha-vardhan requested review from a team as code owners November 8, 2023 09:49
Base automatically changed from add-gsm-interface to main November 8, 2023 10:38
Comment on lines +677 to +679
.service(web::resource("/get").route(web::post().to(get_gsm_rule)))
.service(web::resource("/update").route(web::post().to(update_gsm_rule)))
.service(web::resource("/delete").route(web::post().to(delete_gsm_rule)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the endpoints and http methods do not match, ideally get should go with the GET http method, same for the rest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all CRUD APIs we need payload with connector, flow, sub_flow, code and message fields

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GET endpoint can use query parameters if the values are all single values (and not a list of values).

@Narayanbhat166
Copy link
Contributor

In order to make it easier to use the gsm apis, a gsm list endpoint will be a good addition. This endpoint can have filters for connector, flow_type etc. Also the update endpoint should not allow the primary key fields to be updated and instead allow only the actions ( step_up, retry_action etc ) to be updated. Each gsm can have a unique identifier gsm_abcd which will act as a primary key to update / delete the gsm entry.

This can be added as a good first issue.

Narayanbhat166
Narayanbhat166 previously approved these changes Nov 9, 2023
SanchithHegde
SanchithHegde previously approved these changes Nov 9, 2023
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that, looks good to me!

Comment on lines +677 to +679
.service(web::resource("/get").route(web::post().to(get_gsm_rule)))
.service(web::resource("/update").route(web::post().to(update_gsm_rule)))
.service(web::resource("/delete").route(web::post().to(delete_gsm_rule)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GET endpoint can use query parameters if the values are all single values (and not a list of values).

@likhinbopanna
Copy link
Contributor

@sai-harsha-vardhan Can you add the cURL request?

@likhinbopanna likhinbopanna added this pull request to the merge queue Nov 9, 2023
@likhinbopanna likhinbopanna removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Nov 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 9, 2023
@Narayanbhat166
Copy link
Contributor

are the errors due to changes in this PR?

@sai-harsha-vardhan
Copy link
Contributor Author

are the errors due to changes in this PR?

@Narayanbhat166 This is due to APIEventMetrics which are added recently, fixing it!

@likhinbopanna likhinbopanna added this pull request to the merge queue Nov 9, 2023
Merged via the queue into main with commit 5c9e235 Nov 9, 2023
@likhinbopanna likhinbopanna deleted the add-gsm-core-apis branch November 9, 2023 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants