fix: address feedback partial

This commit is contained in:
fPolic committed 2024-01-16 10:30:52 +01:00
1 parent 89d6d7e846
commit 22254a22c0
8 files changed
+67 -61

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ import {
import { generateEntityId } from "@medusajs/utils" import { generateEntityId } from "@medusajs/utils"
import Payment from "./payment" import Payment from "./payment"
type OptionalCaptureProps = "created_by" | "created_at" | "completed_at" type OptionalCaptureProps = "created_by" | "created_at"
@Entity({ tableName: "capture" }) @Entity({ tableName: "capture" })
export default class Capture { export default class Capture {
@@ -14,44 +14,21 @@ import {
} from "@mikro-orm/core" } from "@mikro-orm/core"
import { DAL } from "@medusajs/types" import { DAL } from "@medusajs/types"
import { DALUtils, generateEntityId } from "@medusajs/utils" import {
DALUtils,
generateEntityId,
PaymentCollectionStatus,
} from "@medusajs/utils"
import PaymentProvider from "./payment-provider" import PaymentProvider from "./payment-provider"
import PaymentSession from "./payment-session" import PaymentSession from "./payment-session"
import Payment from "./payment" import Payment from "./payment"
/**
* @enum
*
* The payment collection's status.
*/
export enum PaymentCollectionStatus {
/**
* The payment collection isn't paid.
*/
NOT_PAID = "not_paid",
/**
* The payment collection is awaiting payment.
*/
AWAITING = "awaiting",
/**
* The payment collection is authorized.
*/
AUTHORIZED = "authorized",
/**
* Some of the payments in the payment collection are authorized.
*/
PARTIALLY_AUTHORIZED = "partially_authorized",
/**
* The payment collection is canceled.
*/
CANCELED = "canceled",
}
type OptionalPaymentCollectionProps = type OptionalPaymentCollectionProps =
| "authorized_amount" | "authorized_amount"
| "refunded_amount" | "refunded_amount"
| "region_id" | "region_id"
| "completed_at" | "completed_at"
| "status"
| DAL.SoftDeletableEntityDateColumns | DAL.SoftDeletableEntityDateColumns
@Entity({ tableName: "payment_collection" }) @Entity({ tableName: "payment_collection" })
@@ -120,7 +97,7 @@ export default class PaymentCollection {
items: () => PaymentCollectionStatus, items: () => PaymentCollectionStatus,
default: PaymentCollectionStatus.NOT_PAID, default: PaymentCollectionStatus.NOT_PAID,
}) })
status: PaymentCollectionStatus = PaymentCollectionStatus.NOT_PAID status?: PaymentCollectionStatus = PaymentCollectionStatus.NOT_PAID
@ManyToMany(() => PaymentProvider) @ManyToMany(() => PaymentProvider)
payment_providers = new Collection<PaymentProvider>(this) payment_providers = new Collection<PaymentProvider>(this)
+1 -29
View File
@@ -10,39 +10,11 @@ import {
Property, Property,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import { DAL } from "@medusajs/types" import { DAL } from "@medusajs/types"
import { generateEntityId } from "@medusajs/utils" import { generateEntityId, PaymentSessionStatus } from "@medusajs/utils"
import PaymentCollection from "./payment-collection" import PaymentCollection from "./payment-collection"
import Payment from "./payment" import Payment from "./payment"
/**
* @enum
*
* The status of a payment session.
*/
export enum PaymentSessionStatus {
/**
* The payment is authorized.
*/
AUTHORIZED = "authorized",
/**
* The payment is pending.
*/
PENDING = "pending",
/**
* The payment requires an action.
*/
REQUIRES_MORE = "requires_more",
/**
* An error occurred while processing the payment.
*/
ERROR = "error",
/**
* The payment is canceled.
*/
CANCELED = "canceled",
}
type OptionalPaymentSessionProps = type OptionalPaymentSessionProps =
| "data" | "data"
| "is_selected" | "is_selected"
+1 -1
View File
@@ -11,7 +11,7 @@ import {
import { generateEntityId } from "@medusajs/utils" import { generateEntityId } from "@medusajs/utils"
import Payment from "./payment" import Payment from "./payment"
type OptionalRefundProps = "created_by" | "completed_at" type OptionalRefundProps = "created_by"
@Entity({ tableName: "refund" }) @Entity({ tableName: "refund" })
export default class Refund { export default class Refund {
+1
View File
@@ -5,6 +5,7 @@ export * from "./decorators"
export * from "./event-bus" export * from "./event-bus"
export * from "./feature-flags" export * from "./feature-flags"
export * from "./modules-sdk" export * from "./modules-sdk"
export * from "./payment"
export * from "./pricing" export * from "./pricing"
export * from "./product" export * from "./product"
export * from "./promotion" export * from "./promotion"
+2
View File
@@ -0,0 +1,2 @@
export * from "./payment-collection"
export * from "./payment-session"
@@ -0,0 +1,27 @@
/**
* @enum
*
* The payment collection's status.
*/
export enum PaymentCollectionStatus {
/**
* The payment collection isn't paid.
*/
NOT_PAID = "not_paid",
/**
* The payment collection is awaiting payment.
*/
AWAITING = "awaiting",
/**
* The payment collection is authorized.
*/
AUTHORIZED = "authorized",
/**
* Some of the payments in the payment collection are authorized.
*/
PARTIALLY_AUTHORIZED = "partially_authorized",
/**
* The payment collection is canceled.
*/
CANCELED = "canceled",
}
@@ -0,0 +1,27 @@
/**
* @enum
*
* The status of a payment session.
*/
export enum PaymentSessionStatus {
/**
* The payment is authorized.
*/
AUTHORIZED = "authorized",
/**
* The payment is pending.
*/
PENDING = "pending",
/**
* The payment requires an action.
*/
REQUIRES_MORE = "requires_more",
/**
* An error occurred while processing the payment.
*/
ERROR = "error",
/**
* The payment is canceled.
*/
CANCELED = "canceled",
}