@elevatormedia/paymigo
Advanced tools
Comparing version 0.1.3 to 0.1.4
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lib_1 = require("./lib"); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const paypal = require('@paypal/checkout-server-sdk'); | ||
const checkout_server_sdk_1 = __importDefault(require("@paypal/checkout-server-sdk")); | ||
class PaymigoClient { | ||
@@ -11,9 +13,9 @@ constructor(options) { | ||
if (options.mode === 'sandbox') | ||
environment = new paypal.core.SandboxEnvironment(options.clientId, options.secretKey); | ||
environment = new checkout_server_sdk_1.default.core.SandboxEnvironment(options.clientId, options.secretKey); | ||
else if (options.mode === 'production') | ||
environment = new paypal.core.LiveEnvironment(options.clientId, options.secretKey); | ||
environment = new checkout_server_sdk_1.default.core.LiveEnvironment(options.clientId, options.secretKey); | ||
if (!environment) | ||
throw new Error('Invalid client environment configuration'); | ||
this.mode = options.mode; | ||
this._baseClient = new paypal.core.PayPalHttpClient(environment); | ||
this._baseClient = new checkout_server_sdk_1.default.core.PayPalHttpClient(environment); | ||
this.orders = new lib_1.OrdersClient(this._baseClient); | ||
@@ -20,0 +22,0 @@ this.disputes = new lib_1.DisputesClient(this._baseClient); |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ var __importDefault = (this && this.__importDefault) || function (mod) { |
@@ -1,4 +0,4 @@ | ||
import DisputeGetRequest from './DisputeGetRequest'; | ||
import DisputesGetRequest from './DisputesGetRequest'; | ||
import DisputeGetRequest from './disputes/DisputeGetRequest'; | ||
import DisputesGetRequest from './disputes/DisputesGetRequest'; | ||
export { DisputeGetRequest, DisputesGetRequest }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,6 +7,6 @@ "use strict"; | ||
exports.DisputesGetRequest = exports.DisputeGetRequest = void 0; | ||
const DisputeGetRequest_1 = __importDefault(require("./DisputeGetRequest")); | ||
const DisputeGetRequest_1 = __importDefault(require("./disputes/DisputeGetRequest")); | ||
exports.DisputeGetRequest = DisputeGetRequest_1.default; | ||
const DisputesGetRequest_1 = __importDefault(require("./DisputesGetRequest")); | ||
const DisputesGetRequest_1 = __importDefault(require("./disputes/DisputesGetRequest")); | ||
exports.DisputesGetRequest = DisputesGetRequest_1.default; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { LegacyPayPalClient, DisputeState } from 'types/paypal'; | ||
import { DisputeState } from 'types/paypal'; | ||
export declare type DisputesListOptions = { | ||
@@ -8,3 +8,3 @@ startTime: Date; | ||
private _client; | ||
constructor(client: LegacyPayPalClient); | ||
constructor(client: PayPalHttpClient); | ||
/** | ||
@@ -11,0 +11,0 @@ * Retrieve dispute instance by its ID |
@@ -15,3 +15,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -21,3 +21,3 @@ var __importStar = (this && this.__importStar) || function (mod) { | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -27,2 +27,3 @@ return result; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.util = void 0; | ||
__exportStar(require("./disputes"), exports); | ||
@@ -29,0 +30,0 @@ __exportStar(require("./orders"), exports); |
@@ -1,5 +0,4 @@ | ||
import { LegacyPayPalClient } from 'types/paypal'; | ||
export declare class OrdersClient { | ||
private _client; | ||
constructor(client: LegacyPayPalClient); | ||
constructor(client: PayPalHttpClient); | ||
create(input: any): Promise<any>; | ||
@@ -6,0 +5,0 @@ /** |
@@ -11,6 +11,8 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.OrdersClient = void 0; | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const paypal = require('@paypal/checkout-server-sdk'); | ||
const checkout_server_sdk_1 = __importDefault(require("@paypal/checkout-server-sdk")); | ||
class OrdersClient { | ||
@@ -23,3 +25,3 @@ constructor(client) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const request = new paypal.orders.OrdersCreateRequest(); | ||
const request = new checkout_server_sdk_1.default.orders.OrdersCreateRequest(); | ||
request.requestBody(input); | ||
@@ -43,3 +45,3 @@ try { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const request = new paypal.orders.OrdersCaptureRequest(orderId); | ||
const request = new checkout_server_sdk_1.default.orders.OrdersCaptureRequest(orderId); | ||
request.requestBody({}); | ||
@@ -80,3 +82,3 @@ try { | ||
const invalidIdError = new Error('Invalid order ID provided'); | ||
const request = new paypal.orders.OrdersGetRequest(orderId); | ||
const request = new checkout_server_sdk_1.default.orders.OrdersGetRequest(orderId); | ||
let order; | ||
@@ -83,0 +85,0 @@ try { |
@@ -13,3 +13,3 @@ "use strict"; | ||
}); | ||
exports.dateToParamString = (input) => { | ||
const dateToParamString = (input) => { | ||
const { month, day, year, hour, minute, second } = formatter | ||
@@ -24,2 +24,3 @@ .formatToParts(input) | ||
}; | ||
exports.dateToParamString = dateToParamString; | ||
//# sourceMappingURL=util.js.map |
@@ -1,7 +0,2 @@ | ||
import PayPalRequest from '../legacy/PayPalRequest'; | ||
export declare type RequestVerb = 'GET' | 'POST'; | ||
export declare class LegacyPayPalClient { | ||
constructor(environment: any); | ||
execute<T = any>(request: PayPalRequest): Promise<T>; | ||
} | ||
export declare type RequestOptions = { | ||
@@ -8,0 +3,0 @@ path: string; |
{ | ||
"name": "@elevatormedia/paymigo", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "TypeScript wrapper and extension of PayPal Node.js SDK and REST APIs", | ||
@@ -13,3 +13,5 @@ "main": "dist/index.js", | ||
"prepare": "npm run build", | ||
"docs": "echo 'hi'" | ||
"types:legacy": "tsc node_modules/@paypal/checkout-server-sdk/lib/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir legacyTypes", | ||
"docs": "typedoc --out ./docs --plugin typedoc-plugin-markdown src/ && git add docs/ && git commit -m 'update docs'", | ||
"version-bump": "bump --commit --tag --push" | ||
}, | ||
@@ -42,3 +44,3 @@ "private": false, | ||
"typedoc-plugin-markdown": "^2.4.2", | ||
"typescript": "^3.5.3" | ||
"typescript": "^4.4.4" | ||
}, | ||
@@ -45,0 +47,0 @@ "husky": { |
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
42701
74
611