@mollie/api-client
Version:
Official Mollie API client for Node
96 lines (95 loc) • 4.06 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 Order from '../orders/Order';
import type Refund from '../refunds/Refund';
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/v2/payments-api/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/v2/payments-api/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/v2/payments-api/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/v2/payments-api/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/v2/payments-api/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;
}