adding stripe modular example - #29
Conversation
|
Let's also add a readme file as in the rest of the examples |
| @@ -0,0 +1,34 @@ | |||
| module issuing | |||
There was a problem hiding this comment.
Looks like an odd module name. What would be the app component handling this called? "card-management""
| define view_only: [user] or admin | ||
| define transfer_analyst_in_test_mode: transfer_analyst but not transfer_analyst from test_mode # intermediate relations, just used for evaluating other relations | ||
|
|
||
| define test_mode: [account] # self-defining relationship, used to set a type into a true/false state |
There was a problem hiding this comment.
We should explain in the comments what is test mode used for in Stripe
|
|
||
| extend type account | ||
| relations | ||
| define card: [card] # dual-writes relationships between card & account, when you need to traverse relations on two types checking both ways (starting at card then going up or account then going down) |
There was a problem hiding this comment.
Can you clarify why we need to traverse it both ways?
| ## default spending limit is 500 USD a day | ||
| ## could be 100 USD per transaction | ||
| ## could be 3000 USD per month | ||
| condition spending_limit(transaction_amount: double, transaction_limit: double, daily_amount: double, daily_limit: double, monthly_amount: double, monthly_limit: double) { |
There was a problem hiding this comment.
We should have tuples/tests that use the condition
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a new modular example for modeling Stripe's core functionality using OpenFGA. It splits the model into three modules (accounts, payments, and issuing) and defines test scenarios for verifying relationships and permissions.
- Adds a Stripe model with tuple definitions for core and issuing functionalities.
- Includes tests covering two scenarios: multiple cards with varying statuses and a test-mode account.
Files not reviewed (4)
- stores/stripe/accounts.fga: Language not supported
- stores/stripe/fga.mod: Language not supported
- stores/stripe/issuing.fga: Language not supported
- stores/stripe/payments.fga: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
This PR has had no human activity for 90 days, so it has been marked This is automated backlog grooming, not a judgment on the work. What happens next, unless there is activity:
To keep it open, push a commit or leave a comment, and the clock will reset. For work that should not auto-close, such as an RFC or long-running experiment, ask a maintainer to add |
|
This PR has had no human activity for 30 days since being marked It will be closed in 30 days unless there is new activity. If the work still matters, this is the moment to say so: leave a comment, push a commit, or ask a maintainer to add If this work is no longer being pursued, no action is needed. |
Description
This example models a few of Stripe's core functionality, but not everything.
It introduces another modular models example splitting the model into 3 modules:
accounts.fga- core Stripe account functionalitypayments.fga- (yet to be implemented)issuing.fga- credit card issuing and transactionsIt also introduces modeling concepts such as "self-defining" relationships, "dual-write" relationships, and "intermediate" relationships. It also uses exclusions and conditions.
It includes tests for two scenarios:
Review Checklist
main