Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions localenv/cloud-nine-wallet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ services:
KEY_ID: 7097F83B-CB84-469E-96C6-2141C72E22C0
OPERATOR_TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787
CARD_SERVICE_URL: 'http://cloud-nine-wallet-card-service:3007'
CARD_WEBHOOK_SERVICE_URL: 'http://cloud-nine-wallet-card-service:3007/payment-event'
depends_on:
- shared-database
- shared-redis
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/backend/src/graphql/generated/graphql.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/backend/src/graphql/generated/graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/backend/src/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,7 @@ input CancelOutgoingPaymentInput {

enum CardPaymentFailureReason {
invalid_signature
invalid_request
}

input CreateOutgoingPaymentFromIncomingPaymentInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export type CancelOutgoingPaymentOptions = {
id: string
tenantId: string
reason?: string
cardPaymentFailureReason?: 'invalid_signature'
cardPaymentFailureReason?: 'invalid_signature' | 'invalid_request'
}

export type CreateOutgoingPaymentOptions =
Expand Down Expand Up @@ -264,7 +264,7 @@ async function cancelOutgoingPayment(
: {})
}
})
.withGraphFetched('quote')
.withGraphFetched('[quote, cardDetails]')
const asset = await deps.assetService.get(payment.quote.assetId)
if (asset) payment.quote.asset = asset

Expand Down Expand Up @@ -719,7 +719,7 @@ async function fundPayment(
tenantId
})
.forUpdate()
.withGraphFetched('quote')
.withGraphFetched('[quote, cardDetails]')
if (!payment) return FundingError.UnknownPayment

const asset = await deps.assetService.get(payment.quote.assetId)
Expand Down
2 changes: 2 additions & 0 deletions packages/card-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import cors from '@koa/cors'
import { createValidatorMiddleware, HttpMethod } from '@interledger/openapi'
import { PaymentContext } from './payment/types'
import { PaymentEventContext } from './payment/types'
import { PaymentRoutes } from './payment/routes'

export interface AppServices {
logger: Promise<Logger>
config: Promise<IAppConfig>
paymentRoutes: Promise<PaymentRoutes>
}

export type AppContainer = IocContract<AppServices>
Expand Down
1 change: 1 addition & 0 deletions packages/card-service/src/graphql/generated/graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 74 additions & 22 deletions packages/card-service/src/openapi/specs/card-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,46 @@ paths:
application/json:
schema:
type: object
required:
- requestId
- result
properties:
requestId:
type: string
format: uuid
result:
type: string
enum:
- approved
type: object
required:
- code
properties:
code:
type: string
enum:
- approved
- invalid_signature
description:
type: string
'400':
description: Invalid request
'401':
description: Card expired or invalid signature
content:
application/json:
schema:
type: object
required:
- error
properties:
error:
type: object
required:
- code
- description
properties:
code:
type: string
enum:
- invalid_request
description:
type: string
'500':
description: Internal server error
/payment-event:
Expand All @@ -78,31 +107,54 @@ paths:
schema:
type: object
required:
- requestId
- outgoingPaymentId
- result
- id
- type
- data
properties:
requestId:
id:
type: string
format: uuid
outgoingPaymentId:
type:
type: string
format: uuid
result:
enum:
- outgoing_payment.funded
- outgoing_payment.cancelled
data:
type: object
required:
- code
- id
- cardDetails
properties:
code:
id:
type: string
enum:
- completed
- card_expired
- invalid_signature
format: uuid
cardDetails:
type: object
required:
- requestId
properties:
requestId:
type: string
format: uuid
initiatedAt:
type: string
format: date-time
data:
type: object
additionalProperties: true
additionalProperties: true
metadata:
type: object
properties:
cardPaymentFailureReason:
type: string
enum:
- invalid_signature
- invalid_request
additionalProperties: true
additionalProperties: true
responses:
'202':
description: Payment event accepted and forwarded
'200':
description: Payment event accepted
'400':
description: Malformed request body
'404':
description: Request not found
Loading
Loading