import type { passport } from '@waiter/factory'; import { IAttributes as ISendEmailMessageActionAttributes } from '../action/transfer/send/message/email'; import { IExtendId } from '../autoGenerated'; import { IClientUser } from '../clientUser'; import { CreativeWorkType } from '../creativeWorkType'; import { ICustomer as IOrderCustomer, IBroker, IIdentifier as IOrderIdentifier, ISeller as IOrderSeller, IOrder } from '../order'; import { IProject } from '../project'; import { IAgent as IBaseAgent, IPassportBeforeStart, ISeller as IBaseSeller, ISearchConditions as IBaseSearchConditions, ISendEmailMessageParams, IStartParams as IBaseStartParams, IAttributes as IBaseAttributes } from '../transaction'; import { TransactionType } from '../transactionType'; export interface IMemberOfPayload { iss: string; sub: string; } /** * 取引人 */ export type IAgent = IBaseAgent & { /** * 外部メンバーシップトークン */ memberOfToken?: string; memberOfPayload?: IMemberOfPayload; }; export type ICustomerInObject = Pick; export interface IPaymentMethodByPaymentUrl { /** * 決済採用時に発行済の決済方法ID * 決済承認時に指定が可能 */ paymentMethodId: string; } export interface IObject { clientUser?: Omit; broker?: Pick; customer?: ICustomerInObject; identifier?: IOrderIdentifier; /** * 確認番号 */ confirmationNumber?: string; /** * 注文番号 */ orderNumber?: string; /** * 注文名称 */ name?: string; /** * 決済URLでの決済情報 */ paymentMethods?: IPaymentMethodByPaymentUrl; /** * WAITER許可証 */ passport?: passport.IPassport; } export interface IStartParamsWithoutDetail { project: Pick; agent: IAgent; seller: { id: string; }; object: { clientUser?: Omit; customer?: ICustomerInObject; passport?: IPassportBeforeStart; /** * 注文名称 */ name?: string; }; } export type ISeller = IBaseSeller & Pick; export interface IInstrument { typeOf: CreativeWorkType.WebApplication; /** * アプリケーションID */ id: string; } /** * 取引開始パラメーター */ export interface IStartParams extends Pick, 'agent' | 'project' | 'object' | 'typeOf'> { /** * 販売者 */ seller: ISeller; expiresInSeconds: number; instrument?: IInstrument; } /** * 取引確定後アクションパラメータ */ export interface IPotentialActionsParams { order?: { potentialActions?: { sendOrder?: { potentialActions?: { sendEmailMessage?: ISendEmailMessageParams[]; }; }; }; }; } /** * 取引結果の注文パラメータ */ export interface IResultOrderParams { /** * 注文識別子指定 */ identifier?: IOrderIdentifier; /** * 注文確認URLのカスタム指定 */ url?: string; } /** * 取引結果パラメータ */ export interface IResultParams { order?: IResultOrderParams; } /** * 取引確定パラメータ */ export interface IConfirmParams { /** * 取引ID */ id: string; agent?: { id?: string; }; /** * 取引確定後アクション */ potentialActions?: IPotentialActionsParams; /** * 取引結果 */ result?: IResultParams; } export type IOrderAsResult = Pick; export interface IAuthorizeActionAsResult { id: string; } /** * 取引結果 */ export interface IResult { /** * 注文 */ order: IOrderAsResult; /** * 取引確定時の同期的な注文コード発行に対応(2024-02-05~) */ code?: string; /** * 承認アクションID(2024-01-17~) */ authorizeActions?: IAuthorizeActionAsResult[]; /** * オファー数(2024-01-17~) */ numAcceptedOffers?: number; } /** * エラー */ export type IError = any; export type IPotentialSendEmailMessageAction = Pick; export interface IPotentialSendOrderAction { potentialActions?: { sendEmailMessage?: IPotentialSendEmailMessageAction[]; }; } export interface IOrderPotentialActions { sendOrder?: IPotentialSendOrderAction; } export interface IPotentialActions { order: { onOrderProcessing?: { sendEmailMessage?: IPotentialSendEmailMessageAction[]; }; }; } export interface IAttributes extends IBaseAttributes, IResult, IError, IPotentialActions> { } /** * 注文取引 */ export type ITransaction = IExtendId; export interface ISearchConditions extends IBaseSearchConditions { seller?: { ids?: string[]; }; object?: { orderNumber?: { $eq?: string; }; }; result?: { order?: { confirmationNumber?: { $eq?: string; }; orderNumbers?: string[]; }; }; }