Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

airwallex-payment-elements

Package Overview
Dependencies
Maintainers
1
Versions
163
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.66 to 0.0.68

lib/bin/airwallex.cjs.js

60

package.json
{
"name": "airwallex-payment-elements",
"version": "0.0.66",
"module": "lib/airwallex.es.js",
"version": "0.0.68",
"module": "lib/bin/airwallex.es.js",
"types": "types/index.d.ts",

@@ -26,3 +26,3 @@ "directories": {

"prepare": "tsc",
"lint": "eslint \"src/*.{js,ts,tsx}\" ",
"lint": "eslint \"src/*.{js,ts,tsx}\" \"types/*.ts\" ",
"start": "serve public",

@@ -34,36 +34,35 @@ "test-sonar": "sonar-scanner",

"devDependencies": {
"@babel/core": "^7.8.4",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-json": "^4.0.3",
"@babel/core": "^7.11.1",
"@commitlint/cli": "^9.1.1",
"@commitlint/config-conventional": "^9.1.1",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-commonjs": "^14.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^8.4.0",
"@rollup/plugin-replace": "^2.3.3",
"@rollup/plugin-typescript": "^3.0.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"@webcomponents/webcomponentsjs": "^2.4.2",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"confusing-browser-globals": "^1.0.9",
"core-js": "^3.6.4",
"eslint": "^6.8.0",
"core-js": "^3.6.5",
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.3",
"lint-staged": "^10.0.8",
"prettier": "^1.19.1",
"rollup": "^1.31.1",
"rollup-plugin-analyzer": "^3.2.2",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.2.0",
"semantic-release": "^17.0.8",
"serve": "^11.3.0",
"sonarqube-scanner": "^2.5.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.2.5",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5",
"rollup": "^2.23.0",
"rollup-plugin-analyzer": "^3.3.0",
"rollup-plugin-terser": "^6.1.0",
"semantic-release": "^17.1.1",
"serve": "^11.3.2",
"sonarqube-scanner": "^2.7.0",
"tslint-config-prettier": "^1.18.0",
"tslint-eslint-rules": "^5.4.0",
"tslint-plugin-prettier": "^2.1.0",
"typescript": "^3.8.2"
"tslint-plugin-prettier": "^2.3.0",
"typescript": "^3.9.7"
},
"dependencies": {},
"husky": {

@@ -85,3 +84,4 @@ "hooks": {

]
}
},
"dependencies": {}
}

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

```ts
window.Airwallex.init(client_secret: string, gateway_url: string, options?: InitOptions);
Airwallex.init(client_secret: string, gateway_url: string, options?: InitOptions);
```

@@ -77,3 +77,3 @@

host: string; // checkout-{env}.airwallex.com | checkout.airwallex.com
clientSecret: string;
client_secret: string;
theme?: Style;

@@ -94,3 +94,3 @@ customerId?: string;

host: 'checkout.airwallex.com',
clientSecret: 'client_secret',
client_secret: 'client_secret',
}

@@ -173,3 +173,3 @@ ```

```js
window.Airwallex.createElement(type, options);
Airwallex.createElement(type, options);
```

@@ -186,3 +186,3 @@

```js
const cardElement = window.Airwallex.createElement('card');
const cardElement = Airwallex.createElement('card');
cardElement.mount('card');

@@ -196,3 +196,3 @@ ```

```ts
export declare const confirmPaymentIntent: (clientSecret: string, data: ConfirmIntentData) => Promise<boolean | Intent>;
export declare const confirmPaymentIntent: (data: ConfirmIntentData) => Promise<boolean | Intent>;
```

@@ -204,5 +204,4 @@

const payload = {
element: window.Airwallex.getElement('card'),
intentId,
clientSecret,
element: Airwallex.getElement('card'),
intent,
payment_method: {

@@ -213,3 +212,3 @@ billing

try {
const res = await window.Airwallex.confirmPaymentIntent(clientSecret, payload);
const res = await Airwallex.confirmPaymentIntent(payload);
const { confirmResult } = res || {};

@@ -216,0 +215,0 @@ const { id, status } = confirmResult || {};

@@ -1,114 +0,98 @@

///<reference path='./baseElement.d.ts' />
///<reference path='./card.d.ts' />
///<reference path='./cardNumber.d.ts' />
///<reference path='./cvc.d.ts' />
///<reference path='./expiry.d.ts' />
///<reference path='./paymentRequestButton.d.ts' />
///<reference path='./dropIn.d.ts' />
import { Element, ElementType } from './element';
import { PaymentMethodBase, Intent } from './cardNumber';
declare module 'airwallex-payment-elements' {
interface Airwallex {
redirectToCheckout: (props: HostPaymentPage) => void;
createElement: (
type: 'cardNumber' | 'expiry' | 'cvc' | 'paymentRequestButton' | 'card' | 'wechat' | 'dropIn',
options?: ElementOptions | undefined,
) => ElementBase | null;
destroyElement: (type: 'cardNumber' | 'expiry' | 'cvc' | 'paymentRequestButton' | 'card' | 'wechat' | 'dropIn') => boolean;
getElement: (type: 'cardNumber' | 'expiry' | 'cvc' | 'paymentRequestButton' | 'card' | 'wechat' | 'dropIn') => ElementBase | null;
confirmPaymentIntent: (clientSecret: string, data: ConfirmIntentData) => Promise<boolean | Intent>;
createPaymentMethod: (clientSecret: string, data: PaymentMethod) => Promise<boolean | PaymentMethodBase>;
getPaymentIntent: (intentId: string, clientSecret: string) => Promise<boolean | Intent>;
}
export interface FontOptions {
family?: string;
src?: string;
weight?: string | number;
}
interface Style {
variant: 'outlined' | 'filled' | 'standard' | 'bootstrap';
hidden?: boolean;
backgroundColor?: string;
color?: string;
fontSize?: string;
fontSmoothing?: string;
fontStyle?: string;
fontVariant?: string;
fontWeight?: string;
lineHeight?: string;
letterSpacing?: string;
textAlign?: string;
padding?: number;
textDecoration?: string;
textShadow?: string;
textTransform?: string;
popupWidth?: number;
popupHeight?: number;
}
export interface InitOptions {
locale?: string;
font?: FontOptions;
}
interface ElementOptions {
style?: Style;
placeholder?: string;
cvcLength?: number;
origin?: string;
intent?: Intent;
}
// TODO: need to decide if client_secret need to be global
export interface Config {
gatewayUrl: string;
options?: InitOptions;
}
interface HostPaymentPage {
host: string; // checkout-{env}.airwallex.com | checkout.airwallex.com
intentId: string;
clientSecret: string;
theme?: Style;
customerId?: string;
component?: 'default' | 'cards' | 'wechatpay';
autoCapture?: boolean;
successUrl?: string;
failUrl?: string;
cancelUrl?: string;
logoUrl?: string;
origin?: string;
}
export interface Style {
variant?: 'outlined' | 'filled' | 'standard' | 'bootstrap';
hidden?: boolean;
backgroundColor?: string;
color?: string;
fontSize?: string;
fontSmoothing?: string;
fontStyle?: string;
fontVariant?: string;
fontWeight?: string;
lineHeight?: string;
letterSpacing?: string;
textAlign?: string;
padding?: string | number;
margin?: string | number;
height?: string | number;
display?: string;
textDecoration?: string;
textShadow?: string;
textTransform?: string;
popupWidth?: number;
popupHeight?: number;
}
export interface ElementOptions {
style?: Style;
placeholder?: string;
cvcLength?: number;
origin?: string;
intent?: Intent;
component?: 'default' | 'cards' | 'wechatpay';
autoCapture?: boolean;
}
export interface HostPaymentPage {
gatewayUrl: string;
intentId: string;
client_secret: string;
theme?: Style;
customerId?: string;
component?: 'default' | 'cards' | 'wechatpay';
autoCapture?: boolean;
successUrl?: string;
failUrl?: string;
cancelUrl?: string;
logoUrl?: string;
locale?: string;
}
/**
* Use `init(clientSecret, gatewayUrl, options?)` to create an instance of the `Airwallex` object.
* The Airwallex object is your entrypoint to the rest functions.
*/
interface AirwallexConstructor {
clientSecret: string;
gatewayUrl: string;
options?: InitOptions;
}
export declare const init: (gatewayUrl: string, options?: InitOptions | undefined) => void;
export declare const redirectToCheckout: (props: HostPaymentPage) => void;
export declare const createElement: (type: ElementType, options?: ElementOptions | undefined) => Element | null;
export declare const destroyElement: (type: ElementType) => boolean;
export declare const getElement: (type: ElementType) => Element | null;
export interface ConfirmIntentData extends PaymentMethodBase {
element?: Element;
paymentMethodId?: string;
}
export declare const confirmPaymentIntent: (data: ConfirmIntentData) => Promise<Intent | boolean>;
export interface PaymentMethod extends PaymentMethodBase {
element: Element;
}
export declare const createPaymentMethod: (
client_secret: string,
data: PaymentMethod,
) => Promise<PaymentMethodBase | boolean>;
export declare const getPaymentIntent: (intentId: string, client_secret: string) => Promise<Intent | boolean>;
interface FontOptions {
family?: string;
src?: string;
weight?: string;
}
interface Airwallex {
init: typeof init;
redirectToCheckout: typeof redirectToCheckout;
createElement: typeof createElement;
destroyElement: typeof destroyElement;
getElement: typeof getElement;
confirmPaymentIntent: typeof confirmPaymentIntent;
createPaymentMethod: typeof createPaymentMethod;
getPaymentIntent: typeof getPaymentIntent;
}
interface InitOptions {
locale?: string;
font?: FontOptions;
}
interface Config {
clientSecret: string;
gatewayUrl: string;
options: InitOptions | any;
cvcLength: number;
}
interface Elements {
cardNumber: CardNumberElement | null;
expiry: ExpiryElement | null;
cvc: CvcElement | null;
threeDsFrictionless: ThreeDsFrictionlessElement | null;
threeDsChallenge: ThreeDsChallengeElement | null;
paymentRequestButton: PaymentRequestButtonElement | null;
card: CardElement | null;
dropIn: DropInElement | null;
}
interface ConfirmIntentData extends PaymentMethodBase {
element?: CardNumberElement;
paymentMethodId?: string;
}
interface PaymentMethod extends PaymentMethodBase {
element: CardNumberElement;
}
}
export default Airwallex;

@@ -1,69 +0,44 @@

import { ElementBase, ElementOptions, Options } from 'airwallex-payment-elements';
declare module 'airwallex-payment-elements' {
interface PaymentMethodBase {
id?: string;
intentId?: string;
customer_id?: string;
save_payment_method?: boolean;
payment_method?: {
card: {
name?: string;
};
billing?: Billing;
export interface PaymentMethodBase {
id?: string;
client_secret: string;
intentId?: string;
customer_id?: string;
save_payment_method?: boolean;
payment_method?: {
card: {
name?: string;
};
payment_method_options?: {
card?: {
auto_capture?: boolean;
};
billing?: Billing;
};
payment_method_options?: {
card?: {
auto_capture?: boolean;
};
return_url?: string;
error?: {
message?: string;
code?: string;
};
}
interface Billing {
email: string;
first_name: string;
last_name: string;
address: Address;
}
interface Address {
city: string;
country_code: string;
postcode: string;
state: string;
street: string;
}
interface Intent {
};
return_url?: string;
error?: {
message?: string;
code?: string;
};
}
interface Billing {
email: string;
first_name: string;
last_name: string;
address: Address;
}
interface Address {
city: string;
country_code: string;
postcode: string;
state: string;
street: string;
}
export interface Intent {
id: string;
client_secret: string;
merchant_customer_id: string;
latest_payment_attempt: {
id: string;
latest_payment_attempt: {
id: string;
};
}
interface CardNumberElement extends ElementBase {
retrieve: {
resolver: (value?: Intent | PromiseLike<Intent>) => void;
reject: (reason?: any) => void;
awaiting: boolean;
};
confirmIntent: {
resolver: (value?: Intent | PromiseLike<Intent>) => void;
reject: (reason?: any) => void;
awaiting: boolean;
};
createMethod: {
resolver: (value?: PaymentMethodBase | PromiseLike<PaymentMethodBase>) => void;
reject: (reason?: any) => void;
awaiting: boolean;
};
constructor(gatewayUrl: string, options?: Options);
update(options?: ElementOptions): void;
confirm(data?: PaymentMethodBase): Promise<Intent>;
createPaymentMethod(data?: PaymentMethodBase): Promise<PaymentMethodBase>;
getPaymentIntent(intentId: string, clientSecret: string): Promise<Intent>;
success(value: Intent): void;
cancel(reason?: string): void;
}
};
}

@@ -1,9 +0,26 @@

///<reference path='./airwallex.d.ts' />
import Airwallex, {
init,
redirectToCheckout,
createElement,
destroyElement,
getElement,
confirmPaymentIntent,
createPaymentMethod,
getPaymentIntent,
} from './airwallex';
declare module 'airwallex-payment-elements' {
const loadAirwallex: () => Promise<ElementBase | null>;
}
export {
init,
redirectToCheckout,
createElement,
destroyElement,
getElement,
confirmPaymentIntent,
createPaymentMethod,
getPaymentIntent,
};
export declare const loadAirwallex: () => Promise<Airwallex | null>;
interface Window {
Airwallex?: import('airwallex-payment-elements').init;
Airwallex?: Airwallex;
}
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