mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-03-22 23:51:21 +00:00
Compare commits
6 Commits
develop
...
v2.2.1-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c59fca0f31 | ||
|
|
6f1d95432e | ||
|
|
a3ebb01aee | ||
|
|
e5d4d72098 | ||
|
|
2654f5b20a | ||
|
|
605e364082 |
@@ -1,2 +1,3 @@
|
||||
/src/typings/**/*.ts
|
||||
/examples
|
||||
/src/__mocks__/*
|
||||
/src/__tests__/*
|
||||
/src/typings/*
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@adyen/api-library",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1-rc.4",
|
||||
"description": "The Adyen API Library for NodeJS enables you to work with Adyen APIs.",
|
||||
"main": "dist/lib/src/index.js",
|
||||
"types": "dist/lib/src/index.d.ts",
|
||||
@@ -46,9 +46,7 @@
|
||||
"@babel/preset-env": "7.8.3",
|
||||
"@babel/preset-typescript": "7.8.3",
|
||||
"@babel/runtime": "7.8.3",
|
||||
"@types/jest": "24.0.25",
|
||||
"@types/nock": "10.0.3",
|
||||
"@types/node": "13.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "2.16.0",
|
||||
"@typescript-eslint/parser": "2.16.0",
|
||||
"babel-loader": "8.0.6",
|
||||
@@ -64,6 +62,8 @@
|
||||
"webpack-cli": "3.3.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "13.1.7",
|
||||
"@types/jest": "24.0.25",
|
||||
"https-proxy-agent": "4.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
import Resource from "../services/resource";
|
||||
import HttpClientException from "../httpClient/httpClientException";
|
||||
import ApiException from "../services/exception/apiException";
|
||||
import {IRequest} from "../typings/requestOptions";
|
||||
|
||||
async function getJsonResponse<T>(resource: Resource, jsonRequest: T | string, requestOptions?: IRequest.Options): Promise<string>;
|
||||
async function getJsonResponse<T, R>(resource: Resource, jsonRequest: T | string, requestOptions?: IRequest.Options): Promise<R>;
|
||||
|
||||
@@ -22,6 +22,7 @@ import { AgentOptions } from "https";
|
||||
import HttpClientException from "./httpClientException";
|
||||
import ApiException from "../services/exception/apiException";
|
||||
import {Config} from "../index";
|
||||
import {IRequest} from "../typings/requestOptions";
|
||||
|
||||
interface ClientInterface {
|
||||
request(
|
||||
|
||||
@@ -33,6 +33,7 @@ import {ApiError} from "../typings/apiError";
|
||||
import ApiException from "../services/exception/apiException";
|
||||
import ClientInterface from "./clientInterface";
|
||||
import {ApiConstants} from "../constants/apiConstants";
|
||||
import {IRequest} from "../typings/requestOptions";
|
||||
|
||||
class HttpURLConnectionClient implements ClientInterface {
|
||||
private static CHARSET = "utf-8";
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
* See the LICENSE file for more info.
|
||||
*/
|
||||
|
||||
// import "./typings";
|
||||
|
||||
export { default as Client } from "./client";
|
||||
export { default as Config } from "./config";
|
||||
export * from "./services/";
|
||||
|
||||
@@ -29,6 +29,7 @@ import PaymentSession from "./resource/checkout/paymentSession";
|
||||
import PaymentsResult from "./resource/checkout/paymentsResult";
|
||||
import PaymentLinks from "./resource/checkout/paymentLinks";
|
||||
import setApplicationInfo from "../helpers/setApplicationInfo";
|
||||
import {IRequest} from "../typings/requestOptions";
|
||||
|
||||
class Checkout extends ApiKeyAuthenticatedService {
|
||||
private readonly _payments: Payments;
|
||||
|
||||
@@ -29,6 +29,7 @@ import Refund from "./resource/modification/refund";
|
||||
import TechnicalCancel from "./resource/modification/technicalCancel";
|
||||
import setApplicationInfo from "../helpers/setApplicationInfo";
|
||||
import {ApplicationInfo} from "../typings/applicationInfo";
|
||||
import {IRequest} from "../typings/requestOptions";
|
||||
|
||||
interface AppInfo { applicationInfo?: ApplicationInfo }
|
||||
type GenericRequest<T> = T & AppInfo;
|
||||
|
||||
@@ -24,6 +24,7 @@ import Service from "../service";
|
||||
import HttpClientException from "../httpClient/httpClientException";
|
||||
import ApiException from "./exception/apiException";
|
||||
import ClientInterface from "../httpClient/clientInterface";
|
||||
import {IRequest} from "../typings/requestOptions";
|
||||
|
||||
abstract class Resource {
|
||||
protected endpoint: string;
|
||||
|
||||
@@ -36,26 +36,26 @@ export class ApplicationInfo {
|
||||
this.adyenLibrary = {
|
||||
name: Client.LIB_NAME,
|
||||
version: Client.LIB_VERSION,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommonField {
|
||||
declare interface CommonField {
|
||||
name?: string;
|
||||
version?: string;
|
||||
}
|
||||
|
||||
export interface ExternalPlatform extends CommonField {
|
||||
declare interface ExternalPlatform extends CommonField {
|
||||
integrator?: string;
|
||||
}
|
||||
|
||||
export interface MerchantDevice {
|
||||
declare interface MerchantDevice {
|
||||
os?: string;
|
||||
osVersion?: string;
|
||||
reference?: string;
|
||||
}
|
||||
|
||||
export interface ShopperInteractionDevice {
|
||||
declare interface ShopperInteractionDevice {
|
||||
os?: string;
|
||||
osVersion?: string;
|
||||
locale?: string;
|
||||
|
||||
20
src/typings/index.ts
Normal file
20
src/typings/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
/// <reference path="amount.ts" />
|
||||
/// <reference path="apiError.ts" />
|
||||
/// <reference path="applicationInfo.ts" />
|
||||
/// <reference path="binLookup.ts" />
|
||||
/// <reference path="checkout.ts" />
|
||||
/// <reference path="checkoutUtility.ts" />
|
||||
/// <reference path="environment.ts" />
|
||||
/// <reference path="marketPayAccount.ts" />
|
||||
/// <reference path="marketPayFund.ts" />
|
||||
/// <reference path="marketPayHostedOnboardingPage.ts" />
|
||||
/// <reference path="marketPayNotificationConfiguration.ts" />
|
||||
/// <reference path="marketPayNotifications.ts" />
|
||||
/// <reference path="nexo.ts" />
|
||||
/// <reference path="notification.ts" />
|
||||
/// <reference path="payments.ts" />
|
||||
/// <reference path="payouts.ts" />
|
||||
/// <reference path="recurring.ts" />
|
||||
/// <reference path="requestOptions.ts" />
|
||||
/// <reference path="terminal.ts" />
|
||||
/// <reference path="vatCategory.ts" />
|
||||
@@ -1248,8 +1248,7 @@ export interface UTMCoordinates {
|
||||
UTMNorthward: string;
|
||||
}
|
||||
|
||||
export interface XMLGregorianCalendar extends Cloneable {
|
||||
}
|
||||
export type XMLGregorianCalendar = Cloneable
|
||||
|
||||
export interface Cloneable {
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ function invalidValue(typ: any, val: any): never {
|
||||
|
||||
function jsonToJSProps(typ: any): any {
|
||||
if (typ.jsonToJS === undefined) {
|
||||
var map: any = {};
|
||||
const map: any = {};
|
||||
typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
|
||||
typ.jsonToJS = map;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ function jsonToJSProps(typ: any): any {
|
||||
|
||||
function jsToJSONProps(typ: any): any {
|
||||
if (typ.jsToJSON === undefined) {
|
||||
var map: any = {};
|
||||
const map: any = {};
|
||||
typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
|
||||
typ.jsToJSON = map;
|
||||
}
|
||||
@@ -121,9 +121,9 @@ function transform(val: any, typ: any, getProps: any): any {
|
||||
|
||||
function transformUnion(typs: any[], val: any): any {
|
||||
// val must validate against one typ in typs
|
||||
var l = typs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
var typ = typs[i];
|
||||
const l = typs.length;
|
||||
for (let i = 0; i < l; i++) {
|
||||
const typ = typs[i];
|
||||
try {
|
||||
return transform(val, typ, getProps);
|
||||
} catch (_) {}
|
||||
@@ -157,7 +157,7 @@ function transform(val: any, typ: any, getProps: any): any {
|
||||
if (val === null || typeof val !== "object" || Array.isArray(val)) {
|
||||
return invalidValue("object", val);
|
||||
}
|
||||
var result: any = {};
|
||||
const result: any = {};
|
||||
Object.getOwnPropertyNames(props).forEach(key => {
|
||||
const prop = props[key];
|
||||
const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
|
||||
|
||||
@@ -20,8 +20,13 @@
|
||||
*/
|
||||
|
||||
// Generated using typescript-generator version 2.14.505 on 2019-06-03 16:13:35.
|
||||
declare namespace IRequest {
|
||||
export type Options = HttpsRequestOptions & {
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
import * as https from "https";
|
||||
|
||||
export namespace IRequest {
|
||||
export type Options = https.RequestOptions & {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
}
|
||||
@@ -989,7 +989,7 @@ export enum ServiceProfilesType {
|
||||
}
|
||||
|
||||
export interface SaleToAcquirerData {
|
||||
applicationInfo?: ApplicationInfo
|
||||
applicationInfo?: ApplicationInfo;
|
||||
}
|
||||
|
||||
export enum TerminalEnvironmentType {
|
||||
@@ -3861,7 +3861,7 @@ function invalidValue(typ: any, val: any): never {
|
||||
|
||||
function jsonToJSProps(typ: any): any {
|
||||
if (typ.jsonToJS === undefined) {
|
||||
var map: any = {};
|
||||
const map: any = {};
|
||||
typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
|
||||
typ.jsonToJS = map;
|
||||
}
|
||||
@@ -3870,7 +3870,7 @@ function jsonToJSProps(typ: any): any {
|
||||
|
||||
function jsToJSONProps(typ: any): any {
|
||||
if (typ.jsToJSON === undefined) {
|
||||
var map: any = {};
|
||||
const map: any = {};
|
||||
typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
|
||||
typ.jsToJSON = map;
|
||||
}
|
||||
@@ -3885,9 +3885,9 @@ function transform(val: any, typ: any, getProps: any): any {
|
||||
|
||||
function transformUnion(typs: any[], val: any): any {
|
||||
// val must validate against one typ in typs
|
||||
var l = typs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
var typ = typs[i];
|
||||
const l = typs.length;
|
||||
for (let i = 0; i < l; i++) {
|
||||
const typ = typs[i];
|
||||
try {
|
||||
return transform(val, typ, getProps);
|
||||
} catch (_) {}
|
||||
@@ -3921,7 +3921,7 @@ function transform(val: any, typ: any, getProps: any): any {
|
||||
if (val === null || typeof val !== "object" || Array.isArray(val)) {
|
||||
return invalidValue("object", val);
|
||||
}
|
||||
var result: any = {};
|
||||
const result: any = {};
|
||||
Object.getOwnPropertyNames(props).forEach(key => {
|
||||
const prop = props[key];
|
||||
const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
"noUnusedLocals": true,
|
||||
"suppressImplicitAnyIndexErrors": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "**/__*__"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user