paypal-v2-sdk
Advanced tools
Comparing version 2.3.5 to 2.3.6
@@ -5,3 +5,3 @@ import AddTrackersResponse from "./../Types/APIResponses/AddTrackers.js"; | ||
import { LinkDescription } from "../Types/Objects/LinkDescription.js"; | ||
declare class AddTracking { | ||
export declare class AddTracking { | ||
protected PayPal: PayPal; | ||
@@ -25,2 +25,1 @@ constructor(PayPal: PayPal); | ||
} | ||
export default AddTracking; |
@@ -7,3 +7,3 @@ import AddTrackersResponse from "./../Types/APIResponses/AddTrackers.js"; | ||
import TrackerUpdateOrCancelError from "../Errors/AddTracking/TrackerUpdateOrCancelError.js"; | ||
class AddTracking { | ||
export class AddTracking { | ||
constructor(PayPal) { | ||
@@ -16,3 +16,3 @@ this.PayPal = PayPal; | ||
tracker(trackerInstance); | ||
const response = await this.PayPal.API.put(`/v1/shipping/trackers/${transactionIdTrackingNumber}`, trackerInstance.toJson()); | ||
const response = await this.PayPal.getAPI().put(`/v1/shipping/trackers/${transactionIdTrackingNumber}`, trackerInstance.toJson()); | ||
const SUCCESS_RESPONSE = 204; | ||
@@ -39,3 +39,3 @@ if (response.status !== SUCCESS_RESPONSE) { | ||
throw new Error("Transaction ID or Tracking Number is required"); | ||
const response = await this.PayPal.API.get(`/v1/shipping/trackers/${transactionIdTrackingNumber}`); | ||
const response = await this.PayPal.getAPI().get(`/v1/shipping/trackers/${transactionIdTrackingNumber}`); | ||
return Tracker.fromObject(response.data); | ||
@@ -58,3 +58,3 @@ } | ||
}); | ||
const response = await this.PayPal.API.post("/v1/shipping/trackers", { | ||
const response = await this.PayPal.getAPI().post("/v1/shipping/trackers", { | ||
trackers: trackerInstances.map((tracker) => tracker.toAttributeObject()), | ||
@@ -66,2 +66,1 @@ links: linkInstances.map((link) => link.toAttributeObject()), | ||
} | ||
export default AddTracking; |
import { AxiosInstance, AxiosRequestConfig } from "axios"; | ||
declare class API { | ||
Axios: AxiosInstance; | ||
export declare class API { | ||
private Axios; | ||
constructor(); | ||
getAxios(): AxiosInstance; | ||
setDefaultBaseUrl(baseUrl: string): this; | ||
@@ -14,2 +15,1 @@ setDefaultAuthorizationHeader(token: string): this; | ||
} | ||
export default API; |
import Axios from "axios"; | ||
class API { | ||
export class API { | ||
constructor() { | ||
this.Axios = Axios.create(); | ||
} | ||
getAxios() { | ||
return this.Axios; | ||
} | ||
setDefaultBaseUrl(baseUrl) { | ||
@@ -34,2 +37,1 @@ this.Axios.defaults.baseURL = baseUrl; | ||
} | ||
export default API; |
import PayPal from "../PayPal.js"; | ||
import { Integer } from "../Types/Utility.js"; | ||
declare class Authentication { | ||
export declare class Authentication { | ||
protected PayPal: PayPal; | ||
scope?: string; | ||
token?: string; | ||
tokenType?: string; | ||
appId?: string; | ||
expiry?: number; | ||
nonce?: string; | ||
private scope?; | ||
private token?; | ||
private tokenType?; | ||
private appId?; | ||
private expiry?; | ||
private nonce?; | ||
constructor(PayPal: PayPal); | ||
@@ -15,8 +15,13 @@ requestNewToken(clientId: string, clientSecret: string, sandbox: boolean): Promise<void>; | ||
setScope(scope: string): this; | ||
getScope(): string | undefined; | ||
setAccessToken(token: string): this; | ||
getAccessToken(): string | undefined; | ||
setTokenType(tokenType: string): this; | ||
getTokenType(): string | undefined; | ||
setAppId(appId: string): this; | ||
getAppId(): string | undefined; | ||
setExpiry<N extends number>(expiry: Integer<N>): this; | ||
getExpiry(): number | undefined; | ||
setNonce(nonce: string): this; | ||
getNonce(): string | undefined; | ||
} | ||
export default Authentication; |
@@ -1,2 +0,2 @@ | ||
class Authentication { | ||
export class Authentication { | ||
constructor(PayPal) { | ||
@@ -6,3 +6,3 @@ this.PayPal = PayPal; | ||
async requestNewToken(clientId, clientSecret, sandbox) { | ||
const response = await this.PayPal.API.post(`https://${sandbox ? "api-m.sandbox" : "api-m"}.paypal.com/v1/oauth2/token`, "grant_type=client_credentials", { | ||
const response = await this.PayPal.getAPI().post(`https://${sandbox ? "api-m.sandbox" : "api-m"}.paypal.com/v1/oauth2/token`, "grant_type=client_credentials", { | ||
headers: { "Content-Type": "application/x-www-form-urlencoded" }, | ||
@@ -35,3 +35,4 @@ auth: { | ||
throw new Error("Token not set! Please retry configuration and authentication!"); | ||
this.PayPal.API.setDefaultAuthorizationHeader(this.token) | ||
this.PayPal.getAPI() | ||
.setDefaultAuthorizationHeader(this.token) | ||
.setDefaultBaseUrl(sandbox ? "https://api-m.sandbox.paypal.com" : "https://api-m.paypal.com") | ||
@@ -45,2 +46,5 @@ .setDefaultHeaders(); | ||
} | ||
getScope() { | ||
return this.scope; | ||
} | ||
setAccessToken(token) { | ||
@@ -50,2 +54,5 @@ this.token = token; | ||
} | ||
getAccessToken() { | ||
return this.token; | ||
} | ||
setTokenType(tokenType) { | ||
@@ -55,2 +62,5 @@ this.tokenType = tokenType; | ||
} | ||
getTokenType() { | ||
return this.tokenType; | ||
} | ||
setAppId(appId) { | ||
@@ -60,2 +70,5 @@ this.appId = appId; | ||
} | ||
getAppId() { | ||
return this.appId; | ||
} | ||
setExpiry(expiry) { | ||
@@ -65,2 +78,5 @@ this.expiry = expiry; | ||
} | ||
getExpiry() { | ||
return this.expiry; | ||
} | ||
setNonce(nonce) { | ||
@@ -70,3 +86,5 @@ this.nonce = nonce; | ||
} | ||
getNonce() { | ||
return this.nonce; | ||
} | ||
} | ||
export default Authentication; |
@@ -8,3 +8,3 @@ import PayPal from "../PayPal"; | ||
import { Integer } from "../Types/Utility"; | ||
declare class Disputes { | ||
export declare class Disputes { | ||
protected PayPal: PayPal; | ||
@@ -24,2 +24,1 @@ constructor(PayPal: PayPal); | ||
} | ||
export default Disputes; |
@@ -6,7 +6,7 @@ import ListDisputesResponse from "../Types/APIResponses/ListDisputes"; | ||
import { Patch } from "../Types/Objects/Patch"; | ||
class Disputes { | ||
export class Disputes { | ||
constructor(PayPal) { | ||
this.PayPal = PayPal; | ||
} | ||
listDisputes(disputeState, disputedTransactionId, nextPageToken, pageSize, startTime, updateTimeAfter, updateTimeBefore) { | ||
async listDisputes(disputeState, disputedTransactionId, nextPageToken, pageSize, startTime, updateTimeAfter, updateTimeBefore) { | ||
return this.getMany(typeof disputeState === "function" ? disputeState(DisputeState) : disputeState, disputedTransactionId, nextPageToken, pageSize, startTime, updateTimeAfter, updateTimeBefore); | ||
@@ -31,3 +31,3 @@ } | ||
} | ||
const response = await this.PayPal.API.get("/v1/customer/disputes", { | ||
const response = await this.PayPal.getAPI().get("/v1/customer/disputes", { | ||
params: { | ||
@@ -50,3 +50,3 @@ ...(disputeState !== undefined | ||
async partialUpdate(disputeId, patchRequest) { | ||
const response = await this.PayPal.API.patch(`/v1/customer/disputes/${disputeId}`, { | ||
const response = await this.PayPal.getAPI().patch(`/v1/customer/disputes/${disputeId}`, { | ||
data: patchRequest.map((x) => { | ||
@@ -63,6 +63,5 @@ if (x instanceof Patch) | ||
async get(disputeId) { | ||
const response = await this.PayPal.API.get(`/v1/customer/disputes/${disputeId}`); | ||
const response = await this.PayPal.getAPI().get(`/v1/customer/disputes/${disputeId}`); | ||
return Dispute.fromObject(response.data); | ||
} | ||
} | ||
export default Disputes; |
@@ -17,3 +17,3 @@ import PayPal from "../PayPal.js"; | ||
import { Integer } from "../Types/Utility.js"; | ||
declare class Invoicing { | ||
export declare class Invoicing { | ||
protected PayPal: PayPal; | ||
@@ -109,2 +109,2 @@ constructor(PayPal: PayPal); | ||
}; | ||
export default Invoicing; | ||
export {}; |
@@ -14,3 +14,3 @@ import GenerateInvoiceNumberResponse from "../Types/APIResponses/GenerateInvoiceNumber.js"; | ||
import { Template } from "../Types/Objects/Template.js"; | ||
class Invoicing { | ||
export class Invoicing { | ||
constructor(PayPal) { | ||
@@ -20,3 +20,3 @@ this.PayPal = PayPal; | ||
async generateInvoiceNumber() { | ||
const response = await this.PayPal.API.post("/v2/invoicing/generate-next-invoice-number"); | ||
const response = await this.PayPal.getAPI().post("/v2/invoicing/generate-next-invoice-number"); | ||
const invoiceNumber = response.data.invoice_number; | ||
@@ -53,3 +53,3 @@ return new GenerateInvoiceNumberResponse(invoiceNumber); | ||
} | ||
const response = await this.PayPal.API.get("/v2/invoicing/invoices", { | ||
const response = await this.PayPal.getAPI().get("/v2/invoicing/invoices", { | ||
params: { | ||
@@ -69,3 +69,3 @@ fields, | ||
} | ||
const response = await this.PayPal.API.post("/v2/invoicing/invoices", invoiceInstance.toAttributeObject()); | ||
const response = await this.PayPal.getAPI().post("/v2/invoicing/invoices", invoiceInstance.toAttributeObject()); | ||
return Invoice.fromObject(response.data).setPayPal(this.PayPal); | ||
@@ -82,3 +82,3 @@ } | ||
} | ||
const response = await this.PayPal.API.delete(`/v2/invoicing/invoices/${invoiceId}`); | ||
const response = await this.PayPal.getAPI().delete(`/v2/invoicing/invoices/${invoiceId}`); | ||
const SUCCESS_RESPONSE = 204; | ||
@@ -92,3 +92,3 @@ return response.status === SUCCESS_RESPONSE; | ||
} | ||
const response = await this.PayPal.API.put(`/v2/invoicing/invoices/${invoiceInstance.getId() ?? invoiceId}`, invoiceInstance.toAttributeObject()); | ||
const response = await this.PayPal.getAPI().put(`/v2/invoicing/invoices/${invoiceInstance.getId() ?? invoiceId}`, invoiceInstance.toAttributeObject()); | ||
return Invoice.fromObject(response.data).setPayPal(this.PayPal); | ||
@@ -105,3 +105,3 @@ } | ||
} | ||
const response = await this.PayPal.API.get(`/v2/invoicing/invoices/${invoiceId}`); | ||
const response = await this.PayPal.getAPI().get(`/v2/invoicing/invoices/${invoiceId}`); | ||
return Invoice.fromObject(response.data).setPayPal(this.PayPal); | ||
@@ -118,3 +118,3 @@ } | ||
} | ||
const response = await this.PayPal.API.post(`/v2/invoicing/invoices/${invoiceId}/cancel`, { | ||
const response = await this.PayPal.getAPI().post(`/v2/invoicing/invoices/${invoiceId}/cancel`, { | ||
additional_recipients: additionalRecipients?.map((x) => { | ||
@@ -144,3 +144,3 @@ const additionalRecipient = x instanceof EmailAddress ? x : new EmailAddress(); | ||
} | ||
const response = await this.PayPal.API.get(`/v2/invoicing/invoices/${invoiceId}/generate-qr-code`, { | ||
const response = await this.PayPal.getAPI().get(`/v2/invoicing/invoices/${invoiceId}/generate-qr-code`, { | ||
params: { | ||
@@ -173,3 +173,3 @@ ...(action | ||
} | ||
const response = await this.PayPal.API.post(`/v2/invoicing/invoices/${invoiceId}/payments`, paymentDetailInstance.toAttributeObject()); | ||
const response = await this.PayPal.getAPI().post(`/v2/invoicing/invoices/${invoiceId}/payments`, paymentDetailInstance.toAttributeObject()); | ||
const SUCCESS_RESPONSE = 200; | ||
@@ -187,3 +187,3 @@ return response.status === SUCCESS_RESPONSE ? this.get(invoiceId) : response.statusText; | ||
} | ||
const response = await this.PayPal.API.delete(`/v2/invoicing/invoices/${invoiceId}/payments/${transactionId}`); | ||
const response = await this.PayPal.getAPI().delete(`/v2/invoicing/invoices/${invoiceId}/payments/${transactionId}`); | ||
const SUCCESS_RESPONSE = 204; | ||
@@ -205,3 +205,3 @@ return response.status === SUCCESS_RESPONSE; | ||
} | ||
const response = await this.PayPal.API.post(`/v2/invoicing/invoices/${invoiceId}/refunds`, refundDetailInstance.toAttributeObject()); | ||
const response = await this.PayPal.getAPI().post(`/v2/invoicing/invoices/${invoiceId}/refunds`, refundDetailInstance.toAttributeObject()); | ||
const SUCCESS_RESPONSE = 200; | ||
@@ -219,3 +219,3 @@ return response.status === SUCCESS_RESPONSE ? this.get(invoiceId) : response.statusText; | ||
} | ||
const response = await this.PayPal.API.delete(`/v2/invoicing/invoices/${invoiceId}/refunds/${transactionId}`); | ||
const response = await this.PayPal.getAPI().delete(`/v2/invoicing/invoices/${invoiceId}/refunds/${transactionId}`); | ||
const SUCCESS_RESPONSE = 204; | ||
@@ -233,3 +233,3 @@ return response.status === SUCCESS_RESPONSE; | ||
} | ||
const response = await this.PayPal.API.post(`/v2/invoicing/invoices/${invoiceId}/remind`, { | ||
const response = await this.PayPal.getAPI().post(`/v2/invoicing/invoices/${invoiceId}/remind`, { | ||
additional_recipients: additionalRecipients?.map((x) => { | ||
@@ -259,3 +259,3 @@ const additionalRecipient = x instanceof EmailAddress ? x : new EmailAddress(); | ||
} | ||
const response = await this.PayPal.API.post(`/v2/invoicing/invoices/${invoiceId}/send`, { | ||
const response = await this.PayPal.getAPI().post(`/v2/invoicing/invoices/${invoiceId}/send`, { | ||
additional_recipients: additionalRecipients?.map((x) => { | ||
@@ -277,3 +277,3 @@ const additionalRecipient = x instanceof EmailAddress ? x : new EmailAddress(); | ||
async search(page, pageSize, totalRequired, data) { | ||
const response = await this.PayPal.API.post(`/v2/invoicing/search-invoices`, data ?? {}, { | ||
const response = await this.PayPal.getAPI().post(`/v2/invoicing/search-invoices`, data ?? {}, { | ||
params: { | ||
@@ -288,3 +288,3 @@ page, | ||
async listTemplates(fields, page, pageSize) { | ||
const response = await this.PayPal.API.get(`/v2/invoicing/templates`, { | ||
const response = await this.PayPal.getAPI().get(`/v2/invoicing/templates`, { | ||
params: { | ||
@@ -303,3 +303,3 @@ fields, | ||
} | ||
const response = await this.PayPal.API.post(`/v2/invoicing/templates`, templateInstance.toAttributeObject()); | ||
const response = await this.PayPal.getAPI().post(`/v2/invoicing/templates`, templateInstance.toAttributeObject()); | ||
return Template.fromObject(response.data).setPayPal(this.PayPal); | ||
@@ -316,3 +316,3 @@ } | ||
} | ||
const response = await this.PayPal.API.delete(`/v2/invoicing/templates/${templateId}`); | ||
const response = await this.PayPal.getAPI().delete(`/v2/invoicing/templates/${templateId}`); | ||
const SUCCESS_RESPONSE = 204; | ||
@@ -326,3 +326,3 @@ return response.status === SUCCESS_RESPONSE; | ||
} | ||
const response = await this.PayPal.API.put(`/v2/invoicing/templates/${templateInstance.getId()}`, templateInstance.toAttributeObject()); | ||
const response = await this.PayPal.getAPI().put(`/v2/invoicing/templates/${templateInstance.getId()}`, templateInstance.toAttributeObject()); | ||
return Template.fromObject(response.data).setPayPal(this.PayPal); | ||
@@ -339,6 +339,5 @@ } | ||
} | ||
const response = await this.PayPal.API.get(`/v2/invoicing/templates/${templateId}`); | ||
const response = await this.PayPal.getAPI().get(`/v2/invoicing/templates/${templateId}`); | ||
return Template.fromObject(response.data).setPayPal(this.PayPal); | ||
} | ||
} | ||
export default Invoicing; |
@@ -6,3 +6,3 @@ import ListProductsResponse from "./../Types/APIResponses/ListProducts.js"; | ||
import { Integer } from "../Types/Utility.js"; | ||
declare class Products { | ||
export declare class Products { | ||
protected PayPal: PayPal; | ||
@@ -28,2 +28,1 @@ constructor(PayPal: PayPal); | ||
} | ||
export default Products; |
@@ -7,3 +7,3 @@ import ListProductsResponse from "./../Types/APIResponses/ListProducts.js"; | ||
import ProductUpdateError from "../Errors/Products/ProductUpdateError.js"; | ||
class Products { | ||
export class Products { | ||
constructor(PayPal) { | ||
@@ -20,3 +20,3 @@ this.PayPal = PayPal; | ||
async getMany(page, pageSize, totalRequired) { | ||
const response = await this.PayPal.API.get("/v1/catalogs/products", { | ||
const response = await this.PayPal.getAPI().get("/v1/catalogs/products", { | ||
params: { | ||
@@ -37,3 +37,3 @@ page, | ||
product(productInstance); | ||
const response = await this.PayPal.API.post("/v1/catalogs/products", productInstance.toAttributeObject(), { | ||
const response = await this.PayPal.getAPI().post("/v1/catalogs/products", productInstance.toAttributeObject(), { | ||
headers: { | ||
@@ -57,3 +57,3 @@ "Content-Type": "application/json", | ||
patchRequest(patchRequestInstance); | ||
const response = await this.PayPal.API.patch(`/v1/catalogs/products/${productId}`, patchRequestInstance.toAttributeObject(), { | ||
const response = await this.PayPal.getAPI().patch(`/v1/catalogs/products/${productId}`, patchRequestInstance.toAttributeObject(), { | ||
headers: { | ||
@@ -75,6 +75,5 @@ "Content-Type": "application/json", | ||
throw new Error("Product ID is required to get product"); | ||
const response = await this.PayPal.API.get(`/v1/catalogs/products/${productId}`); | ||
const response = await this.PayPal.getAPI().get(`/v1/catalogs/products/${productId}`); | ||
return Product.fromObject(response.data); | ||
} | ||
} | ||
export default Products; |
/// <reference types="node" /> | ||
import API from "./API/API.js"; | ||
import { API } from "./API/API.js"; | ||
import EventEmitter from "events"; | ||
import Invoicing from "./API/Invoicing.js"; | ||
import Authentication from "./API/Authentication.js"; | ||
import AddTracking from "./API/AddTracking.js"; | ||
import Products from "./API/Products.js"; | ||
import Disputes from "./API/Disputes.js"; | ||
import { Invoicing } from "./API/Invoicing.js"; | ||
import { Authentication } from "./API/Authentication.js"; | ||
import { AddTracking } from "./API/AddTracking.js"; | ||
import { Products } from "./API/Products.js"; | ||
import { Disputes } from "./API/Disputes.js"; | ||
declare abstract class BasePayPal extends EventEmitter { | ||
clientId: string | null; | ||
clientSecret: string | null; | ||
sandbox: boolean; | ||
API: API; | ||
Invoicing: Invoicing; | ||
Auth: Authentication; | ||
AddTracking: AddTracking; | ||
Products: Products; | ||
Disputes: Disputes; | ||
private clientId; | ||
private clientSecret; | ||
private sandbox; | ||
private API; | ||
private Invoicing; | ||
private Auth; | ||
private AddTracking; | ||
private Products; | ||
private Disputes; | ||
constructor(); | ||
configure(id: string, secret: string, sandbox?: boolean): void; | ||
getClientId(): string | null; | ||
getClientSecret(): string | null; | ||
isSandbox(): boolean; | ||
getAPI(): API; | ||
getInvoicing(): Invoicing; | ||
getAuth(): Authentication; | ||
getAddTracking(): AddTracking; | ||
getProducts(): Products; | ||
getDisputes(): Disputes; | ||
abstract authenticate(): Promise<void>; | ||
} | ||
export default BasePayPal; |
@@ -1,8 +0,8 @@ | ||
import API from "./API/API.js"; | ||
import { API } from "./API/API.js"; | ||
import EventEmitter from "events"; | ||
import Invoicing from "./API/Invoicing.js"; | ||
import Authentication from "./API/Authentication.js"; | ||
import AddTracking from "./API/AddTracking.js"; | ||
import Products from "./API/Products.js"; | ||
import Disputes from "./API/Disputes.js"; | ||
import { Invoicing } from "./API/Invoicing.js"; | ||
import { Authentication } from "./API/Authentication.js"; | ||
import { AddTracking } from "./API/AddTracking.js"; | ||
import { Products } from "./API/Products.js"; | ||
import { Disputes } from "./API/Disputes.js"; | ||
class BasePayPal extends EventEmitter { | ||
@@ -29,3 +29,30 @@ constructor() { | ||
} | ||
getClientId() { | ||
return this.clientId; | ||
} | ||
getClientSecret() { | ||
return this.clientSecret; | ||
} | ||
isSandbox() { | ||
return this.sandbox; | ||
} | ||
getAPI() { | ||
return this.API; | ||
} | ||
getInvoicing() { | ||
return this.Invoicing; | ||
} | ||
getAuth() { | ||
return this.Auth; | ||
} | ||
getAddTracking() { | ||
return this.AddTracking; | ||
} | ||
getProducts() { | ||
return this.Products; | ||
} | ||
getDisputes() { | ||
return this.Disputes; | ||
} | ||
} | ||
export default BasePayPal; |
import BasePayPal from "./BasePayPal.js"; | ||
class PayPal extends BasePayPal { | ||
async authenticate() { | ||
if (this.clientId === null || this.clientSecret === null) { | ||
if (this.getClientId() === null || this.getClientSecret() === null) { | ||
throw new Error("PayPal not configured! Try PayPal.Configure() first!"); | ||
} | ||
try { | ||
await this.Auth.requestNewToken(this.clientId, this.clientSecret, this.sandbox); | ||
await this.getAuth().requestNewToken(this.getClientId(), this.getClientSecret(), this.isSandbox()); | ||
} | ||
@@ -10,0 +10,0 @@ catch (e) { |
@@ -30,3 +30,3 @@ import { GenerateQrCodeAction } from "../Enums/GenerateQrCodeAction.js"; | ||
if (generateNextInvoiceNumber) { | ||
const invoiceNumber = await this.PayPal.Invoicing.generateInvoiceNumber(); | ||
const invoiceNumber = await this.PayPal.getInvoicing().generateInvoiceNumber(); | ||
if (this.detail) { | ||
@@ -39,3 +39,3 @@ this.detail.setInvoiceNumber(invoiceNumber.getInvoiceNumber()); | ||
} | ||
return this.PayPal.Invoicing.createDraft(this); | ||
return this.PayPal.getInvoicing().createDraft(this); | ||
} | ||
@@ -48,3 +48,3 @@ delete() { | ||
} | ||
return this.PayPal.Invoicing.delete(this); | ||
return this.PayPal.getInvoicing().delete(this); | ||
} | ||
@@ -57,3 +57,3 @@ fullyUpdate() { | ||
} | ||
return this.PayPal.Invoicing.fullyUpdate(this); | ||
return this.PayPal.getInvoicing().fullyUpdate(this); | ||
} | ||
@@ -66,3 +66,3 @@ get() { | ||
} | ||
return this.PayPal.Invoicing.get(this); | ||
return this.PayPal.getInvoicing().get(this); | ||
} | ||
@@ -75,3 +75,3 @@ async generateQrCode(action, height, width) { | ||
} | ||
return this.PayPal.Invoicing.generateQrCode(this, typeof action === "function" ? action(GenerateQrCodeAction) : action, height, width); | ||
return this.PayPal.getInvoicing().generateQrCode(this, typeof action === "function" ? action(GenerateQrCodeAction) : action, height, width); | ||
} | ||
@@ -85,3 +85,3 @@ async recordPayment(paymentDetail) { | ||
if (paymentDetail instanceof PaymentDetail) { | ||
return this.PayPal.Invoicing.recordPayment(this, paymentDetail); | ||
return this.PayPal.getInvoicing().recordPayment(this, paymentDetail); | ||
} | ||
@@ -91,3 +91,3 @@ else { | ||
paymentDetail(paymentDetailInstance); | ||
return this.PayPal.Invoicing.recordPayment(this, paymentDetailInstance); | ||
return this.PayPal.getInvoicing().recordPayment(this, paymentDetailInstance); | ||
} | ||
@@ -101,3 +101,3 @@ } | ||
} | ||
return this.PayPal.Invoicing.deleteExternalPayment(this, paymentId); | ||
return this.PayPal.getInvoicing().deleteExternalPayment(this, paymentId); | ||
} | ||
@@ -111,3 +111,3 @@ async recordRefund(refundDetail) { | ||
if (refundDetail instanceof RefundDetail) { | ||
return this.PayPal.Invoicing.recordRefund(this, refundDetail); | ||
return this.PayPal.getInvoicing().recordRefund(this, refundDetail); | ||
} | ||
@@ -117,3 +117,3 @@ else { | ||
refundDetail(refundDetailInstance); | ||
return this.PayPal.Invoicing.recordRefund(this, refundDetailInstance); | ||
return this.PayPal.getInvoicing().recordRefund(this, refundDetailInstance); | ||
} | ||
@@ -127,3 +127,3 @@ } | ||
} | ||
return this.PayPal.Invoicing.deleteExternalRefund(this, transactionId); | ||
return this.PayPal.getInvoicing().deleteExternalRefund(this, transactionId); | ||
} | ||
@@ -136,3 +136,3 @@ async sendReminder(additionalRecipients, note, sendToInvoicer, sendToRecipient, subject) { | ||
} | ||
return this.PayPal.Invoicing.sendReminder(this, additionalRecipients?.map((additionalRecipient) => { | ||
return this.PayPal.getInvoicing().sendReminder(this, additionalRecipients?.map((additionalRecipient) => { | ||
if (additionalRecipient instanceof EmailAddress) { | ||
@@ -154,3 +154,3 @@ return additionalRecipient; | ||
} | ||
return this.PayPal.Invoicing.send(this, additionalRecipients?.map((recipient) => { | ||
return this.PayPal.getInvoicing().send(this, additionalRecipients?.map((recipient) => { | ||
if (recipient instanceof EmailAddress) { | ||
@@ -157,0 +157,0 @@ return recipient; |
@@ -15,3 +15,3 @@ import { ProductType } from "./../Enums/ProductType.js"; | ||
} | ||
return this.PayPal.Products.create(this, paypalRequestId, prefer); | ||
return this.PayPal.getProducts().create(this, paypalRequestId, prefer); | ||
} | ||
@@ -23,6 +23,6 @@ update(patchRequest) { | ||
if (patchRequest instanceof PatchRequest) | ||
return this.PayPal.Products.update(this, patchRequest); | ||
return this.PayPal.getProducts().update(this, patchRequest); | ||
const patch = new PatchRequest(); | ||
patchRequest(patch); | ||
return this.PayPal.Products.update(this, patch); | ||
return this.PayPal.getProducts().update(this, patch); | ||
} | ||
@@ -33,3 +33,3 @@ get() { | ||
} | ||
return this.PayPal.Products.get(this); | ||
return this.PayPal.getProducts().get(this); | ||
} | ||
@@ -36,0 +36,0 @@ setCategory(category) { |
@@ -18,3 +18,3 @@ import { UnitOfMeasure } from "../Enums/UnitOfMeasure.js"; | ||
throw new Error("To use in-built methods, please provide PayPal instance when initialising the template"); | ||
return this.PayPal.Invoicing.createTemplate(this); | ||
return this.PayPal.getInvoicing().createTemplate(this); | ||
} | ||
@@ -27,3 +27,3 @@ async delete() { | ||
} | ||
return this.PayPal.Invoicing.deleteTemplate(this); | ||
return this.PayPal.getInvoicing().deleteTemplate(this); | ||
} | ||
@@ -36,3 +36,3 @@ async fullyUpdate() { | ||
} | ||
return this.PayPal.Invoicing.fullyUpdateTemplate(this); | ||
return this.PayPal.getInvoicing().fullyUpdateTemplate(this); | ||
} | ||
@@ -45,3 +45,3 @@ async get() { | ||
} | ||
return this.PayPal.Invoicing.getTemplate(this); | ||
return this.PayPal.getInvoicing().getTemplate(this); | ||
} | ||
@@ -48,0 +48,0 @@ setDefaultTemplate(defaultTemplate) { |
@@ -18,3 +18,3 @@ import { TrackingNumberType } from "./../Enums/TrackingNumberType.js"; | ||
} | ||
return this.PayPal.AddTracking.updateOrCancel(this.transactionId, this); | ||
return this.PayPal.getAddTracking().updateOrCancel(this.transactionId, this); | ||
} | ||
@@ -28,3 +28,3 @@ get() { | ||
} | ||
return this.PayPal.AddTracking.get(this.transactionId); | ||
return this.PayPal.getAddTracking().get(this.transactionId); | ||
} | ||
@@ -35,3 +35,3 @@ add(...links) { | ||
} | ||
return this.PayPal.AddTracking.add([this], links.map((x) => { | ||
return this.PayPal.getAddTracking().add([this], links.map((x) => { | ||
if (x instanceof LinkDescription) | ||
@@ -38,0 +38,0 @@ return x; |
@@ -6,3 +6,3 @@ { | ||
"name": "paypal-v2-sdk", | ||
"version": "2.3.5", | ||
"version": "2.3.6", | ||
"description": "Unofficial promise-based object-oriented PayPal API v2 SDK for node.js", | ||
@@ -14,3 +14,3 @@ "main": "./dist/index.js", | ||
"build": "tsc", | ||
"compile": "prettier --write \"src/**/*.ts\" && tslint -p tsconfig.json && tsc" | ||
"compile": "rmdir dist -r && tsc" | ||
}, | ||
@@ -17,0 +17,0 @@ "repository": { |
@@ -46,3 +46,3 @@ # Installation | ||
// is displayed here for information purposes only | ||
const invoice: Invoice = await PayPal.Invoicing.get("id of invoice"); | ||
const invoice: Invoice = await PayPal.getInvoicing().get("id of invoice"); | ||
``` | ||
@@ -55,3 +55,3 @@ | ||
const invoice: Invoice = await PayPal.Invoicing.get("id of invoice"); | ||
const invoice: Invoice = await PayPal.getInvoicing().get("id of invoice"); | ||
const deleted = await invoice.delete(); | ||
@@ -359,3 +359,3 @@ console.log(deleted); // true if deleted, false if not | ||
```js | ||
PayPal.on("debug", (str) => console.debug(str)); | ||
PayPal.on("debug", (str) => { console.debug(str) } ); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
602739
14109