feat: Application types generation from project GQL schema's (#8995)

This commit is contained in:
Adrien de Peretti
2024-09-06 11:45:32 +02:00
committed by GitHub
parent ac30a989f4
commit 2c5e72d141
92 changed files with 5129 additions and 443 deletions

View File

@@ -4,8 +4,8 @@ import { PaymentModuleService } from "@services"
import { moduleIntegrationTestRunner } from "medusa-test-utils"
import {
createPaymentCollections,
createPayments,
createPaymentSessions,
createPayments,
} from "../../../__fixtures__"
jest.setTimeout(30000)
@@ -23,6 +23,7 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
"payment",
"paymentCollection",
"paymentProvider",
"paymentSession",
"refundReason",
])
@@ -55,6 +56,14 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
field: "paymentProvider",
},
},
paymentSession: {
id: {
field: "paymentSession",
linkable: "payment_session_id",
primaryKey: "id",
serviceName: "payment",
},
},
refundReason: {
id: {
linkable: "refund_reason_id",

View File

@@ -6,8 +6,10 @@ import {
PaymentSession,
RefundReason,
} from "@models"
import { default as schema } from "./schema"
export const joinerConfig = defineJoinerConfig(Modules.PAYMENT, {
schema,
models: [
Payment,
PaymentCollection,

View File

@@ -0,0 +1,111 @@
export default `
enum PaymentCollectionStatus {
not_paid
awaiting
authorized
partially_authorized
canceled
}
enum PaymentSessionStatus {
authorized
captured
pending
requires_more
error
canceled
}
type PaymentCollection {
id: ID!
currency_code: String!
region_id: String!
amount: Float!
authorized_amount: Float
refunded_amount: Float
captured_amount: Float
completed_at: DateTime
created_at: DateTime
updated_at: DateTime
metadata: JSON
status: PaymentCollectionStatus!
payment_providers: [PaymentProviderDTO!]!
payment_sessions: [PaymentSessionDTO]
payments: [PaymentDTO]
}
type Payment {
id: ID!
amount: Float!
raw_amount: Float
authorized_amount: Float
raw_authorized_amount: Float
currency_code: String!
provider_id: String!
cart_id: String
order_id: String
order_edit_id: String
customer_id: String
data: JSON
created_at: DateTime
updated_at: DateTime
captured_at: DateTime
canceled_at: DateTime
captured_amount: Float
raw_captured_amount: Float
refunded_amount: Float
raw_refunded_amount: Float
captures: [CaptureDTO]
refunds: [RefundDTO]
payment_collection_id: String!
payment_collection: PaymentCollectionDTO
payment_session: PaymentSessionDTO
}
type Capture {
id: ID!
amount: Float!
created_at: DateTime!
created_by: String
payment: Payment!
}
type Refund {
id: ID!
amount: Float!
refund_reason_id: String
refund_reason: RefundReason
note: String
created_at: DateTime!
created_by: String
payment: Payment!
}
type PaymentSession {
id: ID!
amount: Float!
currency_code: String!
provider_id: String!
data: JSON!
context: JSON
status: PaymentSessionStatus!
authorized_at: DateTime
payment_collection_id: String!
payment_collection: PaymentCollection
payment: Payment
}
type PaymentProvider {
id: ID!
is_enabled: String!
}
type RefundReason {
id: ID!
label: String!
description: String
metadata: JSON
created_at: DateTime!
updated_at: DateTime!
}
`