UNPKG

@lomray/microservice-payment-stripe

Version:

Stripe payment microservice based on NodeJS & inverted json.

94 lines (93 loc) 3.56 kB
import ChargeRefundStatus from "../constants/charge-refund-status.js"; import StripeCheckoutStatus from "../constants/stripe-checkout-status.js"; import StripeTransactionStatus from "../constants/stripe-transaction-status.js"; import TransactionRole from "../constants/transaction-role.js"; import TransactionStatus from "../constants/transaction-status.js"; import TransactionType from "../constants/transaction-type.js"; import Customer from "./customer.js"; import Product from "./product.js"; import { IPaymentIntentMetadata } from "../interfaces/payment-intent-metadata.js"; import ITax from "../interfaces/tax.js"; /** * This calculation related to tax calculation id */ interface IComputedTax { taxTransactionAmountWithTaxUnit?: ITax['transactionAmountWithTaxUnit']; taxExpiresAt?: ITax['expiresAt']; taxCreatedAt?: ITax['createdAt']; taxTotalAmountUnit?: ITax['totalAmountUnit']; taxBehaviour?: ITax['behaviour']; totalTaxPercent?: ITax['totalTaxPercent']; taxFeeUnit?: number; taxAutoCalculationFeeUnit?: number; } /** * Transaction params * @description Definitions: * 1. TransferId - Stripe object is created when you move funds between Stripe accounts as part of Connect. Needed for comprehending * the transaction state in situations involving the reversal of the full or partial transaction amount and refund with reversal. * For instance: py_1OFKUmPBMR5FbqzbQT2N5juH * 2. DestinationTransactionId - Stripe destination transaction id. Reference regarding the destination transaction on the connected account's side * For instance: tr_3OFKatAmQ4asS8PS0GlS9dUr * 3. PersonalFee - Personal user fee. For receiver, it's application fees with only debit extra fees. * For sender, it's application fees with only credit extra fees. */ interface IParams extends Omit<IComputedTax, 'taxAutoCalculationFeeUnit'>, Pick<IPaymentIntentMetadata, 'taxAutoCalculateFee' | 'taxFee'> { refundedTransactionAmount: number; successRefundedAmount: number; refundedApplicationFeeAmount: number; transferAmount: number; transferReversedAmount: number; platformFee: number; stripeFee: number; baseFee: number; extraFee: number; personalFee: number; destinationTransactionId?: string | null; transferId?: string | null; transferDestinationConnectAccountId?: string; paymentStatus?: StripeTransactionStatus; checkoutStatus?: StripeCheckoutStatus; errorMessage?: string; errorCode?: string; declineCode?: string; feesPayer?: TransactionRole; extraRevenue?: number; estimatedInstantPayoutFee?: number; entityCost?: number; taxAutoCalculateFee?: number; } declare class Transaction { id: string; transactionId: string; taxCalculationId: string | null; taxTransactionId: string | null; chargeId: string | null; applicationFeeId: string | null; title: string; userId: string; type: TransactionType; bankAccountId: string | null; cardId: string | null; paymentMethodId: string | null; entityId: string; amount: number; tax: number; fee: number; status: TransactionStatus; chargeRefundStatus: ChargeRefundStatus; isDisputed: boolean; params: IParams; createdAt: Date; updatedAt: Date; product: Product; customer: Customer; /** * Check is cardId exist */ /** * Check is cardId exist */ static isCardOrBankAccountExist(entity: Transaction): boolean; } export { Transaction as default, IComputedTax, IParams };