New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

paypal-v2-sdk

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paypal-v2-sdk - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json

@@ -6,3 +6,3 @@ {

"name": "paypal-v2-sdk",
"version": "1.1.0",
"version": "1.1.1",
"description": "Unofficial SDK for PayPal API v2",

@@ -9,0 +9,0 @@ "main": "index.js",

@@ -23,4 +23,29 @@ const PayPalClass = require("../../PayPal");

}
async create(json) {
const response = await this.PayPal.Axios.post(
`https://api.paypal.com/v2/invoicing/invoices`,
{
headers: {
"Content-Type": "application/json",
},
data: json,
}
);
return response.data;
}
async delete(id) {
const response = await this.PayPal.Axios.delete(
`https://api.paypal.com/v2/invoicing/invoices/${id}`,
{
headers: {
"Content-Type": "application/json",
},
}
);
return response.status === 204 ? true : false;
}
}
module.exports = Invoices;

@@ -51,9 +51,9 @@ const PayPalClass = require("../../PayPal");

new InvoiceDetail(this.PayPal)
.setReference(data.detail.reference)
.setCurrencyCode(data.detail.currency_code)
.setNote(data.detail.note)
.setTermsAndConditions(data.detail.terms_and_conditions)
.setMemo(data.detail.memo)
.setReference(data.detail?.reference)
.setCurrencyCode(data.detail?.currency_code)
.setNote(data.detail?.note)
.setTermsAndConditions(data.detail?.terms_and_conditions)
.setMemo(data.detail?.memo)
.setAttachments(
data.detail.attachments.map((x) =>
data.detail?.attachments?.map((x) =>
new FileReference(this.PayPal)

@@ -67,23 +67,23 @@ .setId(x.id)

)
.setInvoiceNumber(data.detail.invoice_number)
.setInvoiceDate(data.detail.invoice_date)
.setInvoiceNumber(data.detail?.invoice_number)
.setInvoiceDate(data.detail?.invoice_date)
.setPaymentTerm(
new InvoicePaymentTerm(this.PayPal)
.setTermType(data.detail.payment_term.term_type)
.setDueDate(data.detail.payment_term.due_date)
.setTermType(data.detail?.payment_term.term_type)
.setDueDate(data.detail?.payment_term.due_date)
)
.setMetadata(
new Metadata(this.PayPal)
.setCreateTime(data.detail.metadata.create_time)
.setCreatedBy(data.detail.metadata.created_by)
.setLastUpdateTime(data.detail.metadata.last_update_time)
.setLastUpdatedBy(data.detail.metadata.last_updated_by)
.setCancelTime(data.detail.metadata.cancel_time)
.setCancelledBy(data.detail.metadata.cancelled_by)
.setFirstTimeSent(data.detail.metadata.first_sent_time)
.setLastTimeSent(data.detail.metadata.last_sent_time)
.setLastSentBy(data.detail.metadata.last_sent_by)
.setCreatedByFlow(data.detail.metadata.created_by_flow)
.setRecipientViewUrl(data.detail.metadata.recipient_view_url)
.setInvoicerViewUrl(data.detail.metadata.invoicer_view_url)
.setCreateTime(data.detail?.metadata?.create_time)
.setCreatedBy(data.detail?.metadata?.created_by)
.setLastUpdateTime(data.detail?.metadata?.last_update_time)
.setLastUpdatedBy(data.detail?.metadata?.last_updated_by)
.setCancelTime(data.detail?.metadata?.cancel_time)
.setCancelledBy(data.detail?.metadata?.cancelled_by)
.setFirstTimeSent(data.detail?.metadata?.first_sent_time)
.setLastTimeSent(data.detail?.metadata?.last_sent_time)
.setLastSentBy(data.detail?.metadata?.last_sent_by)
.setCreatedByFlow(data.detail?.metadata?.created_by_flow)
.setRecipientViewUrl(data.detail?.metadata?.recipient_view_url)
.setInvoicerViewUrl(data.detail?.metadata?.invoicer_view_url)
)

@@ -95,3 +95,3 @@ )

.setPhones(
data.invoicer.phones.map((x) =>
data.invoicer.phones?.map((x) =>
new PhoneDetail(this.PayPal)

@@ -111,9 +111,9 @@ .setCountryCode(x.country_code)

.setPrimaryRecipients(
data.primary_recipients.map((x) =>
data.primary_recipients?.map((x) =>
new RecipientInfo(this.PayPal)
.setBillingInfo(
new BillingInfo(this.PayPal)
.setEmailAddress(x.billing_info.email_address)
.setEmailAddress(x.billing_info?.email_address)
.setPhones(
x.phones.map((y) =>
x.phones?.map((y) =>
new PhoneDetail()

@@ -131,11 +131,11 @@ .setCountryCode(y.country_code)

new ContactInfo(this.PayPal)
.setBusinessName(x.shipping_info.business_name)
.setBusinessName(x.shipping_info?.business_name)
.setName(
new Name(this.PayPal)
.setPrefix(x.shipping_info.name.prefix)
.setGivenName(x.shipping_info.name.given_name)
.setSurname(x.shipping_info.name.surname)
.setMiddleName(x.shipping_info.name.middle_name)
.setSuffix(x.shipping_info.name.suffix)
.setFullName(x.shipping_info.name.full_name)
.setPrefix(x.shipping_info?.name?.prefix)
.setGivenName(x.shipping_info?.name?.given_name)
.setSurname(x.shipping_info?.name?.surname)
.setMiddleName(x.shipping_info?.name?.middle_name)
.setSuffix(x.shipping_info?.name?.suffix)
.setFullName(x.shipping_info?.name?.full_name)
)

@@ -145,34 +145,37 @@ .setAddress(

.setAddressLines([
x.shipping_info.address.address_line_1,
x.shipping_info.address.address_line_2,
x.shipping_info.address.address_line_3,
x.shipping_info?.address?.address_line_1,
x.shipping_info?.address?.address_line_2,
x.shipping_info?.address?.address_line_3,
])
.setAdminArea([
x.shipping_info.address.admin_area_4,
x.shipping_info.address.admin_area_3,
x.shipping_info.address.admin_area_2,
x.shipping_info.address.admin_area_1,
x.shipping_info?.address?.admin_area_4,
x.shipping_info?.address?.admin_area_3,
x.shipping_info?.address?.admin_area_2,
x.shipping_info?.address?.admin_area_1,
])
.setPostalCode(x.shipping_info.address.postal_code)
.setCountryCode(x.shipping_info.address.country_code)
.setPostalCode(x.shipping_info?.address?.postal_code)
.setCountryCode(x.shipping_info?.address?.country_code)
.setAddressDetails(
new AddressDetails(this.PayPal)
.setStreetNumber(
x.shipping_info.address.address_details.street_number
x.shipping_info?.address?.address_details
?.street_number
)
.setStreetName(
x.shipping_info.address.address_details.street_name
x.shipping_info?.address?.address_details?.street_name
)
.setStreetType(
x.shipping_info.address.address_details.street_type
x.shipping_info?.address?.address_details?.street_type
)
.setDeliveryService(
x.shipping_info.address.address_details
.delivery_service
x.shipping_info?.address?.address_details
?.delivery_service
)
.setBuildingName(
x.shipping_info.address.address_details.building_name
x.shipping_info?.address?.address_details
?.building_name
)
.setSubBuilding(
x.shipping_info.address.address_details.sub_building
x.shipping_info?.address?.address_details
?.sub_building
)

@@ -185,6 +188,6 @@ )

.setAdditionalRecipients(
data.additional_recipients.map((x) => x.email_address)
data.additional_recipients?.map((x) => x.email_address)
)
.setItems(
data.items.map((x) =>
data.items?.map((x) =>
new Item(this.PayPal)

@@ -202,8 +205,8 @@ .setId(x.id)

new Tax(this.PayPal)
.setName(x.tax.name)
.setPercent(x.tax.percent)
.setName(x.tax?.name)
.setPercent(x.tax?.percent)
.setAmount(
new Money(this.PayPal)
.setCurrencyCode(x.tax.amount.currency_code)
.setValue(x.tax.amount.value)
.setCurrencyCode(x.tax?.amount?.currency_code)
.setValue(x.tax?.amount?.value)
)

@@ -214,7 +217,7 @@ )

new Discount(this.PayPal)
.setPercent(x.discount.percent)
.setPercent(x.discount?.percent)
.setAmount(
new Money(this.PayPal)
.setCurrencyCode(x.discount.amount.currency_code)
.setValue(x.discount.amount.value)
.setCurrencyCode(x.discount?.amount?.currency_code)
.setValue(x.discount?.amount?.value)
)

@@ -228,10 +231,10 @@ )

.setTaxCalculatedAfterDiscount(
data.configuration.tax_calculated_after_discount
data.configuration?.tax_calculated_after_discount
)
.setTaxInclusive(data.configuration.tax_inclusive)
.setAllowTip(data.configuration.allow_tip)
.setTaxInclusive(data.configuration?.tax_inclusive)
.setAllowTip(data.configuration?.allow_tip)
.setPartialPayment(
new PartialPayment(this.PayPal)
.setAllowPartialPayment(
data.configuration.partial_payment.allow_partial_payment
data.configuration?.partial_payment?.allow_partial_payment
)

@@ -241,16 +244,17 @@ .setMinimumAmountDue(

.setCurrencyCode(
data.configuration.partial_payment.minimum_amount_due
.currency_code
data.configuration?.partial_payment?.minimum_amount_due
?.currency_code
)
.setValue(
data.configuration.partial_payment.minimum_amount_due.value
data.configuration?.partial_payment?.minimum_amount_due
?.value
)
)
)
.setTemplateId(data.configuration.template_id)
.setTemplateId(data.configuration?.template_id)
)
.setAmount(
new AmountSummaryDetail(this.PayPal)
.setCurrencyCode(data.amount.currency_code)
.setValue(data.amount.value)
.setCurrencyCode(data.amount?.currency_code)
.setValue(data.amount?.value)
.setBreakdown(

@@ -261,5 +265,5 @@ new AmountWithBreakdown(this.PayPal)

.setCurrencyCode(
data.amount.breakdown.item_total.currency_code
data.amount?.breakdown?.item_total?.currency_code
)
.setValue(data.amount.breakdown.item_total.value)
.setValue(data.amount?.breakdown?.item_total?.value)
)

@@ -271,3 +275,4 @@ .setDiscount(

.setPercent(
data.amount.breakdown.discount.invoice_discount.percent
data.amount?.breakdown?.discount?.invoice_discount
?.percent
)

@@ -277,8 +282,8 @@ .setAmount(

.setCurrencyCode(
data.amount.breakdown.discount.invoice_discount
.amount.currency_code
data.amount?.breakdown?.discount?.invoice_discount
?.amount.currency_code
)
.setValue(
data.amount.breakdown.discount.invoice_discount
.amount.value
data.amount?.breakdown?.discount?.invoice_discount
?.amount?.value
)

@@ -290,7 +295,7 @@ )

.setCurrencyCode(
data.amount.breakdown.discount.item_discount
.currency_code
data.amount?.breakdown?.discount?.item_discount
?.currency_code
)
.setValue(
data.amount.breakdown.discount.item_discount.value
data.amount?.breakdown?.discount?.item_discount?.value
)

@@ -302,5 +307,5 @@ )

.setCurrencyCode(
data.amount.breakdown.tax_total.currency_code
data.amount?.breakdown?.tax_total?.currency_code
)
.setValue(data.amount.breakdown.tax_total.value)
.setValue(data.amount?.breakdown?.tax_total?.value)
)

@@ -312,18 +317,20 @@ .setShipping(

.setCurrencyCode(
data.amount.breakdown.shipping.amount.currency_code
data.amount?.breakdown?.shipping?.amount?.currency_code
)
.setValue(data.amount.breakdown.shipping.amount.value)
.setValue(data.amount?.breakdown?.shipping?.amount?.value)
)
.setTax(
new Tax(this.PayPal)
.setName(data.amount.breakdown.shipping.tax.name)
.setPercent(data.amount.breakdown.shipping.tax.percent)
.setName(data.amount?.breakdown?.shipping?.tax?.name)
.setPercent(
data.amount?.breakdown?.shipping?.tax?.percent
)
.setAmount(
new Money(this.PayPal)
.setCurrencyCode(
data.amount.breakdown.shipping.tax.amount
data.amount?.breakdown?.shipping?.tax?.amount
.currency_code
)
.setValue(
data.amount.breakdown.shipping.tax.amount.value
data.amount?.breakdown?.shipping?.tax?.amount.value
)

@@ -335,9 +342,9 @@ )

new CustomAmount(this.PayPal)
.setLabel(data.amount.breakdown.custom.label)
.setLabel(data.amount?.breakdown?.custom?.label)
.setAmount(
new Money(this.PayPal)
.setCurrencyCode(
data.amount.breakdown.custom.amount.currency_code
data.amount?.breakdown?.custom?.amount.currency_code
)
.setValue(data.amount.breakdown.custom.amount.value)
.setValue(data.amount?.breakdown?.custom?.amount.value)
)

@@ -354,4 +361,4 @@ )

new Money(this.PayPal)
.setCurrencyCode(data.gratuity.currency_code)
.setValue(data.gratuity.value)
.setCurrencyCode(data.gratuity?.currency_code)
.setValue(data.gratuity?.value)
)

@@ -362,7 +369,7 @@ .setPayments(

new Money(this.PayPal)
.setCurrencyCode(data.payments.paid_amount.currency_code)
.setValue(data.payments.paid_amount.value)
.setCurrencyCode(data.payments?.paid_amount?.currency_code)
.setValue(data.payments?.paid_amount?.value)
)
.setTransactions(
data.payments.transactions.map((x) =>
data.payments?.transactions?.map((x) =>
new PaymentDetail(this.PayPal)

@@ -381,11 +388,11 @@ .setType(x.type)

new ContactInfo(this.PayPal)
.setBusinessName(x.shipping_info.business_name)
.setBusinessName(x.shipping_info?.business_name)
.setName(
new Name(this.PayPal)
.setPrefix(x.shipping_info.name.prefix)
.setGivenName(x.shipping_info.name.given_name)
.setSurname(x.shipping_info.name.surname)
.setMiddleName(x.shipping_info.name.middle_name)
.setSuffix(x.shipping_info.name.suffix)
.setFullName(x.shipping_info.name.full_name)
.setPrefix(x.shipping_info?.name?.prefix)
.setGivenName(x.shipping_info?.name?.given_name)
.setSurname(x.shipping_info?.name?.surname)
.setMiddleName(x.shipping_info?.name?.middle_name)
.setSuffix(x.shipping_info?.name?.suffix)
.setFullName(x.shipping_info?.name?.full_name)
)

@@ -395,39 +402,39 @@ .setAddress(

.setAddressLines([
x.shipping_info.address.address_line_1,
x.shipping_info.address.address_line_2,
x.shipping_info.address.address_line_3,
x.shipping_info?.address?.address_line_1,
x.shipping_info?.address?.address_line_2,
x.shipping_info?.address?.address_line_3,
])
.setAdminArea([
x.shipping_info.address.admin_area_4,
x.shipping_info.address.admin_area_3,
x.shipping_info.address.admin_area_2,
x.shipping_info.address.admin_area_1,
x.shipping_info?.address?.admin_area_4,
x.shipping_info?.address?.admin_area_3,
x.shipping_info?.address?.admin_area_2,
x.shipping_info?.address?.admin_area_1,
])
.setPostalCode(x.shipping_info.address.postal_code)
.setCountryCode(x.shipping_info.address.country_code)
.setPostalCode(x.shipping_info?.address?.postal_code)
.setCountryCode(x.shipping_info?.address?.country_code)
.setAddressDetails(
new AddressDetails(this.PayPal)
.setStreetNumber(
x.shipping_info.address.address_details
.street_number
x.shipping_info?.address?.address_details
?.street_number
)
.setStreetName(
x.shipping_info.address.address_details
.street_name
x.shipping_info?.address?.address_details
?.street_name
)
.setStreetType(
x.shipping_info.address.address_details
.street_type
x.shipping_info?.address?.address_details
?.street_type
)
.setDeliveryService(
x.shipping_info.address.address_details
.delivery_service
x.shipping_info?.address?.address_details
?.delivery_service
)
.setBuildingName(
x.shipping_info.address.address_details
.building_name
x.shipping_info?.address?.address_details
?.building_name
)
.setSubBuilding(
x.shipping_info.address.address_details
.sub_building
x.shipping_info?.address?.address_details
?.sub_building
)

@@ -444,7 +451,7 @@ )

new Money(this.PayPal)
.setCurrencyCode(data.refunds.refund_amount.currency_code)
.setValue(data.refunds.refund_amount.value)
.setCurrencyCode(data.refunds?.refund_amount?.currency_code)
.setValue(data.refunds?.refund_amount?.value)
)
.setTransactions(
data.refunds.transactions.map((x) =>
data.refunds?.transactions?.map((x) =>
new RefundDetail(this.PayPal)

@@ -456,4 +463,4 @@ .setType(x.type)

new Money(this.PayPal)
.setCurrencyCode(x.amount.currency_code)
.setValue(x.amount.value)
.setCurrencyCode(x.amount?.currency_code)
.setValue(x.amount?.value)
)

@@ -465,3 +472,3 @@ .setMethod(x.method)

.setLinks(
data.links.map((x) =>
data.links?.map((x) =>
new LinkDescription(this.PayPal)

@@ -491,6 +498,27 @@ .setHref(x.href)

// returns invoice object (type)
async create() {}
/**
*
* @param {Invoice} invoiceBuilder
* @returns {Invoice}
*/
async create(invoiceBuilder) {
const data = await super.create(invoiceBuilder.toJson());
const invoice = this.constructInvoice(data);
return invoice;
}
// delete an invoice BY ID (can also delete via invoice object)
async delete() {}
/**
*
* @param {String} id
* @returns {Boolean}
*/
async delete(id) {
try {
var deleted = await super.delete(id);
} catch (e) {
throw e;
}
return deleted;
}

@@ -497,0 +525,0 @@ // uses same builder as create BY ID (can also update via invoice object)

@@ -8,2 +8,3 @@ const BasePayPal = require("./BasePayPal");

invoiceNumber: require("./Handlers/Invoices/InvoiceNumber"),
invoices: require("./Handlers/Invoices/Invoices"),
};

@@ -17,2 +18,3 @@

invoiceNumber: new invoices.invoiceNumber(this),
invoices: new invoices.invoices(this),
};

@@ -19,0 +21,0 @@ }

@@ -12,2 +12,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -14,0 +29,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -13,2 +13,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -15,0 +30,0 @@ *

@@ -16,2 +16,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -18,0 +33,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -13,2 +13,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -15,0 +30,0 @@ *

@@ -15,2 +15,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -17,0 +32,0 @@ *

@@ -13,2 +13,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -15,0 +30,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -12,2 +12,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
setId(id) {

@@ -14,0 +29,0 @@ this.id = id;

@@ -16,2 +16,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -18,0 +33,0 @@ *

@@ -12,2 +12,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -14,0 +29,0 @@ *

@@ -12,2 +12,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -49,3 +64,3 @@ *

setLastUpdatedBy(email) {
this.lastedUpdatedBy = email;
this.lastUpdatedBy = email;
return this;

@@ -52,0 +67,0 @@ }

@@ -12,2 +12,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -14,0 +29,0 @@ *

@@ -12,2 +12,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -14,0 +29,0 @@ *

@@ -13,2 +13,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -15,0 +30,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -12,2 +12,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -14,0 +29,0 @@ *

@@ -15,2 +15,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -17,0 +32,0 @@ *

@@ -13,2 +13,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -15,0 +30,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -14,2 +14,4 @@ const PayPalClass = require("../../PayPal");

const InvoiceAPI = require("../../API/Invoices/Invoices");
class Invoice {

@@ -24,2 +26,42 @@ /**

/*
Invoice methods
*/
async delete() {
if (!["DRAFT", "SCHEDULED"].includes(this.status)) {
throw new Error(
"You can only cancel invoices in Draft or Scheduled state"
);
}
const api = new InvoiceAPI(this.PayPal);
const deleted = await api.delete(this.id);
return deleted;
}
/*
Invoice methods
*/
toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -26,0 +68,0 @@ *

@@ -16,2 +16,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -18,0 +33,0 @@ *

@@ -14,2 +14,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -16,0 +31,0 @@ *

@@ -12,2 +12,17 @@ const PayPalClass = require("../../PayPal");

toJson() {
return JSON.stringify(this.toAttributeObject());
}
toAttributeObject() {
const obj = {};
for (const entry of Object.keys(this)) {
obj[entry.replace(/[A-Z]/g, (x) => `_${x.toLowerCase()}`)] =
this[entry] instanceof Object
? this[entry].toAttributeObject()
: this[entry];
}
return obj;
}
/**

@@ -14,0 +29,0 @@ *

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc