chore(payment): use generate schema (#13004)
Fixes: https://github.com/medusajs/medusa/issues/12959 Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
1 parent
3fedb4c90c
commit
798ac0068e
4 files changed
+42
-139
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/payment": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore(payment): remove fixed schema from joiner config
|
||||||
+36
-16
@@ -23,11 +23,13 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
|
|||||||
service: PaymentModuleService,
|
service: PaymentModuleService,
|
||||||
}).linkable
|
}).linkable
|
||||||
|
|
||||||
expect(Object.keys(linkable)).toHaveLength(6)
|
expect(Object.keys(linkable)).toHaveLength(8)
|
||||||
expect(Object.keys(linkable)).toEqual([
|
expect(Object.keys(linkable)).toEqual([
|
||||||
"paymentCollection",
|
"paymentCollection",
|
||||||
"paymentSession",
|
"paymentSession",
|
||||||
"payment",
|
"payment",
|
||||||
|
"capture",
|
||||||
|
"refund",
|
||||||
"refundReason",
|
"refundReason",
|
||||||
"accountHolder",
|
"accountHolder",
|
||||||
"paymentProvider",
|
"paymentProvider",
|
||||||
@@ -38,58 +40,76 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
|
|||||||
})
|
})
|
||||||
|
|
||||||
expect(linkable).toEqual({
|
expect(linkable).toEqual({
|
||||||
payment: {
|
|
||||||
id: {
|
|
||||||
linkable: "payment_id",
|
|
||||||
entity: "Payment",
|
|
||||||
primaryKey: "id",
|
|
||||||
serviceName: "payment",
|
|
||||||
field: "payment",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
paymentCollection: {
|
paymentCollection: {
|
||||||
id: {
|
id: {
|
||||||
linkable: "payment_collection_id",
|
linkable: "payment_collection_id",
|
||||||
entity: "PaymentCollection",
|
|
||||||
primaryKey: "id",
|
primaryKey: "id",
|
||||||
serviceName: "payment",
|
serviceName: "payment",
|
||||||
field: "paymentCollection",
|
field: "paymentCollection",
|
||||||
|
entity: "PaymentCollection",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
paymentSession: {
|
paymentSession: {
|
||||||
id: {
|
id: {
|
||||||
field: "paymentSession",
|
|
||||||
entity: "PaymentSession",
|
|
||||||
linkable: "payment_session_id",
|
linkable: "payment_session_id",
|
||||||
primaryKey: "id",
|
primaryKey: "id",
|
||||||
serviceName: "payment",
|
serviceName: "payment",
|
||||||
|
field: "paymentSession",
|
||||||
|
entity: "PaymentSession",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
id: {
|
||||||
|
linkable: "payment_id",
|
||||||
|
primaryKey: "id",
|
||||||
|
serviceName: "payment",
|
||||||
|
field: "payment",
|
||||||
|
entity: "Payment",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
capture: {
|
||||||
|
id: {
|
||||||
|
linkable: "capture_id",
|
||||||
|
primaryKey: "id",
|
||||||
|
serviceName: "payment",
|
||||||
|
field: "capture",
|
||||||
|
entity: "Capture",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
refund: {
|
||||||
|
id: {
|
||||||
|
linkable: "refund_id",
|
||||||
|
primaryKey: "id",
|
||||||
|
serviceName: "payment",
|
||||||
|
field: "refund",
|
||||||
|
entity: "Refund",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
refundReason: {
|
refundReason: {
|
||||||
id: {
|
id: {
|
||||||
linkable: "refund_reason_id",
|
linkable: "refund_reason_id",
|
||||||
entity: "RefundReason",
|
|
||||||
primaryKey: "id",
|
primaryKey: "id",
|
||||||
serviceName: "payment",
|
serviceName: "payment",
|
||||||
field: "refundReason",
|
field: "refundReason",
|
||||||
|
entity: "RefundReason",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
accountHolder: {
|
accountHolder: {
|
||||||
id: {
|
id: {
|
||||||
linkable: "account_holder_id",
|
linkable: "account_holder_id",
|
||||||
entity: "AccountHolder",
|
|
||||||
primaryKey: "id",
|
primaryKey: "id",
|
||||||
serviceName: "payment",
|
serviceName: "payment",
|
||||||
field: "accountHolder",
|
field: "accountHolder",
|
||||||
|
entity: "AccountHolder",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
paymentProvider: {
|
paymentProvider: {
|
||||||
id: {
|
id: {
|
||||||
linkable: "payment_provider_id",
|
linkable: "payment_provider_id",
|
||||||
entity: "PaymentProvider",
|
|
||||||
primaryKey: "id",
|
primaryKey: "id",
|
||||||
serviceName: "payment",
|
serviceName: "payment",
|
||||||
field: "paymentProvider",
|
field: "paymentProvider",
|
||||||
|
entity: "PaymentProvider",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,24 +1,13 @@
|
|||||||
import { defineJoinerConfig, Modules } from "@medusajs/framework/utils"
|
import { defineJoinerConfig, Modules } from "@medusajs/framework/utils"
|
||||||
import {
|
import {
|
||||||
|
AccountHolder,
|
||||||
Payment,
|
Payment,
|
||||||
PaymentCollection,
|
PaymentCollection,
|
||||||
PaymentProvider,
|
PaymentProvider,
|
||||||
PaymentSession,
|
|
||||||
RefundReason,
|
RefundReason,
|
||||||
AccountHolder,
|
|
||||||
} from "@models"
|
} from "@models"
|
||||||
import { default as schema } from "./schema"
|
|
||||||
|
|
||||||
export const joinerConfig = defineJoinerConfig(Modules.PAYMENT, {
|
export const joinerConfig = defineJoinerConfig(Modules.PAYMENT, {
|
||||||
schema,
|
|
||||||
models: [
|
|
||||||
Payment,
|
|
||||||
PaymentCollection,
|
|
||||||
PaymentProvider,
|
|
||||||
PaymentSession,
|
|
||||||
RefundReason,
|
|
||||||
AccountHolder,
|
|
||||||
],
|
|
||||||
linkableKeys: {
|
linkableKeys: {
|
||||||
payment_id: Payment.name,
|
payment_id: Payment.name,
|
||||||
payment_collection_id: PaymentCollection.name,
|
payment_collection_id: PaymentCollection.name,
|
||||||
|
|||||||
@@ -1,111 +0,0 @@
|
|||||||
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!
|
|
||||||
}
|
|
||||||
`
|
|
||||||
Reference in new issue
Block a user