paypal-rest
Advanced tools
Comparing version 1.0.0-ALPHA to 1.1.0-ALPHA
@@ -10,3 +10,7 @@ import auth from './Functions/Auth'; | ||
import { createProduct, getProductDetails, getProducts, updateProductDetails } from "./Functions/Products"; | ||
export { config, auth, PurchaseUnitBuilder, UnitBuilder, ItemsBuilder, ProductBuilder, CurrencyCodes }; | ||
import BillingCycleBuilder from './Builders/BillingCycleBuilder'; | ||
import PaymentPreferencesBuilder from './Builders/PaymentPreferencesBuilder'; | ||
import { createSubscriptionPlan, getSubscriptionPlan, listSubscriptionPlan } from "./Functions/Subscriptions"; | ||
import SubscriptionPlanBuilder from './Builders/SubscriptionPlanBuilder'; | ||
export { config, auth, PurchaseUnitBuilder, UnitBuilder, ItemsBuilder, ProductBuilder, CurrencyCodes, SubscriptionPlanBuilder, BillingCycleBuilder, PaymentPreferencesBuilder }; | ||
export declare const order: { | ||
@@ -22,2 +26,7 @@ create: typeof createOrder; | ||
}; | ||
export declare const plan: { | ||
create: typeof createSubscriptionPlan; | ||
list: typeof listSubscriptionPlan; | ||
get: typeof getSubscriptionPlan; | ||
}; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.product = exports.order = exports.CurrencyCodes = exports.ProductBuilder = exports.ItemsBuilder = exports.UnitBuilder = exports.PurchaseUnitBuilder = exports.auth = exports.config = void 0; | ||
exports.plan = exports.product = exports.order = exports.PaymentPreferencesBuilder = exports.BillingCycleBuilder = exports.SubscriptionPlanBuilder = exports.CurrencyCodes = exports.ProductBuilder = exports.ItemsBuilder = exports.UnitBuilder = exports.PurchaseUnitBuilder = exports.auth = exports.config = void 0; | ||
const Auth_1 = require("./Functions/Auth"); | ||
@@ -20,2 +20,9 @@ exports.auth = Auth_1.default; | ||
const Products_1 = require("./Functions/Products"); | ||
const BillingCycleBuilder_1 = require("./Builders/BillingCycleBuilder"); | ||
exports.BillingCycleBuilder = BillingCycleBuilder_1.default; | ||
const PaymentPreferencesBuilder_1 = require("./Builders/PaymentPreferencesBuilder"); | ||
exports.PaymentPreferencesBuilder = PaymentPreferencesBuilder_1.default; | ||
const Subscriptions_1 = require("./Functions/Subscriptions"); | ||
const SubscriptionPlanBuilder_1 = require("./Builders/SubscriptionPlanBuilder"); | ||
exports.SubscriptionPlanBuilder = SubscriptionPlanBuilder_1.default; | ||
exports.order = { | ||
@@ -31,1 +38,6 @@ create: Order_1.order, | ||
}; | ||
exports.plan = { | ||
create: Subscriptions_1.createSubscriptionPlan, | ||
list: Subscriptions_1.listSubscriptionPlan, | ||
get: Subscriptions_1.getSubscriptionPlan | ||
}; |
@@ -35,2 +35,12 @@ "use strict"; | ||
data.headers.set('Authorization', 'Bearer ' + access_token); | ||
if (data.query) { | ||
let query = '?'; | ||
for (const key in data.query) { | ||
if (typeof data.query[key] === 'undefined') | ||
continue; | ||
url += query + key + '=' + encodeURIComponent(data.query[key]); | ||
query = '&'; | ||
} | ||
delete data.query; | ||
} | ||
try { | ||
@@ -37,0 +47,0 @@ const response = yield fetch(base_url + url, data); |
import { HTTP_METHOD } from "./index"; | ||
export interface RequestManagerProps { | ||
export interface RequestManager { | ||
method: HTTP_METHOD; | ||
@@ -7,2 +7,8 @@ headers?: HeadersInit; | ||
} | ||
export interface QueryParams { | ||
[key: string]: string | number | boolean | undefined; | ||
} | ||
export type RequestManagerProps = RequestManager & { | ||
query?: QueryParams; | ||
}; | ||
//# sourceMappingURL=RequestManagerTypes.d.ts.map |
{ | ||
"name": "paypal-rest", | ||
"version": "1.0.0-ALPHA", | ||
"version": "1.1.0-ALPHA", | ||
"description": "SDK for REST PayPal API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -10,2 +10,6 @@ import auth from './Functions/Auth'; | ||
import { createProduct, getProductDetails, getProducts, updateProductDetails } from "./Functions/Products"; | ||
import BillingCycleBuilder from './Builders/BillingCycleBuilder'; | ||
import PaymentPreferencesBuilder from './Builders/PaymentPreferencesBuilder'; | ||
import { createSubscriptionPlan, getSubscriptionPlan, listSubscriptionPlan } from "./Functions/Subscriptions"; | ||
import SubscriptionPlanBuilder from './Builders/SubscriptionPlanBuilder'; | ||
@@ -18,3 +22,4 @@ | ||
ItemsBuilder, ProductBuilder, | ||
CurrencyCodes | ||
CurrencyCodes, SubscriptionPlanBuilder, | ||
BillingCycleBuilder, PaymentPreferencesBuilder | ||
}; | ||
@@ -32,2 +37,8 @@ | ||
update: updateProductDetails | ||
}; | ||
}; | ||
export const plan = { | ||
create: createSubscriptionPlan, | ||
list: listSubscriptionPlan, | ||
get: getSubscriptionPlan | ||
} |
@@ -29,2 +29,15 @@ import { RequestManagerProps } from "../types/RequestManagerTypes"; | ||
if (data.query) { | ||
let query = '?'; | ||
for (const key in data.query) { | ||
if (typeof data.query[key] === 'undefined') | ||
continue; | ||
url += query + key + '=' + encodeURIComponent(data.query[key] as string | number | boolean); | ||
query = '&'; | ||
} | ||
delete data.query; | ||
} | ||
try { | ||
@@ -31,0 +44,0 @@ const response = await fetch(base_url + url, data); |
import { HTTP_METHOD } from "./index"; | ||
export interface RequestManagerProps { | ||
export interface RequestManager { | ||
method: HTTP_METHOD; | ||
headers?: HeadersInit; | ||
body?: string; | ||
} | ||
} | ||
export interface QueryParams { | ||
[key: string]: string | number | boolean | undefined; | ||
} | ||
export type RequestManagerProps = RequestManager & { query?: QueryParams }; |
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
234362
124
3987