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(wallet/backend): add script for managed user and customer creation #1675

Merged
merged 13 commits into from
Oct 10, 2024

Conversation

sanducb
Copy link
Contributor

@sanducb sanducb commented Oct 3, 2024

Context

Changes

This PR adds the script for managed user and customer creation as well as the updated types and card ordering logic.

@sanducb sanducb self-assigned this Oct 3, 2024
@sanducb sanducb linked an issue Oct 3, 2024 that may be closed by this pull request
@github-actions github-actions bot added package: wallet/backend Wallet backend implementations type: source Source changes labels Oct 3, 2024
Copy link
Member

@raducristianpopa raducristianpopa left a comment

Choose a reason for hiding this comment

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

Based on a discussion with Bogdan:

  • when we create the managed user we want to add the payment pointer in the meta object.
    • if the user signs up and verifies the email, we can automatically create the payment pointer on our side with the correct value (i.e: 059)
    • waiting for response ^ we can pass the meta object when creating the managed user
  • whitelisting: whenever someone tries to sign up, we fetch all managed users and we check if the email exists
    • if the user exists, we can retrieve the payment pointer from the meta object and create the payment pointer
    • if the user doesn't exist: TBD

sanducb and others added 2 commits October 8, 2024 18:07
- Update ENV variables (DEV & PROD)
- Fix API endpoints
- Update types
meta: Record<string, string>
): Promise<void> {
const url = `${this.apiUrl}/auth/v1/users/managed`
const body = { meta }
Copy link
Member

Choose a reason for hiding this comment

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

This was the reason for the faulty meta object.

Copy link
Member

Choose a reason for hiding this comment

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

Added a comment and updated the types for the meta object here: 930e750.

packages/wallet/backend/src/user/model.ts Show resolved Hide resolved
@raducristianpopa raducristianpopa force-pushed the 1667-cards-wallet-backend-customer-creation branch from 0599b2a to 930e750 Compare October 9, 2024 03:54
@sanducb sanducb marked this pull request as ready for review October 9, 2024 07:30
ppNumber: string
}

const entries = `John;Doe;john@doe.com:8888
Copy link
Contributor

Choose a reason for hiding this comment

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

is this for example porposes? can the list be read from an external file?

Copy link
Member

Choose a reason for hiding this comment

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

This is how the entries should be added. It can be updated to read from an external file as well, but for simplicity reason we decided to just put the CSV contents directly in the variable.

)

const user = await gateHubClient.getWalletForUser(managedUser.id)
const walletAddress = user.wallets[0].address
Copy link
Contributor

Choose a reason for hiding this comment

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

should we use the default wallet created instead of creating on for each account?

Copy link
Member

@raducristianpopa raducristianpopa Oct 9, 2024

Choose a reason for hiding this comment

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

getWalletForUser retrieves the already created wallet - when the managed user is created. We are not creating another wallet here.

dragosp1011
dragosp1011 previously approved these changes Oct 9, 2024
@raducristianpopa raducristianpopa marked this pull request as draft October 9, 2024 17:58
@sanducb
Copy link
Contributor Author

sanducb commented Oct 10, 2024

Latest changes look good @raducristianpopa, thank you! However, I think we can already rename GATEHUB_NAME_ON_CARD_PREFIX to something like GATEHUB_NAME_ON_CARD and have it default to "INTERLEDGER" since we will never be allowed to use payment pointers as a card holder name. That, of course, would require us to modify the cardUsers script which is the only place GATEHUB_NAME_ON_CARD_PREFIX is used. Thoughts?

@raducristianpopa
Copy link
Member

raducristianpopa commented Oct 10, 2024

I think we can already rename GATEHUB_NAME_ON_CARD_PREFIX to something like GATEHUB_NAME_ON_CARD

Oh, yes! A lot better than keeping the card prefix there.

@sanducb sanducb merged commit a9a4331 into main Oct 10, 2024
15 checks passed
@sanducb sanducb deleted the 1667-cards-wallet-backend-customer-creation branch October 10, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: wallet/backend Wallet backend implementations type: source Source changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cards] Wallet Backend - Customer creation and card ordering
3 participants