feat: Remove fields from payment models that were leftovers from v1 (#10987)

This commit is contained in:
Stevche Radevski authored and GitHub committed 2025-01-16 10:10:03 +01:00
1 parent 8cd58b3092
commit da8e173974
16 files changed
+37 -287

No files matched your search

@@ -39,7 +39,6 @@ medusaIntegrationTestRunner({
paymentCollection = await paymentModule.createPaymentCollections({ paymentCollection = await paymentModule.createPaymentCollections({
currency_code: "usd", currency_code: "usd",
amount: 1000, amount: 1000,
region_id: region.id,
}) })
}) })
@@ -65,7 +64,6 @@ medusaIntegrationTestRunner({
id: paymentCollection.id, id: paymentCollection.id,
currency_code: "usd", currency_code: "usd",
amount: 1000, amount: 1000,
region_id: region.id,
payment_sessions: expect.arrayContaining([ payment_sessions: expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
amount: 1000, amount: 1000,
@@ -106,7 +104,6 @@ medusaIntegrationTestRunner({
id: paymentCollection.id, id: paymentCollection.id,
currency_code: "usd", currency_code: "usd",
amount: 1000, amount: 1000,
region_id: region.id,
payment_sessions: [ payment_sessions: [
expect.objectContaining({ expect.objectContaining({
amount: 1000, amount: 1000,
@@ -139,7 +136,6 @@ medusaIntegrationTestRunner({
await paymentModule.createPaymentCollections({ await paymentModule.createPaymentCollections({
currency_code: "usd", currency_code: "usd",
amount: 1000, amount: 1000,
region_id: region.id,
}) })
const { errors } = await workflow.run({ const { errors } = await workflow.run({
@@ -9,13 +9,6 @@ import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
* The details of the payment collections to create. * The details of the payment collections to create.
*/ */
export type CreatePaymentCollectionCartStepInput = { export type CreatePaymentCollectionCartStepInput = {
/**
* The ID of the region that the payment collection belongs to.
*/
region_id: string
/**
* The payment collection's curency code.
*/
currency_code: string currency_code: string
/** /**
* The payment collection's amount. * The payment collection's amount.
@@ -30,10 +23,9 @@ export type CreatePaymentCollectionCartStepInput = {
export const createPaymentCollectionsStepId = "create-payment-collections" export const createPaymentCollectionsStepId = "create-payment-collections"
/** /**
* This step creates payment collections in a cart. * This step creates payment collections in a cart.
* *
* @example * @example
* const data = createPaymentCollectionsStep([{ * const data = createPaymentCollectionsStep([{
* "region_id": "region_123",
* "currency_code": "usd", * "currency_code": "usd",
* "amount": 40 * "amount": 40
* }]) * }])
@@ -28,13 +28,13 @@ export type ValidateExistingPaymentCollectionStepInput = {
/** /**
* This step validates that a cart doesn't have a payment collection. * This step validates that a cart doesn't have a payment collection.
* If the cart has a payment collection, the step throws an error. * If the cart has a payment collection, the step throws an error.
* *
* :::tip * :::tip
* *
* You can use the {@link retrieveCartStep} to retrieve a cart's details. * You can use the {@link retrieveCartStep} to retrieve a cart's details.
* *
* ::: * :::
* *
* @example * @example
* const data = validateExistingPaymentCollectionStep({ * const data = validateExistingPaymentCollectionStep({
* cart: { * cart: {
@@ -58,11 +58,11 @@ export const validateExistingPaymentCollectionStep = createStep(
export const createPaymentCollectionForCartWorkflowId = export const createPaymentCollectionForCartWorkflowId =
"create-payment-collection-for-cart" "create-payment-collection-for-cart"
/** /**
* This workflow creates a payment collection for a cart. It's executed by the * This workflow creates a payment collection for a cart. It's executed by the
* [Create Payment Collection Store API Route](https://docs.medusajs.com/api/store#payment-collections_postpaymentcollections). * [Create Payment Collection Store API Route](https://docs.medusajs.com/api/store#payment-collections_postpaymentcollections).
* *
* You can use this workflow within your own custom workflows, allowing you to wrap custom logic around adding creating a payment collection for a cart. * You can use this workflow within your own custom workflows, allowing you to wrap custom logic around adding creating a payment collection for a cart.
* *
* @example * @example
* const { result } = await createPaymentCollectionForCartWorkflow(container) * const { result } = await createPaymentCollectionForCartWorkflow(container)
* .run({ * .run({
@@ -73,9 +73,9 @@ export const createPaymentCollectionForCartWorkflowId =
* } * }
* } * }
* }) * })
* *
* @summary * @summary
* *
* Create payment collection for cart. * Create payment collection for cart.
*/ */
export const createPaymentCollectionForCartWorkflow = createWorkflow( export const createPaymentCollectionForCartWorkflow = createWorkflow(
@@ -87,7 +87,6 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
entry_point: "cart", entry_point: "cart",
fields: [ fields: [
"id", "id",
"region_id",
"completed_at", "completed_at",
"currency_code", "currency_code",
"total", "total",
@@ -106,10 +105,8 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
const paymentData = transform({ cart }, ({ cart }) => { const paymentData = transform({ cart }, ({ cart }) => {
return { return {
cart_id: cart.id,
currency_code: cart.currency_code, currency_code: cart.currency_code,
amount: cart.raw_total, amount: cart.raw_total,
region_id: cart.region_id,
} }
}) })
@@ -108,7 +108,6 @@ export const refreshPaymentCollectionForCartWorkflow = createWorkflow(
update: { update: {
amount: cart.total, amount: cart.total,
currency_code: cart.currency_code, currency_code: cart.currency_code,
region_id: cart.region_id,
}, },
} }
}) })
@@ -63,7 +63,6 @@ export const createOrderPaymentCollectionWorkflow = createWorkflow(
return { return {
currency_code: order.currency_code, currency_code: order.currency_code,
amount: input.amount, amount: input.amount,
region_id: order.region_id,
} }
} }
) )
@@ -43,11 +43,6 @@ export interface BasePaymentCollection {
*/ */
currency_code: string currency_code: string
/**
* The id of the associated region.
*/
region_id: string
/** /**
* The total amount to be authorized and captured. * The total amount to be authorized and captured.
*/ */
@@ -141,26 +136,6 @@ export interface BasePayment {
*/ */
provider_id: string provider_id: string
/**
* The ID of the associated cart.
*/
cart_id?: string
/**
* The ID of the associated order.
*/
order_id?: string
/**
* The ID of the associated order edit.
*/
order_edit_id?: string
/**
* The ID of the associated customer.
*/
customer_id?: string
/** /**
* The data relevant for the payment provider to process the payment. * The data relevant for the payment provider to process the payment.
*/ */
+1 -56
View File
@@ -32,11 +32,6 @@ export interface PaymentCollectionDTO {
*/ */
currency_code: string currency_code: string
/**
* The id of the associated region.
*/
region_id: string
/** /**
* The total amount to be authorized and captured. * The total amount to be authorized and captured.
*/ */
@@ -114,11 +109,6 @@ export interface FilterablePaymentCollectionProps
*/ */
id?: string | string[] id?: string | string[]
/**
* Filter by associated region's ID.
*/
region_id?: string | string[] | OperatorMap<string>
/** /**
* Filter payment collections by created date. * Filter payment collections by created date.
*/ */
@@ -160,11 +150,6 @@ export interface FilterablePaymentSessionProps
*/ */
payment_collection_id?: string | string[] payment_collection_id?: string | string[]
/**
* Filter the payment sessions by the ID of their associated region.
*/
region_id?: string | string[] | OperatorMap<string>
/** /**
* Filter the payment sessions by their creation date. * Filter the payment sessions by their creation date.
*/ */
@@ -297,26 +282,6 @@ export interface PaymentDTO {
*/ */
provider_id: string provider_id: string
/**
* The ID of the associated cart.
*/
cart_id?: string
/**
* The ID of the associated order.
*/
order_id?: string
/**
* The ID of the associated order edit.
*/
order_edit_id?: string
/**
* The ID of the associated customer.
*/
customer_id?: string
/** /**
* The data relevant for the payment provider to process the payment. * The data relevant for the payment provider to process the payment.
*/ */
@@ -402,7 +367,7 @@ export interface PaymentDTO {
export interface FilterablePaymentProps export interface FilterablePaymentProps
extends BaseFilterable<FilterablePaymentProps> { extends BaseFilterable<FilterablePaymentProps> {
/** /**
* Find payments based on cart, order, or customer IDs through this search term. * Find payments based on different fields.
*/ */
q?: string q?: string
@@ -416,26 +381,6 @@ export interface FilterablePaymentProps
*/ */
payment_session_id?: string | string[] | OperatorMap<string> payment_session_id?: string | string[] | OperatorMap<string>
/**
* Filter the payments by the ID of their associated customer.
*/
customer_id?: string | string[] | OperatorMap<string>
/**
* Filter the payments by the ID of their associated cart.
*/
cart_id?: string | string[] | OperatorMap<string>
/**
* Filter the payments by the ID of their associated order.
*/
order_id?: string | string[] | OperatorMap<string>
/**
* Filter the payments by the ID of their associated order edit.
*/
order_edit_id?: string | string[] | OperatorMap<string>
/** /**
* Filter the payments by their creation date. * Filter the payments by their creation date.
*/ */
@@ -6,11 +6,6 @@ import { PaymentProviderContext } from "./provider"
* The payment collection to be created. * The payment collection to be created.
*/ */
export interface CreatePaymentCollectionDTO { export interface CreatePaymentCollectionDTO {
/**
* The associated region's ID.
*/
region_id: string
/** /**
* The ISO 3 character currency code of the payment collection. * The ISO 3 character currency code of the payment collection.
*/ */
@@ -47,11 +42,6 @@ export interface UpsertPaymentCollectionDTO {
*/ */
id?: string id?: string
/**
* The associated region's ID.
*/
region_id?: string
/** /**
* The ISO 3 character currency code of the payment collection. * The ISO 3 character currency code of the payment collection.
*/ */
@@ -72,11 +62,6 @@ export interface UpsertPaymentCollectionDTO {
* The attributes to update in the payment collection. * The attributes to update in the payment collection.
*/ */
export interface PaymentCollectionUpdatableFields { export interface PaymentCollectionUpdatableFields {
/**
* The associated region's ID.
*/
region_id?: string
/** /**
* The ISO 3 character currency code of the payment collection. * The ISO 3 character currency code of the payment collection.
*/ */
@@ -131,26 +116,6 @@ export interface CreatePaymentDTO {
* The associated payment collection's ID. * The associated payment collection's ID.
*/ */
payment_collection_id: string payment_collection_id: string
/**
* The associated cart's ID.
*/
cart_id?: string
/**
* The associated order's ID.
*/
order_id?: string
/**
* The associated order edit's ID.
*/
order_edit_id?: string
/**
* The associated customer's ID.
*/
customer_id?: string
} }
/** /**
@@ -161,26 +126,6 @@ export interface UpdatePaymentDTO {
* The ID of the payment. * The ID of the payment.
*/ */
id: string id: string
/**
* The associated cart's ID.
*/
cart_id?: string
/**
* The associated order's ID.
*/
order_id?: string
/**
* The associated order edit's ID.
*/
order_edit_id?: string
/**
* The associated customer's ID.
*/
customer_id?: string
} }
/** /**
+3 -8
View File
@@ -50,12 +50,10 @@ export interface IPaymentModuleService extends IModuleService {
* const paymentCollections = * const paymentCollections =
* await paymentModuleService.createPaymentCollections([ * await paymentModuleService.createPaymentCollections([
* { * {
* region_id: "reg_123",
* currency_code: "usd", * currency_code: "usd",
* amount: 3000, * amount: 3000,
* }, * },
* { * {
* region_id: "reg_321",
* currency_code: "eur", * currency_code: "eur",
* amount: 2000, * amount: 2000,
* }, * },
@@ -76,7 +74,6 @@ export interface IPaymentModuleService extends IModuleService {
* @example * @example
* const paymentCollection = * const paymentCollection =
* await paymentModuleService.createPaymentCollections({ * await paymentModuleService.createPaymentCollections({
* region_id: "reg_123",
* currency_code: "usd", * currency_code: "usd",
* amount: 3000, * amount: 3000,
* }) * })
@@ -300,10 +297,8 @@ export interface IPaymentModuleService extends IModuleService {
* await paymentModuleService.upsertPaymentCollections([ * await paymentModuleService.upsertPaymentCollections([
* { * {
* id: "pay_col_123", * id: "pay_col_123",
* region_id: "reg_123",
* }, * },
* { * {
* region_id: "reg_123",
* currency_code: "usd", * currency_code: "usd",
* amount: 3000, * amount: 3000,
* }, * },
@@ -326,7 +321,6 @@ export interface IPaymentModuleService extends IModuleService {
* const paymentCollection = * const paymentCollection =
* await paymentModuleService.upsertPaymentCollections({ * await paymentModuleService.upsertPaymentCollections({
* id: "pay_col_123", * id: "pay_col_123",
* region_id: "reg_123",
* }) * })
*/ */
upsertPaymentCollections( upsertPaymentCollections(
@@ -652,7 +646,6 @@ export interface IPaymentModuleService extends IModuleService {
* @example * @example
* const payment = await paymentModuleService.updatePayment({ * const payment = await paymentModuleService.updatePayment({
* id: "pay_123", * id: "pay_123",
* customer_id: "cus_123",
* }) * })
*/ */
updatePayment( updatePayment(
@@ -1077,7 +1070,9 @@ export interface IPaymentModuleService extends IModuleService {
* }) * })
* ``` * ```
*/ */
getWebhookActionAndData(data: ProviderWebhookPayload): Promise<WebhookActionResult> getWebhookActionAndData(
data: ProviderWebhookPayload
): Promise<WebhookActionResult>
} }
/** /**
@@ -2,19 +2,16 @@ export const defaultPaymentCollectionData = [
{ {
id: "pay-col-id-1", id: "pay-col-id-1",
amount: 100, amount: 100,
region_id: "region-id-1",
currency_code: "usd", currency_code: "usd",
}, },
{ {
id: "pay-col-id-2", id: "pay-col-id-2",
amount: 200, amount: 200,
region_id: "region-id-1",
currency_code: "usd", currency_code: "usd",
}, },
{ {
id: "pay-col-id-3", id: "pay-col-id-3",
amount: 300, amount: 300,
region_id: "region-id-2",
currency_code: "usd", currency_code: "usd",
}, },
] ]
@@ -15,7 +15,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
.createPaymentCollections([ .createPaymentCollections([
{ {
amount: 200, amount: 200,
region_id: "req_123",
} as any, } as any,
]) ])
.catch((e) => e) .catch((e) => e)
@@ -28,7 +27,7 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
it("should create a payment collection successfully", async () => { it("should create a payment collection successfully", async () => {
const [createdPaymentCollection] = const [createdPaymentCollection] =
await service.createPaymentCollections([ await service.createPaymentCollections([
{ currency_code: "USD", amount: 200, region_id: "reg_123" }, { currency_code: "USD", amount: 200 },
]) ])
expect(createdPaymentCollection).toEqual( expect(createdPaymentCollection).toEqual(
@@ -90,7 +90,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
let paymentCollection = await service.createPaymentCollections({ let paymentCollection = await service.createPaymentCollections({
currency_code: "usd", currency_code: "usd",
amount: 200, amount: 200,
region_id: "reg_123",
}) })
const paymentSession = await service.createPaymentSession( const paymentSession = await service.createPaymentSession(
@@ -134,7 +133,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
authorized_amount: 200, authorized_amount: 200,
captured_amount: 200, captured_amount: 200,
status: "authorized", status: "authorized",
region_id: "reg_123",
deleted_at: null, deleted_at: null,
completed_at: expect.any(Date), completed_at: expect.any(Date),
payment_sessions: [ payment_sessions: [
@@ -180,7 +178,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
.createPaymentCollections([ .createPaymentCollections([
{ {
amount: 200, amount: 200,
region_id: "req_123",
} as any, } as any,
]) ])
.catch((e) => e) .catch((e) => e)
@@ -193,7 +190,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
.createPaymentCollections([ .createPaymentCollections([
{ {
currency_code: "USD", currency_code: "USD",
region_id: "req_123",
} as any, } as any,
]) ])
.catch((e) => e) .catch((e) => e)
@@ -202,25 +198,12 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
expect(error.message).toContain( expect(error.message).toContain(
"Value for PaymentCollection.amount is required, 'undefined' found" "Value for PaymentCollection.amount is required, 'undefined' found"
) )
error = await service
.createPaymentCollections([
{
currency_code: "USD",
amount: 200,
} as any,
])
.catch((e) => e)
expect(error.message).toContain(
"Value for PaymentCollection.region_id is required, 'undefined' found"
)
}) })
it("should create a payment collection successfully", async () => { it("should create a payment collection successfully", async () => {
const [createdPaymentCollection] = const [createdPaymentCollection] =
await service.createPaymentCollections([ await service.createPaymentCollections([
{ currency_code: "USD", amount: 200, region_id: "reg_123" }, { currency_code: "USD", amount: 200 },
]) ])
expect(createdPaymentCollection).toEqual( expect(createdPaymentCollection).toEqual(
@@ -265,7 +248,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
expect.objectContaining({ expect.objectContaining({
id: "pay-col-id-2", id: "pay-col-id-2",
amount: 200, amount: 200,
region_id: "region-id-1",
currency_code: "usd", currency_code: "usd",
}) })
) )
@@ -294,57 +276,27 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
expect.objectContaining({ expect.objectContaining({
id: "pay-col-id-1", id: "pay-col-id-1",
amount: 100, amount: 100,
region_id: "region-id-1",
currency_code: "usd", currency_code: "usd",
}), }),
expect.objectContaining({ expect.objectContaining({
id: "pay-col-id-2", id: "pay-col-id-2",
amount: 200, amount: 200,
region_id: "region-id-1",
currency_code: "usd", currency_code: "usd",
}), }),
expect.objectContaining({ expect.objectContaining({
id: "pay-col-id-3", id: "pay-col-id-3",
amount: 300, amount: 300,
region_id: "region-id-2",
currency_code: "usd", currency_code: "usd",
}), }),
]) ])
) )
}) })
it("should list Payment Collections by region_id", async () => {
let collections = await service.listPaymentCollections(
{
region_id: "region-id-1",
},
{ select: ["id", "amount", "region_id"] }
)
expect(collections.length).toEqual(2)
expect(collections).toEqual(
expect.arrayContaining([
expect.objectContaining({
id: "pay-col-id-1",
amount: 100,
region_id: "region-id-1",
}),
expect.objectContaining({
id: "pay-col-id-2",
amount: 200,
region_id: "region-id-1",
}),
])
)
})
}) })
describe("update", () => { describe("update", () => {
it("should update a Payment Collection", async () => { it("should update a Payment Collection", async () => {
await service.updatePaymentCollections("pay-col-id-2", { await service.updatePaymentCollections("pay-col-id-2", {
currency_code: "eur", currency_code: "eur",
region_id: "reg-2",
}) })
const collection = await service.retrievePaymentCollection( const collection = await service.retrievePaymentCollection(
@@ -354,7 +306,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
expect(collection).toEqual( expect(collection).toEqual(
expect.objectContaining({ expect.objectContaining({
id: "pay-col-id-2", id: "pay-col-id-2",
region_id: "reg-2",
currency_code: "eur", currency_code: "eur",
}) })
) )
@@ -545,7 +496,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
it("should authorize a payment session", async () => { it("should authorize a payment session", async () => {
const collection = await service.createPaymentCollections({ const collection = await service.createPaymentCollections({
amount: 200, amount: 200,
region_id: "test-region",
currency_code: "usd", currency_code: "usd",
}) })
@@ -576,9 +526,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
refunds: [], refunds: [],
captures: [], captures: [],
data: {}, data: {},
cart_id: null,
order_id: null,
customer_id: null,
deleted_at: null, deleted_at: null,
captured_at: null, captured_at: null,
canceled_at: null, canceled_at: null,
@@ -615,13 +562,11 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
it("should update a payment successfully", async () => { it("should update a payment successfully", async () => {
const updatedPayment = await service.updatePayment({ const updatedPayment = await service.updatePayment({
id: "pay-id-1", id: "pay-id-1",
cart_id: "new-cart",
}) })
expect(updatedPayment).toEqual( expect(updatedPayment).toEqual(
expect.objectContaining({ expect.objectContaining({
id: "pay-id-1", id: "pay-id-1",
cart_id: "new-cart",
}) })
) )
}) })
@@ -908,7 +853,6 @@ moduleIntegrationTestRunner<IPaymentModuleService>({
it("should authorize, capture and refund multiple payment sessions", async () => { it("should authorize, capture and refund multiple payment sessions", async () => {
const collection = await service.createPaymentCollections({ const collection = await service.createPaymentCollections({
amount: 500, amount: 500,
region_id: "test-region",
currency_code: "usd", currency_code: "usd",
}) })
@@ -60,15 +60,6 @@
"nullable": true, "nullable": true,
"mappedType": "decimal" "mappedType": "decimal"
}, },
"region_id": {
"name": "region_id",
"type": "text",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"mappedType": "text"
},
"completed_at": { "completed_at": {
"name": "completed_at", "name": "completed_at",
"type": "timestamptz", "type": "timestamptz",
@@ -185,14 +176,6 @@
"unique": false, "unique": false,
"expression": "CREATE INDEX IF NOT EXISTS \"IDX_payment_collection_deleted_at\" ON \"payment_collection\" (deleted_at) WHERE deleted_at IS NULL" "expression": "CREATE INDEX IF NOT EXISTS \"IDX_payment_collection_deleted_at\" ON \"payment_collection\" (deleted_at) WHERE deleted_at IS NULL"
}, },
{
"keyName": "IDX_payment_collection_region_id",
"columnNames": [],
"composite": false,
"primary": false,
"unique": false,
"expression": "CREATE INDEX IF NOT EXISTS \"IDX_payment_collection_region_id\" ON \"payment_collection\" (region_id) WHERE deleted_at IS NULL"
},
{ {
"keyName": "payment_collection_pkey", "keyName": "payment_collection_pkey",
"columnNames": [ "columnNames": [
@@ -700,33 +683,6 @@
"nullable": false, "nullable": false,
"mappedType": "text" "mappedType": "text"
}, },
"cart_id": {
"name": "cart_id",
"type": "text",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"mappedType": "text"
},
"order_id": {
"name": "order_id",
"type": "text",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"mappedType": "text"
},
"customer_id": {
"name": "customer_id",
"type": "text",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"mappedType": "text"
},
"data": { "data": {
"name": "data", "name": "data",
"type": "jsonb", "type": "jsonb",
@@ -0,0 +1,21 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20250115160517 extends Migration {
async up(): Promise<void> {
this.addSql('drop index if exists "IDX_payment_collection_region_id";');
this.addSql('alter table if exists "payment_collection" drop column if exists "region_id";');
this.addSql('alter table if exists "payment" drop column if exists "cart_id";');
this.addSql('alter table if exists "payment" drop column if exists "order_id";');
this.addSql('alter table if exists "payment" drop column if exists "customer_id";');
}
async down(): Promise<void> {
this.addSql('alter table if exists "payment_collection" add column if not exists "region_id" text not null;');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_payment_collection_region_id" ON "payment_collection" (region_id) WHERE deleted_at IS NULL;');
this.addSql('alter table if exists "payment" add column if not exists "cart_id" text null, add column if not exists "order_id" text null, add column if not exists "customer_id" text null;');
}
}
@@ -11,7 +11,6 @@ const PaymentCollection = model
authorized_amount: model.bigNumber().nullable(), authorized_amount: model.bigNumber().nullable(),
captured_amount: model.bigNumber().nullable(), captured_amount: model.bigNumber().nullable(),
refunded_amount: model.bigNumber().nullable(), refunded_amount: model.bigNumber().nullable(),
region_id: model.text(),
completed_at: model.dateTime().nullable(), completed_at: model.dateTime().nullable(),
status: model status: model
.enum(PaymentCollectionStatus) .enum(PaymentCollectionStatus)
@@ -30,11 +29,5 @@ const PaymentCollection = model
.cascades({ .cascades({
delete: ["payment_sessions", "payments"], delete: ["payment_sessions", "payments"],
}) })
.indexes([
{
name: "IDX_payment_collection_region_id",
on: ["region_id"],
},
])
export default PaymentCollection export default PaymentCollection
@@ -10,9 +10,6 @@ const Payment = model
amount: model.bigNumber(), amount: model.bigNumber(),
currency_code: model.text(), currency_code: model.text(),
provider_id: model.text(), provider_id: model.text(),
cart_id: model.text().searchable().nullable(),
order_id: model.text().searchable().nullable(),
customer_id: model.text().searchable().nullable(),
data: model.json().nullable(), data: model.json().nullable(),
metadata: model.json().nullable(), metadata: model.json().nullable(),
captured_at: model.dateTime().nullable(), captured_at: model.dateTime().nullable(),