UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

166 lines (165 loc) 5.61 kB
/** * 決済取引サービス */ import * as GMO from '@motionpicture/gmo-service'; import * as factory from '../../factory'; import { Settings } from '../../settings'; import type { AcceptedOfferRepo } from '../../repo/acceptedOffer'; import type { AccountingReportRepo } from '../../repo/accountingReport'; import type { ActionRepo } from '../../repo/action'; import type { AssetTransactionRepo } from '../../repo/assetTransaction'; import type { CredentialsRepo } from '../../repo/credentials'; import type { EventRepo } from '../../repo/event'; import type { OrderRepo } from '../../repo/order'; import type { PaymentServiceRepo } from '../../repo/paymentService'; import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider'; import type { PotentialActionRepo } from '../../repo/potentialAction'; import type { ProductRepo } from '../../repo/product'; import type { SellerPaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted'; import type { TaskRepo } from '../../repo/task'; import * as CreditCardPayment from '../payment/creditCard'; import * as MovieTicketPayment from '../payment/movieTicket'; export interface IStartOperationRepos { accountingReport: AccountingReportRepo; action: ActionRepo; credentials: CredentialsRepo; event: EventRepo; paymentAccepted: SellerPaymentAcceptedRepo; paymentService: PaymentServiceRepo; paymentServiceProvider: PaymentServiceProviderRepo; potentialAction: PotentialActionRepo; product: ProductRepo; assetTransaction: AssetTransactionRepo; task: TaskRepo; } export type IStartOperation<T> = (repos: IStartOperationRepos, settings: Settings) => Promise<T>; export interface ICancelRepos { assetTransaction: AssetTransactionRepo; } export type ICancelOperation<T> = (repos: ICancelRepos) => Promise<T>; export interface IConfirmRepos { acceptedOffer: AcceptedOfferRepo; action: ActionRepo; accountingReport: AccountingReportRepo; assetTransaction: AssetTransactionRepo; event: EventRepo; order: OrderRepo; task: TaskRepo; } export type IConfirmOperation<T> = (repos: IConfirmRepos) => Promise<T>; export type IExportTasksOperation<T> = (repos: { task: TaskRepo; assetTransaction: AssetTransactionRepo; }) => Promise<T>; export type ICheckOperation<T> = (repos: { action: ActionRepo; credentials: CredentialsRepo; event: EventRepo; paymentAccepted: SellerPaymentAcceptedRepo; paymentService: PaymentServiceRepo; paymentServiceProvider: PaymentServiceProviderRepo; }, settings: Settings) => Promise<T>; export type IPublishPaymentUrlOperation<T> = (repos: { action: ActionRepo; paymentAccepted: SellerPaymentAcceptedRepo; paymentService: PaymentServiceRepo; paymentServiceProvider: PaymentServiceProviderRepo; }, settings: Settings) => Promise<T>; export type IPublishPaymentUrlResult = CreditCardPayment.IPaymentAgencyTransaction & { paymentMethodId: string; paymentUrl: string; }; /** * 決済ロケーション発行 */ export declare function publishPaymentUrl(params: Pick<factory.assetTransaction.pay.IStartParamsWithoutDetail, 'agent' | 'location' | 'project' | 'recipient' | 'transactionNumber' | 'typeOf'> & { object: factory.action.accept.pay.IPayObject; /** * add identifier for an unique index(2025-02-25~) */ identifier?: string; }, options: { purposeAsTransaction: { id: string; }; /** * 実行者 */ executor?: { /** * task ID * taskによって実行されている場合値が存在する */ id?: string; }; }): IPublishPaymentUrlOperation<IPublishPaymentUrlResult>; /** * 決済方法認証 */ export declare function check(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<{ result: MovieTicketPayment.ICheckResult; }>; export import IPaymentAgencyTransaction = CreditCardPayment.IPaymentAgencyTransaction; /** * 取引開始 */ export declare function start(params: factory.assetTransaction.pay.IStartParamsWithoutDetail & { instrument: factory.action.trade.pay.IInstrument[]; }, options: { pendingPaymentAgencyTransaction?: CreditCardPayment.IPaymentAgencyTransaction; /** * 実行者 */ executor?: { /** * task ID * taskによって実行されている場合値が存在する */ id?: string; }; purpose: { /** * placeOrder ID */ id?: string; }; checkedAction: { id: string; }; }): IStartOperation<Pick<factory.assetTransaction.pay.ITransaction, 'id' | 'object'>>; /** * 取引確定 */ export declare function confirm(params: factory.assetTransaction.pay.IConfirmParams & { options: {}; }): IConfirmOperation<void>; /** * 取引中止 */ export declare function cancel(params: { id?: string; transactionNumber?: string; }): ICancelOperation<void>; /** * 取引のタスク出力 */ export declare function exportTasksById(params: { id: string; /** * タスク実行日時バッファ */ runsTasksAfterInSeconds?: number; }): IExportTasksOperation<{ id: string; }[]>; /** * 決済代行取引参照 */ export declare function searchGMOTrade(params: { transactionNumber: string; }): (repos: { paymentAccepted: SellerPaymentAcceptedRepo; paymentService: PaymentServiceRepo; paymentServiceProvider: PaymentServiceProviderRepo; assetTransaction: AssetTransactionRepo; }, settings: Settings) => Promise<GMO.factory.credit.ISearchTradeResult>;