-
Notifications
You must be signed in to change notification settings - Fork 96
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
Merged
Merged
fix(point-of-sale): added bruno script + added missing env variables to local docker compose file #3629
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
606d215
Added bruno script + added missing env variables to local docker cont…
oana-lolea 14728c4
Added missing env variables for card-service
oana-lolea b824561
Sent tenant id to backend for now, updated bruno req, fixed createInc…
oana-lolea 77b3c62
Removed unnecessary header
oana-lolea 69bf632
Merge branch 'pos-card-services' into oana/raf-1120
oana-lolea 2c17a92
Fixed a test after mutation update
oana-lolea e08e900
Updated generated graphql files
oana-lolea d6743f1
Merge branch 'pos-card-services' into oana/raf-1120
oana-lolea 49e5ae3
Fixed connection between payment service calls
oana-lolea 73e0c3c
Merge branch 'pos-card-services' into oana/raf-1120
oana-lolea 91402d1
Fixed env variables and mutation type for creating inc payment
oana-lolea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
bruno/collections/Rafiki/POS Service APIs/Initiate Payment.bru
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964= | ||
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: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964= | ||
GRAPHQL_URL: http://happy-life-bank-backend:3001/graphql | ||
WEBHOOK_SIGNATURE_SECRET: webhook_secret | ||
depends_on: | ||
- shared-database | ||
- cloud-nine-wallet-point-of-sale | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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