Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(router): add support v2 /add /retrieve /delete api handler #127

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

ShankarSinghC
Copy link
Collaborator

@ShankarSinghC ShankarSinghC commented Oct 28, 2024

This pr adds the api handler to /add /retrieve and /delete v2 endpoints.
Also adds /fingerprint under v2 that uses the same function as v1 just for the unification purpose .

test case
-> Add data

curl --location 'http://localhost:3030/api/v2/vault/add' \
--header 'x-tenant-id: hyperswitch' \
--header 'Content-Type: application/json' \
--data '{
    "entity_id": "hyperswitch",
    "vault_id": "123456789",
    "data": {
        "card_number": "4111111111111111",
        "name_on_card": "hyperswitch vaut"
    }
}'
{
    "entity_id": "hyperswitch",
    "vault_id": "123456789"
}
image image

-> retrieve data

curl --location 'http://localhost:3030/api/v2/vault/retrieve' \
--header 'x-tenant-id: hyperswitch' \
--header 'Content-Type: application/json' \
--data '{
   "entity_id": "hyperswitch",
    "vault_id": "123456789"
}'
{
    "data": {
        "card_number": "4111111111111111",
        "name_on_card": "hyperswitch vaut"
    }
}

-> delete data

curl --location 'http://localhost:3030/api/v2/vault/delete' \
--header 'x-tenant-id: hyperswitch' \
--header 'Content-Type: application/json' \
--data '{
    "entity_id": "hyperswitch",
    "vault_id": "123456789"
}'
{
    "entity_id": "hyperswitch",
    "vault_id": "123456789"
}
image

@ShankarSinghC ShankarSinghC requested review from Chethan-rao and NishantJoshi00 and removed request for Chethan-rao October 28, 2024 16:34
@ShankarSinghC ShankarSinghC self-assigned this Oct 28, 2024
Copy link
Member

@NishantJoshi00 NishantJoshi00 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, LGTM

config/development.toml Outdated Show resolved Hide resolved
config/development.toml Show resolved Hide resolved
config/development.toml Outdated Show resolved Hide resolved
src/routes/data/crypto_operation.rs Outdated Show resolved Hide resolved
src/routes/data/transformers.rs Outdated Show resolved Hide resolved
.find_by_entity_id(&tenant_app_state, request.entity_id.clone())
.await?;

let _delete_status = tenant_app_state
Copy link
Member

Choose a reason for hiding this comment

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

what's the _delete_status? can we put a assertion for this to make absolutely sure that the deletion happened?

src/storage/storage_v2.rs Show resolved Hide resolved
@NishantJoshi00 NishantJoshi00 merged commit bcdd80e into locker/v2 Oct 30, 2024
4 checks passed
@NishantJoshi00 NishantJoshi00 deleted the locker/v2-api-handler branch October 30, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants