Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"rules": {
"semi": [2, "always"],
"space-before-function-paren": [2, "always"],
"keyword-spacing": [2, {"before": true, "after": true}],
"keyword-spacing": [2, { "before": true, "after": true }],
"space-before-blocks": [2, "always"],
"comma-dangle": [2, "always-multiline"],
"comma-dangle": [2, "always-multiline"]
},
"parser": "babel-eslint"
}
"parser": "babel-eslint",
"ignorePatterns": "*.d.ts"
}
32 changes: 32 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export default class Paymongo {
constructor(secret: any);
secret: any;
paymentMethods: {
create: (data: any) => Promise<any>;
retrieve: (id: any) => Promise<any>;
};
paymentIntents: {
create: (data: any) => Promise<any>;
retrieve: (id: any) => Promise<any>;
attach: (id: any, data: any) => Promise<any>;
};
sources: {
create: (data: any) => Promise<any>;
retrieve: (id: any) => Promise<any>;
};
payments: {
create: (data: any) => Promise<any>;
retrieve: (id: any) => Promise<any>;
list: () => Promise<any>;
};
tokens: {
create: (data: any) => Promise<any>;
retrieve: (id: any) => Promise<any>;
};
webhooks: {
create: (data: any) => Promise<any>;
retrieve: (id: any) => Promise<any>;
list: () => Promise<any>;
toggle: (id: any, action: any) => Promise<any>;
};
}
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/payment-intents/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./payment-intents";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single quote ' instead of double quotes ". Thanks.

13 changes: 13 additions & 0 deletions dist/payment-intents/payment-intents.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function createPaymentIntent(secret: string, data: {
attributes: {
amount: number;
payment_method_allowed: string[];
currency: string;
};
}): Promise<any>;
export function retrievePaymentIntent(secret: string, id: string): Promise<any>;
export function attachToPaymentIntent(secret: string, id: string, data: {
attributes: {
payment_method: string;
};
}): Promise<any>;
1 change: 1 addition & 0 deletions dist/payment-methods/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./payment-methods";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single quote ' instead of double quotes ". Thanks.

6 changes: 6 additions & 0 deletions dist/payment-methods/payment-methods.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function createPaymentMethod(secret: string, data: {
attributes: {
type: string;
};
}): Promise<any>;
export function retrievePaymentMethod(secret: string, id: string): Promise<any>;
1 change: 1 addition & 0 deletions dist/payment-methods/payment-methods.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/payments/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./payments";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single quote ' instead of double quotes ". Thanks.

12 changes: 12 additions & 0 deletions dist/payments/payments.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function createPayment(secret: string, data: {
attributes: {
amount: number;
currency: number;
source: {
id: string;
type: string;
};
};
}): Promise<any>;
export function retrievePayment(secret: string, id: string): Promise<any>;
export function listPayments(secret: string): Promise<any>;
1 change: 1 addition & 0 deletions dist/payments/payments.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/sources/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./sources";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single quote ' instead of double quotes ". Thanks.

12 changes: 12 additions & 0 deletions dist/sources/sources.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function createSource(secret: string, data: {
attributes: {
type: string;
amount: number;
currency: string;
redirect: {
success: string;
failed: string;
};
};
}): Promise<any>;
export function retrieveSource(secret: string, id: string): Promise<any>;
1 change: 1 addition & 0 deletions dist/sources/sources.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/tokens/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./tokens";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single quote ' instead of double quotes ". Thanks.

9 changes: 9 additions & 0 deletions dist/tokens/tokens.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function createToken(secret: string, data: {
attributes: {
number: string;
exp_month: number;
exp_year: number;
cvc: string;
};
}): Promise<any>;
export function retrieveToken(secret: string, id: string): Promise<any>;
1 change: 1 addition & 0 deletions dist/tokens/tokens.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/utils/rest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function makeRequest(opts: any): Promise<any>;
1 change: 1 addition & 0 deletions dist/webhooks/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./webhooks";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single quote ' instead of double quotes ". Thanks.

9 changes: 9 additions & 0 deletions dist/webhooks/webhooks.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function createWebhook(secret: string, data: {
attributes: {
url: string;
events: string[];
};
}): Promise<any>;
export function retrieveWebhook(secret: string, id: string): Promise<any>;
export function listWebhooks(secret: string): Promise<any>;
export function toggleWebhook(secret: string, id: string, action: string): Promise<any>;
1 change: 1 addition & 0 deletions dist/webhooks/webhooks.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"test": "jest",
"lint": "npx eslint src --fix -c .eslintrc",
"prebuild": "rimraf dist && npm run test",
"build": "rollup -c",
"build:only": "rollup -c",
"build": "rollup -c && tsc",
"build:only": "rollup -c && tsc",
"try": "node tester.js"
},
"repository": {
Expand Down Expand Up @@ -40,7 +40,8 @@
"rimraf": "^3.0.2",
"rollup": "^1.32.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-uglify": "^6.0.4"
"rollup-plugin-uglify": "^6.0.4",
"typescript": "^4.3.5"
},
"dependencies": {
"bent": "^7.3.1"
Expand Down
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"include": ["src/**/*"],
"compilerOptions": {
// Tells TypeScript to read JS files, as
// normally they are ignored as source files
"allowJs": true,
// Generate d.ts files
"declaration": true,
// This compiler run should
// only output d.ts files
"emitDeclarationOnly": true,
// Types should go into this directory.
// Removing this would place the .d.ts files
// next to the .js files
"outDir": "dist"
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5134,6 +5134,11 @@ type-fest@^0.8.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==

typescript@^4.3.5:
version "4.3.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==

uglify-js@^3.4.9:
version "3.9.3"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.9.3.tgz#4a285d1658b8a2ebaef9e51366b3a0f7acd79ec2"
Expand Down