- 
                Notifications
    You must be signed in to change notification settings 
- Fork 102
fix(point-of-sale): added bruno script + added missing env variables to local docker compose file #3629
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
fix(point-of-sale): added bruno script + added missing env variables to local docker compose file #3629
Changes from 10 commits
606d215
              14728c4
              b824561
              77b3c62
              69bf632
              2c17a92
              e08e900
              d6743f1
              49e5ae3
              73e0c3c
              91402d1
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| meta { | ||
| name: Initiate Payment | ||
| type: http | ||
| seq: 3 | ||
| } | ||
|  | ||
| post { | ||
| url: http://localhost:4008/payment | ||
| body: json | ||
| auth: inherit | ||
| } | ||
|  | ||
| body:json { | ||
| { | ||
| "card": { | ||
| "walletAddress": "http://cloud-nine-wallet-backend/accounts/gfranklin", | ||
| "trasactionCounter": 1, | ||
| "expiry": "2025-09-13T13:00:00Z" | ||
| }, | ||
| "signature": "signature", | ||
| "value": 1, | ||
| "merchantWalletAddress": "http://happy-life-bank-backend/accounts/pfry" | ||
| } | ||
| } | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -11,6 +11,7 @@ services: | |
| - rafiki | ||
| ports: | ||
| - '3007:3007' | ||
| - '9234:9229' | ||
| volumes: | ||
| - type: bind | ||
| source: ../../packages/card-service/src | ||
|  | @@ -23,6 +24,10 @@ services: | |
| LOG_LEVEL: debug | ||
| CARD_SERVICE_PORT: 3007 | ||
| DATABASE_URL: postgresql://cloud_nine_wallet_card_service:cloud_nine_wallet_card_service@shared-database/cloud_nine_wallet_card_service | ||
| GRAPHQL_URL: http://cloud-nine-wallet-backend:3001/graphql | ||
| TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787 | ||
| TENANT_SECRET: tenant_secret | ||
|          | ||
| TENANT_SIGNATURE_VERSION: 1 | ||
| depends_on: | ||
| - shared-database | ||
| healthcheck: | ||
|  | @@ -55,6 +60,10 @@ services: | |
| LOG_LEVEL: debug | ||
| PORT: 3008 | ||
| DATABASE_URL: postgresql://cloud_nine_wallet_point_of_sale:cloud_nine_wallet_point_of_sale@shared-database/cloud_nine_wallet_point_of_sale | ||
| TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787 | ||
| TENANT_SECRET: secret | ||
| GRAPHQL_URL: http://cloud-nine-wallet-backend:3001/graphql | ||
| WEBHOOK_SIGNATURE_SECRET: webhook_secret | ||
| depends_on: | ||
| - shared-database | ||
| healthcheck: | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -23,6 +23,10 @@ services: | |
| LOG_LEVEL: debug | ||
| CARD_SERVICE_PORT: 4007 | ||
| DATABASE_URL: postgresql://happy_life_bank_card_service:happy_life_bank_card_service@shared-database/happy_life_bank_card_service | ||
| GRAPHQL_URL: http://happy-life-bank-backend:3001/graphql | ||
| TENANT_ID: cf5fd7d3-1eb1-4041-8e43-ba45747e9e5d | ||
| TENANT_SECRET: tenant_secret | ||
| TENANT_SIGNATURE_VERSION: 1 | ||
| depends_on: | ||
| - shared-database | ||
| - cloud-nine-wallet-card-service | ||
|  | @@ -44,6 +48,7 @@ services: | |
| - rafiki | ||
| ports: | ||
| - '4008:4008' | ||
| - '9233:9229' | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added for debugging | ||
| volumes: | ||
| - type: bind | ||
| source: ../../packages/point-of-sale/src | ||
|  | @@ -56,6 +61,10 @@ services: | |
| LOG_LEVEL: debug | ||
| PORT: 4008 | ||
| DATABASE_URL: postgresql://happy_life_bank_point_of_sale:happy_life_bank_point_of_sale@shared-database/happy_life_bank_point_of_sale | ||
| TENANT_ID: cf5fd7d3-1eb1-4041-8e43-ba45747e9e5d | ||
| TENANT_SECRET: secret | ||
| GRAPHQL_URL: http://happy-life-bank-backend:3001/graphql | ||
| WEBHOOK_SIGNATURE_SECRET: webhook_secret | ||
| depends_on: | ||
| - shared-database | ||
| - cloud-nine-wallet-point-of-sale | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -454,7 +454,7 @@ export class App { | |
| // For tests, we still need to get the tenant in the middleware, but | ||
| // we don't need to verify the signature nor prevent replay attacks | ||
| koa.use( | ||
| this.config.env !== 'test' | ||
| this.config.env !== 'test' && this.config.env !== 'development' | ||
|          | ||
| ? tenantSignatureMiddleware | ||
| : testTenantSignatureMiddleware | ||
| ) | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -11,9 +11,7 @@ import { BaseService } from '../shared/baseService' | |
| interface Card { | ||
| trasactionCounter: number | ||
| expiry: Date | ||
| // TODO: replace with WalletAddress from payment service | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| walletAddress: any | ||
| walletAddress: string | ||
| } | ||
|  | ||
| export interface PaymentOptions { | ||
|  | @@ -30,7 +28,7 @@ export interface PaymentOptions { | |
| } | ||
|  | ||
| export interface CardServiceClient { | ||
| sendPayment(options: PaymentOptions): Promise<Result> | ||
| sendPayment(cardServiceUrl: string, options: PaymentOptions): Promise<Result> | ||
| } | ||
|  | ||
| interface ServiceDependencies extends BaseService { | ||
|  | @@ -70,12 +68,14 @@ export async function createCardServiceClient({ | |
| axios | ||
| } | ||
| return { | ||
| sendPayment: (options) => sendPayment(deps, options) | ||
| sendPayment: (cardServiceUrl, options) => | ||
| sendPayment(deps, cardServiceUrl, options) | ||
| } | ||
| } | ||
|  | ||
| async function sendPayment( | ||
| deps: ServiceDependencies, | ||
| cardServiceUrl: string, | ||
| options: PaymentOptions | ||
| ): Promise<Result> { | ||
| try { | ||
|  | @@ -88,9 +88,8 @@ async function sendPayment( | |
| ...options, | ||
| requestId: uuid() | ||
| } | ||
| const cardServiceUrl = options.card.walletAddress.cardService | ||
| const response = await deps.axios.post<PaymentResponse>( | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will get  | ||
| `${cardServiceUrl}/payment`, | ||
| `${cardServiceUrl + (cardServiceUrl.endsWith('/') ? 'payment' : '/payment')}`, | ||
| requestBody, | ||
| config | ||
| ) | ||
|  | @@ -103,6 +102,7 @@ async function sendPayment( | |
| } | ||
| return payment.result | ||
| } catch (error) { | ||
| deps.logger.debug(error) | ||
| if (error instanceof CardServiceClientError) throw error | ||
|  | ||
| if (error instanceof AxiosError) { | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added for debugging