@mollie/api-client
Version:
Official Mollie API client for Node
143 lines (142 loc) • 5.93 kB
TypeScript
import type TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import HelpfulIterator from '../../plumbing/iteration/HelpfulIterator';
import type Callback from '../../types/Callback';
import type Maybe from '../../types/Maybe';
import type Nullable from '../../types/Nullable';
import { type ThrottlingParameter } from '../../types/parameters';
import Helper from '../Helper';
import type Chargeback from '../chargebacks/Chargeback';
import type Customer from '../customers/Customer';
import type Mandate from '../customers/mandates/Mandate';
import type Order from '../orders/Order';
import type Refund from '../refunds/Refund';
import type SettlementModel from '../settlements/SettlementModel';
import type Subscription from '../subscriptions/Subscription';
import type Terminal from '../terminals/Terminal';
import type Payment from './Payment';
import type Capture from './captures/Capture';
import { type PaymentData } from './data';
export default class PaymentHelper extends Helper<PaymentData, Payment> {
protected readonly links: PaymentData['_links'];
protected readonly embedded: Payment['_embedded'];
constructor(networkClient: TransformingNetworkClient, links: PaymentData['_links'], embedded: Payment['_embedded']);
/**
* Returns whether the payment is refundable.
*
* @since 2.0.0-rc.2
* @deprecated Use `canBeRefunded` instead.
*/
isRefundable(this: PaymentData): boolean;
/**
* Returns whether there are refunds which belong to the payment.
*/
hasRefunds(): boolean;
/**
* Returns whether there are chargebacks which belong to the payment.
*/
hasChargebacks(): boolean;
/**
* The URL your customer should visit to make the payment. This is where you should redirect the consumer to.
*
* @see https://docs.mollie.com/reference/get-payment?path=_links/checkout#response
*/
getCheckoutUrl(): Nullable<string>;
/**
* Returns the direct link to the payment in the Mollie Dashboard.
*
* @see https://docs.mollie.com/reference/get-payment?path=_links/dashboard#response
* @since 4.0.0
*/
getDashboardUrl(): string;
canBeRefunded(this: PaymentData): boolean;
canBePartiallyRefunded(this: PaymentData): boolean;
/**
* Recurring payments do not have a checkout URL, because these payments are executed without any user interaction. This link is included for test mode recurring payments, and allows you to set the
* final payment state for such payments.
*
* This link is also included for paid test mode payments. This allows you to create a refund or chargeback for the payment. This works for all payment types that can be charged back and/or
* refunded.
*
* @see https://docs.mollie.com/reference/get-payment?path=_links/changePaymentState#response-parameters-for-recurring-payments
*/
getChangePaymentStateUrl(): Nullable<string>;
/**
* A link to a hosted payment page where your customer can finish the payment using an alternative payment method also activated on your website profile.
*
* @see https://docs.mollie.com/reference/get-payment?path=_links/payOnline#bank-transfer
*/
getPayOnlineUrl(): Nullable<string>;
/**
* A link to a hosted payment page where your customer can check the status of their payment.
*
* @see https://docs.mollie.com/reference/get-payment?path=_links/status#bank-transfer
*/
getStatusUrl(): Nullable<string>;
/**
* Returns all refunds created for the payment.
*
* @since 3.6.0
*/
getRefunds(parameters?: ThrottlingParameter): HelpfulIterator<Refund>;
/**
* Returns all chargebacks issued for the payment.
*
* @since 3.6.0
*/
getChargebacks(parameters?: ThrottlingParameter): HelpfulIterator<Chargeback>;
/**
* Returns all captures that belong to the payment.
*
* @since 3.6.0
*/
getCaptures(parameters?: ThrottlingParameter): HelpfulIterator<Capture>;
/**
* Returns the order this payment was created for.
*
* @since 3.6.0
*/
getOrder(): Promise<Order> | Promise<undefined>;
getOrder(callback: Callback<Maybe<Order>>): void;
/**
* Returns the settlement this payment has been settled with. Not available if the payment is not yet settled.
*
* @since 4.6.0
*/
getSettlement(): Promise<SettlementModel> | Promise<undefined>;
getSettlement(callback: Callback<Maybe<SettlementModel>>): void;
/**
* Returns the customer this payment belongs to. Not available if the payment is not linked to a customer.
*
* @since 4.6.0
*/
getCustomer(): Promise<Customer> | Promise<undefined>;
getCustomer(callback: Callback<Maybe<Customer>>): void;
/**
* Returns the mandate linked to this payment. Not available for one-off payments.
*
* @since 4.6.0
*/
getMandate(): Promise<Mandate> | Promise<undefined>;
getMandate(callback: Callback<Maybe<Mandate>>): void;
/**
* Returns the subscription this payment is part of. Not available if the payment is not a subscription payment.
*
* @since 4.6.0
*/
getSubscription(): Promise<Subscription> | Promise<undefined>;
getSubscription(callback: Callback<Maybe<Subscription>>): void;
/**
* Returns the terminal this payment was created for. Only available for point-of-sale payments.
*
* @since 4.6.0
*/
getTerminal(): Promise<Terminal> | Promise<undefined>;
getTerminal(callback: Callback<Maybe<Terminal>>): void;
/**
* The deeplink URL to the app of the payment method. Currently only available for `bancontact`.
*
* @see https://docs.mollie.com/reference/get-payment?path=_links/mobileAppCheckout#response
* @since 4.6.0
*/
getMobileAppCheckoutUrl(): Nullable<string>;
}