fix: address feedback partial
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
import { generateEntityId } from "@medusajs/utils"
|
||||
import Payment from "./payment"
|
||||
|
||||
type OptionalCaptureProps = "created_by" | "created_at" | "completed_at"
|
||||
type OptionalCaptureProps = "created_by" | "created_at"
|
||||
|
||||
@Entity({ tableName: "capture" })
|
||||
export default class Capture {
|
||||
|
||||
@@ -14,44 +14,21 @@ import {
|
||||
} from "@mikro-orm/core"
|
||||
import { DAL } from "@medusajs/types"
|
||||
|
||||
import { DALUtils, generateEntityId } from "@medusajs/utils"
|
||||
import {
|
||||
DALUtils,
|
||||
generateEntityId,
|
||||
PaymentCollectionStatus,
|
||||
} from "@medusajs/utils"
|
||||
import PaymentProvider from "./payment-provider"
|
||||
import PaymentSession from "./payment-session"
|
||||
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 =
|
||||
| "authorized_amount"
|
||||
| "refunded_amount"
|
||||
| "region_id"
|
||||
| "completed_at"
|
||||
| "status"
|
||||
| DAL.SoftDeletableEntityDateColumns
|
||||
|
||||
@Entity({ tableName: "payment_collection" })
|
||||
@@ -120,7 +97,7 @@ export default class PaymentCollection {
|
||||
items: () => PaymentCollectionStatus,
|
||||
default: PaymentCollectionStatus.NOT_PAID,
|
||||
})
|
||||
status: PaymentCollectionStatus = PaymentCollectionStatus.NOT_PAID
|
||||
status?: PaymentCollectionStatus = PaymentCollectionStatus.NOT_PAID
|
||||
|
||||
@ManyToMany(() => PaymentProvider)
|
||||
payment_providers = new Collection<PaymentProvider>(this)
|
||||
|
||||
@@ -10,39 +10,11 @@ import {
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import { DAL } from "@medusajs/types"
|
||||
import { generateEntityId } from "@medusajs/utils"
|
||||
import { generateEntityId, PaymentSessionStatus } from "@medusajs/utils"
|
||||
|
||||
import PaymentCollection from "./payment-collection"
|
||||
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 =
|
||||
| "data"
|
||||
| "is_selected"
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import { generateEntityId } from "@medusajs/utils"
|
||||
import Payment from "./payment"
|
||||
|
||||
type OptionalRefundProps = "created_by" | "completed_at"
|
||||
type OptionalRefundProps = "created_by"
|
||||
|
||||
@Entity({ tableName: "refund" })
|
||||
export default class Refund {
|
||||
|
||||
@@ -5,6 +5,7 @@ export * from "./decorators"
|
||||
export * from "./event-bus"
|
||||
export * from "./feature-flags"
|
||||
export * from "./modules-sdk"
|
||||
export * from "./payment"
|
||||
export * from "./pricing"
|
||||
export * from "./product"
|
||||
export * from "./promotion"
|
||||
|
||||
2
packages/utils/src/payment/index.ts
Normal file
2
packages/utils/src/payment/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./payment-collection"
|
||||
export * from "./payment-session"
|
||||
27
packages/utils/src/payment/payment-collection.ts
Normal file
27
packages/utils/src/payment/payment-collection.ts
Normal file
@@ -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",
|
||||
}
|
||||
27
packages/utils/src/payment/payment-session.ts
Normal file
27
packages/utils/src/payment/payment-session.ts
Normal file
@@ -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",
|
||||
}
|
||||
Reference in New Issue
Block a user