diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..924011e --- /dev/null +++ b/.env.example @@ -0,0 +1,10 @@ +# Database +DB_ROOT_USERNAME=agapay +DB_ROOT_PASSWORD=payments4all +DB_PORT=5433 +DATABASE_URL='postgresql://agapay:payments4all@db:5433/agapay?connect_timeout=300' + +# Agapay +INCREASE_SANDBOX=true +INCREASE_API_KEY={REPLACE_ME} +BANK_ENTITY={REPLACE_ME} diff --git a/README.md b/README.md index 0010023..1d55317 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,14 @@ make make test ``` +### Configure environment variables + +Copy the `.env.example` file to `.env` and update the values as needed. + +```bash +cp .env.example .env +``` + ### Run locally First run the following command to spin up the docker containers: diff --git a/prisma/ERD.md b/prisma/ERD.md index e02df7e..5b15c04 100644 --- a/prisma/ERD.md +++ b/prisma/ERD.md @@ -72,6 +72,14 @@ erDiagram BigInt user_id FK DateTime created_at } +"payment_intent" { + BigInt id PK + BigInt amount + String chariot_id "nullable" + String recipient_id FK + BigInt user_id FK + DateTime created_at +} "transfer" { BigInt id PK BigInt amount @@ -98,6 +106,7 @@ erDiagram BigInt id PK String account_number String routing_number + payment_rail preferred_payment_rail "nullable" bank_address_status status DateTime updated_at } @@ -113,6 +122,8 @@ erDiagram "payment" }|--|| "recipient" : recipient "payment" }o--|| "idempotency_key" : idempotency_key "payment" }|--|| "user" : user +"payment_intent" }|--|| "recipient" : recipient +"payment_intent" }|--|| "user" : user "transfer" }|--|| "account" : account "transfer" }o--|| "idempotency_key" : idempotency_key "transfer" }|--|| "user" : user @@ -198,6 +209,16 @@ erDiagram - `user_id`: - `created_at`: +### `payment_intent` + +**Properties** + - `id`: + - `amount`: + - `chariot_id`: + - `recipient_id`: + - `user_id`: + - `created_at`: + ### `transfer` **Properties** @@ -230,5 +251,6 @@ erDiagram - `id`: - `account_number`: - `routing_number`: + - `preferred_payment_rail`: - `status`: - `updated_at`: \ No newline at end of file diff --git a/schema.prisma b/schema.prisma index 3a87cce..393f76e 100644 --- a/schema.prisma +++ b/schema.prisma @@ -203,6 +203,7 @@ model payment { // payment_intent represents a payment intent from an account to a recipient // this is used to track offline payments that are not processed through the API +// TODO: this is not currently used and needs some more thought model payment_intent { // the unique identifier for the payment intent id BigInt @id @default(autoincrement()) @db.BigInt @@ -217,7 +218,11 @@ model payment_intent { user_id BigInt @db.BigInt user user @relation(fields: [user_id], references: [id], onDelete: Restrict, onUpdate: Cascade, map: "fk_payment_intent_user") // the time the intent was created - created_at DateTime @default(now()) @db.Timestamptz(6) + created_at DateTime @default(now()) @db.Timestamptz(6) + + @@index([chariot_id], map: "idx_payment_intent_chariot_id") + @@index([recipient_id], map: "idx_payment_intent_recipient_id") + @@index([user_id], map: "idx_payment_intent_user_id") } // transfer represents a transfer of funds into an account