feat: Add support for managing account holder in payment module (#11015)

This commit is contained in:
Stevche Radevski
2025-01-28 08:55:15 +01:00
committed by GitHub
parent a37a9c8023
commit 59cbc0ec77
29 changed files with 1328 additions and 803 deletions

View File

@@ -0,0 +1,68 @@
import { ModuleJoinerConfig } from "@medusajs/framework/types"
import { LINKS, Modules } from "@medusajs/framework/utils"
export const CustomerAccountHolder: ModuleJoinerConfig = {
serviceName: LINKS.CustomerAccountHolder,
isLink: true,
databaseConfig: {
tableName: "customer_account_holder",
idPrefix: "custacchldr",
},
alias: [
{
name: ["customer_account_holder", "customer_account_holders"],
entity: "LinkCustomerAccountHolder",
},
],
primaryKeys: ["id", "customer_id", "account_holder_id"],
relationships: [
{
serviceName: Modules.CUSTOMER,
entity: "Customer",
primaryKey: "id",
foreignKey: "customer_id",
alias: "customer",
args: {
methodSuffix: "Customers",
},
},
{
serviceName: Modules.PAYMENT,
entity: "AccountHolder",
primaryKey: "id",
foreignKey: "account_holder_id",
alias: "account_holder",
args: {
methodSuffix: "AccountHolders",
},
},
],
extends: [
{
serviceName: Modules.CUSTOMER,
entity: "Customer",
fieldAlias: {
account_holder: "account_holder_link.account_holder",
},
relationship: {
serviceName: LINKS.CustomerAccountHolder,
primaryKey: "customer_id",
foreignKey: "id",
alias: "account_holder_link",
},
},
{
serviceName: Modules.PAYMENT,
entity: "AccountHolder",
fieldAlias: {
customer: "customer_link.customer",
},
relationship: {
serviceName: LINKS.CustomerAccountHolder,
primaryKey: "account_holder_id",
foreignKey: "id",
alias: "customer_link",
},
},
],
}

View File

@@ -16,3 +16,4 @@ export * from "./region-payment-provider"
export * from "./sales-channel-location"
export * from "./shipping-option-price-set"
export * from "./product-shipping-profile"
export * from "./customer-account-holder"