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: create key in encryption service for merchant and user #4910

Merged
merged 30 commits into from
Jul 11, 2024

Conversation

dracarys18
Copy link
Member

@dracarys18 dracarys18 commented Jun 7, 2024

Type of Change

  • New feature

Description

This PR adds support to

  • Create Key for every User and Merchant during User and Merchant Account Create.
  • Add an API to transfer Keys to KeyManager
  • Add MTLS for KeyManager Client

Additional Changes

  • This PR modifies application configuration/environment variables

Motivation and Context

  • Create Key in Key Manager for every merchant

How did you test it?

Tests for Create a Merchant

curl --location 'http:https://localhost:8080/accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
  "merchant_id": "merchant_1720435957",
  "locker_id": "m0010",
  "merchant_name": "NewAge Retailer",
  "merchant_details": {
    "primary_contact_person": "John Test",
    "primary_email": "[email protected]",
    "primary_phone": "sunt laborum",
    "secondary_contact_person": "John Test2",
    "secondary_email": "[email protected]",
    "secondary_phone": "cillum do dolor id",
    "website": "www.example.com",
    "about_business": "Online Retail with a wide selection of organic products for North America",
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US"
    }
  },
  "return_url": "https://google.com/success",
  "webhook_details": {
    "webhook_version": "1.0.1",
    "webhook_username": "ekart_retail",
    "webhook_password": "password_ekart@123",
    "payment_created_enabled": true,
    "payment_succeeded_enabled": true,
    "payment_failed_enabled": true
  },
  "sub_merchants_enabled": false,
  "metadata": {
    "city": "NY",
    "unit": "245"
  },
  "primary_business_details": [
    {
      "country": "US",
      "business": "default"
    }
  ]
}'
  • Verify /key/create to Keymanager was succeeded.
    The response status of keymanager_response should be 200
Screenshot 2024-07-11 at 5 01 27 PM

Create Key for User

  • Signin with the account and password
curl --location 'http:https://localhost:8080/user/v2/signin?token_only=true' \
--header 'Content-Type: application/json' \
--data-raw '{
 "email": "[email protected]",
    "password": "gagagagag@1234"
}'

  • Begin TOTP flow
curl --location 'http:https://localhost:8080/user/2fa/totp/begin' \
--header 'Authorization: Bearer spt'
  • Verify that call to /key/create is successful in the logs

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

@dracarys18 dracarys18 added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jun 7, 2024
@dracarys18 dracarys18 added this to the May 2024 Release milestone Jun 7, 2024
@dracarys18 dracarys18 self-assigned this Jun 7, 2024
@dracarys18 dracarys18 requested review from a team as code owners June 7, 2024 09:50
@dracarys18 dracarys18 changed the title feat: create key in encryption service during merchant account and us… feat: create key in encryption service for merchant and user Jun 7, 2024
ArjunKarthik
ArjunKarthik previously approved these changes Jun 7, 2024
ArjunKarthik
ArjunKarthik previously approved these changes Jul 4, 2024
Copy link
Contributor

@ArjunKarthik ArjunKarthik left a comment

Choose a reason for hiding this comment

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

LGTM

@dracarys18 dracarys18 linked an issue Jul 8, 2024 that may be closed by this pull request
@dracarys18 dracarys18 dismissed stale reviews from racnan and ArjunKarthik via 55f95fe July 11, 2024 09:07
ArjunKarthik
ArjunKarthik previously approved these changes Jul 11, 2024
racnan
racnan previously approved these changes Jul 11, 2024
jarnura
jarnura previously approved these changes Jul 11, 2024
lsampras
lsampras previously approved these changes Jul 11, 2024
@ArjunKarthik ArjunKarthik removed the request for review from ThisIsMani July 11, 2024 10:47
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 11, 2024
Merged via the queue into main with commit 43741df Jul 11, 2024
17 checks passed
@Gnanasundari24 Gnanasundari24 deleted the add_encryption_service branch July 11, 2024 15:30
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] add key in keymanager
9 participants