Socket
Socket
Sign inDemoInstall

airwallex-payment-elements

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airwallex-payment-elements - npm Package Compare versions

Comparing version 0.0.74 to 0.0.75

4

lib/bin/airwallex.cjs.js

@@ -1,4 +0,4 @@

/* Airwallex Checkout Component Version [0.0.74] */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=`https://checkout.airwallex.com/assets/bundle.${[0,0,74].join(".")}.min.js`,r=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${e}"], script[src="${e}/"]`)||(()=>{const r=document.createElement("script");r.src=e;const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r})();return new Promise((e,o)=>{r.addEventListener("load",()=>{window.Airwallex?e():o(new Error("Failed to load Airwallex on load event"))}),r.addEventListener("error",()=>{o(new Error("Failed to load Airwallex scripts"))})})});exports.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},exports.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),exports.createPaymentMethod=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},exports.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),exports.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),exports.getPaymentIntent=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},exports.init=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=()=>r,exports.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")};
/* Airwallex Checkout Component Version [0.0.75] */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=`https://checkout.airwallex.com/assets/bundle.${[0,0,75].join(".")}.min.js`,r=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${e}"], script[src="${e}/"]`)||(()=>{const r=document.createElement("script");r.src=e;const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r})();return new Promise((e,o)=>{r.addEventListener("load",()=>{window.Airwallex?e():o(new Error("Failed to load Airwallex on load event"))}),r.addEventListener("error",()=>{o(new Error("Failed to load Airwallex scripts"))})})});exports.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},exports.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),exports.createPaymentMethod=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},exports.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),exports.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),exports.getPaymentIntent=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},exports.init=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=()=>r,exports.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")};
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.cjs.js.map

@@ -1,4 +0,4 @@

/* Airwallex Checkout Component Version [0.0.74] */
const e=`https://checkout.airwallex.com/assets/bundle.${[0,0,74].join(".")}.min.js`,r=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${e}"], script[src="${e}/"]`)||(()=>{const r=document.createElement("script");r.src=e;const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r})();return new Promise((e,o)=>{r.addEventListener("load",()=>{window.Airwallex?e():o(new Error("Failed to load Airwallex on load event"))}),r.addEventListener("error",()=>{o(new Error("Failed to load Airwallex scripts"))})})}),o=()=>r,l=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},n=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},t=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),i=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),w=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),a=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},d=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},s=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}};export{a as confirmPaymentIntent,t as createElement,d as createPaymentMethod,i as destroyElement,w as getElement,s as getPaymentIntent,l as init,o as loadAirwallex,n as redirectToCheckout};
/* Airwallex Checkout Component Version [0.0.75] */
const e=`https://checkout.airwallex.com/assets/bundle.${[0,0,75].join(".")}.min.js`,r=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${e}"], script[src="${e}/"]`)||(()=>{const r=document.createElement("script");r.src=e;const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r})();return new Promise((e,o)=>{r.addEventListener("load",()=>{window.Airwallex?e():o(new Error("Failed to load Airwallex on load event"))}),r.addEventListener("error",()=>{o(new Error("Failed to load Airwallex scripts"))})})}),o=()=>r,l=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},n=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},t=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),i=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),w=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),a=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},d=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},s=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}};export{a as confirmPaymentIntent,t as createElement,d as createPaymentMethod,i as destroyElement,w as getElement,s as getPaymentIntent,l as init,o as loadAirwallex,n as redirectToCheckout};
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.es.js.map

@@ -1,4 +0,4 @@

/* Airwallex Checkout Component Version [0.0.74] */
var Airwallex=function(e){"use strict";const r=`https://checkout.airwallex.com/assets/bundle.${[0,0,74].join(".")}.min.js`,l=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const e=document.querySelector(`script[src="${r}"], script[src="${r}/"]`)||(()=>{const e=document.createElement("script");e.src=r;const l=document.head||document.body;if(!l)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return l.appendChild(e),e})();return new Promise((r,l)=>{e.addEventListener("load",()=>{window.Airwallex?r():l(new Error("Failed to load Airwallex on load event"))}),e.addEventListener("error",()=>{l(new Error("Failed to load Airwallex scripts"))})})});return e.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},e.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),e.createPaymentMethod=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},e.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getPaymentIntent=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},e.init=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=()=>l,e.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},e}({});
/* Airwallex Checkout Component Version [0.0.75] */
var Airwallex=function(e){"use strict";const r=`https://checkout.airwallex.com/assets/bundle.${[0,0,75].join(".")}.min.js`,l=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const e=document.querySelector(`script[src="${r}"], script[src="${r}/"]`)||(()=>{const e=document.createElement("script");e.src=r;const l=document.head||document.body;if(!l)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return l.appendChild(e),e})();return new Promise((r,l)=>{e.addEventListener("load",()=>{window.Airwallex?r():l(new Error("Failed to load Airwallex on load event"))}),e.addEventListener("error",()=>{l(new Error("Failed to load Airwallex scripts"))})})});return e.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},e.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),e.createPaymentMethod=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},e.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getPaymentIntent=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},e.init=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=()=>l,e.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},e}({});
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.iife.js.map
{
"name": "airwallex-payment-elements",
"version": "0.0.74",
"version": "0.0.75",
"module": "lib/bin/airwallex.es.js",

@@ -5,0 +5,0 @@ "types": "types/index.d.ts",

@@ -237,3 +237,3 @@ # airwallex-payment-elements

error?: {
msg: string;
message: string;
code: string;

@@ -240,0 +240,0 @@ value?: string;

import { Element, ElementType } from './element';
import { PaymentMethod, Intent } from './cardNumber';
import { Intent } from './cardNumber';
import { Properties } from 'csstype';
/**
* Global font option config for Airwallex integration methods
*/
export interface FontOptions {
/**
* The font-family property
* https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
*/
family?: string;
/**
* The font source url
* https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face
*/
src?: string;
/**
* The font-weight property
* https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
*/
weight?: string | number;
}
/**
* Global init option config for Airwallex javascript SDK
*/
export interface InitOptions {
locale?: string;
/**
* i18n localization config
*/
locale?: 'en' | 'zh';
/**
* Global font options
*/
font?: FontOptions;
}
export interface Config {
gatewayUrl: string;
options?: InitOptions;
}
/**
* Supported customized pseudo css style for 'cardNumber' | 'expiry' | 'cvc' elements
* https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
*/
type PseudoClasses = ':hover' | ':focus' | '::placeholder' | '::selection' | ':disabled';
/**
* Pseudo-classes object
*/
type PseudoClassStyle = { [K in PseudoClasses]?: Properties };
/**
* Customize the the element using CSS properties
* 1. Reference: https://github.com/frenic/csstype
* 2. Extend with element variations for 'hpp' | 'card' | 'dropIn', following the best practices of https://material-ui.com/api/input-base/
* 3. To support customized Popup overlay width and height
*/
export interface Style extends PseudoClassStyle, Properties {
/**
* Input variation for 'hpp' | 'card' | 'dropIn' integration
*/
variant?: 'outlined' | 'filled' | 'standard' | 'bootstrap';
/**
* Customized Popup overlay width and height like 3DS payment flow
*/
popupWidth?: number;
popupHeight?: number;
}
/**
* Config options for element integration, support using for ElementType
*/
export interface ElementOptions {
/**
* Element css style camelcase option, default style by Chrome browser default
*/
style?: Style;
/**
* Config if the element input are disabled or not, default false
*/
disabled?: boolean;
/**
* The placeholder attribute specifies a short hint that describes the expected value of an input field
*/
placeholder?: string;
/**
* Only support for 'cvc' element config
*/
cvcLength?: number;
/**
* Your checkout website origin url, aka merchant checkout page's 'window.location.origin' field
*/
origin?: string;
/**
* The payment intent you would like to checkout
* Refer to https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/Intro
*/
intent?: Intent;
/**
* The payment method component your website would like to integrate with
*/
component?: 'default' | 'cards' | 'wechatpay';
/**
* Only support for card payment, indicate whether to capture immediate when authentication success
*/
autoCapture?: boolean;
/**
* Apply only for card payment, to improve 3DS experience, indicate if the payment form will collect billing info from shopper
*/
withBilling?: boolean;
}
/**
* Config option for Hosted Payment Page(HPP) when doing redirect checkout using Airwallex payment page
*/
export interface HostPaymentPage {
/**
* Airwallex payment checkout host, i.e 'https://checkout-demo.airwallex.com' or 'https://checkout.airwallex.com'
*/
gatewayUrl: string;
/**
* The intent id you shopper want to checkout
*/
intentId: string;
/**
* The client_secret when you create payment intent, contain in the response
*/
client_secret: string;
/**
* Option with limited support for HPP page style customization
*/
theme?: Style;
customerId?: string;
/**
* Checkout for know customer, refer to https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro
*/
customer_id?: string;
/**
* The payment method component your website would like to integrate with
*/
component?: 'default' | 'cards' | 'wechatpay';
/**
* Only support for card payment, indicate whether to capture immediate when authentication success
*/
autoCapture?: boolean;
/**
* The success return url after shopper succeeded the payment
*/
successUrl?: string;
/**
* The failed return url when shopper can not fulfill the payment intent
*/
failUrl?: string;
/**
* The cancel return url when shopper canceled the payment intent
*/
cancelUrl?: string;
/**
* The logo url of your website you want to show in the HPP head
*/
logoUrl?: string;
locale?: string;
/**
* i18n localization config
*/
locale?: 'en' | 'zh';
/**
* Apply only for card, to improve 3DS experience, indicate if the payment form will collect billing info from shopper
*/
withBilling?: boolean;
}
/**
* Bill address option, only apply to card payment method
*/
export interface Address {
city: string;
/**
* Country code if you know
* https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
*/
country_code: string;
/**
* Local post code in string mode
*/
postcode: string;

@@ -61,40 +186,149 @@ state: string;

}
/**
* The billing info, only apply for card payment
*/
export interface Billing {
/**
* Billing email address in string mode, refer to https://en.wikipedia.org/wiki/Email_address
*/
email: string;
first_name: string;
last_name: string;
/**
* Billing address
*/
address: Address;
}
/**
* Interface to confirm a payment intent with card payment method, the full api request payload can be found:
* https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/_api_v1_pa_payment_intents__id__confirm/post
*
* BACKGROUNDS:
* ------------
* Due to PCI CSS https://www.pcisecuritystandards.org/ Airwallex js SDK will load Airwallex javascript to handle all sensitive information
* The PCI Security Standards Council (SSC) defines ‘cardholder data’ which must also be protected:
* Primary Account Number (PAN) or the full PAN along with any of the following elements:
* Cardholder name
* Expiration date
* Service code
* Sensitive Authentication Data, which must also be protected, includes full magnetic stripe data, CAV2, CVC2, CVV2, CID, PINs, PIN blocks
* Only apply to Card elements (cardNumber | cvc | expiry) integration, refer to ElementType
*
* SOLUTIONS:
* ------------
* The javascript SDK will fulfill collection of all the sensitive information required by PCI DSS
* You checkout page can collect the rest of NON-PCI DSS data and call confirmPaymentIntent using below interface to pass them to Airwallex checkout
*/
export interface PaymentMethod {
/**
* Element create by call createElement interface with 'cardNumber' element type
*/
element: Element;
/**
* The payment method id if you have, can be create by call createPaymentMethod
*/
id?: string;
/**
* The client_secret when you create payment intent, contain in the response
*/
client_secret?: string;
/**
* The payment intent you would like to checkout
* Refer to https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/Intro
*/
intentId?: string;
/**
* The payment method component your website would like to integrate with
*/
customer_id?: string;
/**
* Indicate whether to save this payment method for future payment
*/
save_payment_method?: boolean;
/**
* The payment method detail return by call createPaymentMethod
*/
payment_method?: {
/**
* Card info
*/
card: {
/**
* Card holder name
*/
name?: string;
};
/**
* Card billing information if exist
*/
billing?: Billing;
};
/**
* Only apply for card payment, use this option to provide additional config to confirm payment intent
*/
payment_method_options?: {
/**
* Option only apply to card
*/
card?: {
/**
* Only support for card payment, indicate whether to capture immediate when authentication success
*/
auto_capture?: boolean;
};
};
return_url?: string;
/**
* Response error when failed to call createPaymentMethod
*/
error?: {
/**
* Free text message in english
*/
message?: string;
/**
* String code, will support in the future
*/
code?: string;
};
}
/**
* Element integration `step #1`
* The first method call to init element integration after loadAirwallex successfully return
* Exceptional: not needed for HPP integration, means you can call redirectToCheckout right after loadAirwallex succeeded
*/
export declare const init: (gatewayUrl: string, options?: InitOptions | undefined) => void;
export declare const init: (gatewayUrl: string, options?: InitOptions | undefined) => void;
/**
* Hosted payment page(HPP) integration entrance function
*/
export declare const redirectToCheckout: (props: HostPaymentPage) => void;
/**
* Element integration `step #2`
* Create payment element for checkout
*/
export declare const createElement: (type: ElementType, options?: ElementOptions | undefined) => Element | null;
/**
* Destroy element on the demand
*/
export declare const destroyElement: (type: ElementType) => boolean;
/**
* Query created element by type, there are only exist one type of element in one page
*/
export declare const getElement: (type: ElementType) => Element | null;
/**
* Element integration `step #4`
* Confirm payment intent with element and the rest of payment method info
* Only need for card payment method
*/
export declare const confirmPaymentIntent: (data?: PaymentMethod) => Promise<Intent | boolean>;
/**
* Using this function to create payment method for future checkout, the created payment method can be save in your system
* Optional to for checkout flow
*/
export declare const createPaymentMethod: (

@@ -104,5 +338,13 @@ client_secret: string,

) => Promise<PaymentMethod | boolean>;
/**
* Using this function to get intent details from browser side to directly query on Airwallex api server
* Guarantee with fast query speed
*/
export declare const getPaymentIntent: (intentId: string, client_secret: string) => Promise<Intent | boolean>;
interface Airwallex {
/**
* Interface of global const can be use directly in browser javascript
*/
export interface Airwallex {
init: typeof init;

@@ -109,0 +351,0 @@ redirectToCheckout: typeof redirectToCheckout;

@@ -0,4 +1,19 @@

/**
* The payment intent you would like to checkout
* Refer to https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/Intro
* Hint: this interface only contain the necessary information when shopper checkout
* For the detail meaning of each field you can refer to above api document
*/
export interface Intent {
/**
* Id of intent
*/
id: string;
/**
* client_secret of intent
*/
client_secret?: string;
/**
* Your request id when create payment intent
*/
request_id?: string;

@@ -5,0 +20,0 @@ amount?: number;

@@ -1,34 +0,113 @@

import { InitOptions, ElementOptions } from './airwallex';
import { ElementOptions } from './airwallex';
export interface Options extends ElementOptions, InitOptions {}
/**
* Supported integration element type
*/
export type ElementType = 'cardNumber' | 'expiry' | 'cvc' | 'paymentRequestButton' | 'card' | 'wechat' | 'dropIn';
/**
* Define of error code when failed to validate user input to the element
*/
export type ERROR_CODE = 'REQUIRED' | 'INVALID' | 'UN_SUPPORT' | 'EXPIRED';
/**
* Event code supported value by element when user interact with the checkout element
*/
export type EventCode =
| 'onReady'
| 'onSubmit'
| 'onSuccess'
| 'onError'
| 'onCancel'
| 'onFocus'
| 'onBlur'
| 'onChange'
| 'onClick';
/**
* The event object your checkout page can listen to by below implementation:
* Using html CustomEvent: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
* window.addEventListener(code: EventCode, (event: { detail: ElementEvent }) => /* Your code here *\/ );
*/
export interface ElementEvent {
/**
* Type of element which fire the event
*/
type: ElementType;
code: 'onReady' | 'onSubmit' | 'onSuccess' | 'onError' | 'onCancel' | 'onFocus' | 'onBlur' | 'onChange' | 'onClick';
/**
* Event type code
*/
code: EventCode;
/**
* Indicate if the element input is validate format
*/
complete: boolean;
/**
* Indicate if the element input is empty or not
*/
empty: boolean;
/**
* @ignore
*/
bankName: 'TBD';
/**
* Indicate the brand of card, only apply for card payment method
*/
brand: string;
/**
* Response error when failed to call interact with shopper input
*/
error?: {
msg: string;
code: string;
value?: string;
/**
* Feel text message in english
*/
message: string;
/**
* String code, will support in the future
*/
code: ERROR_CODE;
};
}
/**
* Functions and external fields can be using in your integration flow with airwallex element
* Two ways to get elements, by call createElement function or getElement
* IMPORTANT: once element destroy by call function destroyElement, the element reference should not be using anymore
*/
export interface Element {
gatewayUrl: string;
/**
* Refer to the options when call createElement
*/
options?: ElementOptions;
/**
* The iframe element after mount to the DOM
*/
iframe: HTMLIFrameElement | null;
/**
* Refer to the DOM element you call mount function
*/
domElement: string | HTMLElement;
addResizeListener: (type: string) => void;
/**
* Element integration `step #3`
* Mount payment element to your HTML DOM element for checkout
*/
mount(domElement: string | HTMLElement): void;
/**
* Using this function to blur the input html element
*/
blur(): void;
clear(): void;
destroy(): void;
/**
* Using this function to focus the input html element
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
*/
focus(): void;
/**
* Using this function to unmount the element, opposite to mount function
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus
*/
unmount(): void;
/**
* Using this function to update the element option after create the element
*/
update(options?: ElementOptions): void;
}

@@ -13,2 +13,4 @@ export * from './cardNumber';

getPaymentIntent,
PaymentMethod,
Address,
} from './airwallex';

@@ -25,7 +27,16 @@

getPaymentIntent,
PaymentMethod,
Address,
};
/**
* For integration using `yarn add` or `npm install` the very beginning step method to load all element stuff
*/
export declare const loadAirwallex: () => Promise<Airwallex | null>;
interface Window {
/**
* Global Airwallex const be created after loadAirwallex, you can call it will all supported methods
*/
export interface Window {
Airwallex?: Airwallex;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc