@paydock/client-sdk
Version:
Paydock client sdk
108 lines • 5.31 kB
TypeScript
import type { IBamboraMeta, IFormElement, IPayPalMeta } from '../components/param';
import { type PURPOSE } from './configuration';
import { HtmlMultiWidget } from './html-multi-widget';
/**
* Class Widget include method for working on html and include extended by HtmlMultiWidget methods
* @constructor
* @extends HtmlMultiWidget
* @extends MultiWidget
*
* @example
* var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID'); // short
*
* var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID', 'bank_account', 'payment_source'); // extend
*
* var widget = new HtmlWidget('#widget', 'publicKey', 'not_configured'); // without gateway
*
* @param {string} selector - Selector of html element. Container for widget
* @param {string} publicKey - PayDock users public key
* @param {string} [gatewayID=default] - ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
* @param {string} [paymentType=card] - Type of payment source which shows in widget form. Available parameters : “card”, “bank_account”.
* @param {string} [purpose=payment_source] - Purpose of widget form. Available parameters: ‘payment_source’, ‘card_payment_source_with_cvv’, ‘card_payment_source_without_cvv’
*/
declare class HtmlWidget extends HtmlMultiWidget {
/** @constructs */ constructor(selector: string, publicKey: string, gatewayID?: string, paymentType?: string, purpose?: PURPOSE);
/**
* Destination, where customer will receive all successful responses.
* Response will contain “data” object with “payment_source” or other parameters, in depending on 'purpose'
*
* @example
* widget.setWebHookDestination('http://google.com');
*
* @param {string} url - Your endpoint for post request.
*/
setWebHookDestination(url: string): void;
/**
* URL to which the Customer will be redirected to after the success finish
*
* @example
* widget.setSuccessRedirectUrl('google.com/search?q=success');
*
* @param {string} url
*/
setSuccessRedirectUrl(url: string): void;
/**
* URL to which the Customer will be redirected to if an error is triggered in the process of operation
*
* @example
* widget.setErrorRedirectUrl('google.com/search?q=error');
*
* @param {string} url
*/
setErrorRedirectUrl(url: string): void;
/**
* Set list with widget form field, which will be shown in form. Also you can set the required validation for these fields
*
* @example
* widget.setFormFields(['phone', 'email', 'first_name*']);
*
* @param {string[]} fields - name of fields which can be shown in a widget.
* If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
*/
setFormFields(fields: string[]): void;
/**
* The method to set the full configuration for the all specific form elements (visibility, required, label, placeholder, value)
* You can also use the other method for the partial configuration like: setFormFields, setFormValues, setFormPlaceholder, setFormLabel
*
* @example
* widget.setFormElements([
* {
* field: 'card_name*',
* placeholder: 'Input your card holder name...',
* label: 'Card Holder Name',
* value: 'Houston',
* },
* {
* field: 'email',
* placeholder: 'Input your email, like test@example.com',
* label: 'Email for the receipt',
* value: 'predefined@email.com',
* },
* ])
*
* @param { Object[] } elements - List of elements
* @param { string } elements[].field - Field name of element. If after a name of a field, you put “*”, this field will be required on client-side. (For validation, you can specify any fields, even those that are shown by default: card_number, expiration, etc... ) [FORM_FIELD]{@link FORM_FIELD}
* @param { string } elements[].placeholder - Set custom placeholders in form fields
* @param { string } elements[].label - Set a custom labels near the form field
* @param { string } elements[].value - Set predefined values for the form field
*/
setFormElements(elements: IFormElement[]): void;
setFormElement(element: IFormElement): void;
/**
* The method to set meta information for the checkout page
*
* @example
* config.setMeta({
brand_name: 'paydock',
reference: '15',
email: 'wault@paydock.com'
});
*
* @param {IPayPalMeta | IBamboraMeta} object - data which can be shown on checkout page [IPayPalMeta]{@link IPayPalMeta} [IBamboraMeta]{@link IBamboraMeta}
*/
setMeta(meta: IPayPalMeta | IBamboraMeta): void;
setGiftCardScheme(giftCardScheme: any, processingNetwork: any): void;
disableResultMessage(): void;
}
export { HtmlWidget };
//# sourceMappingURL=html-widget.d.ts.map