Huge News!Announcing our $40M Series B led by Abstract Ventures.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.6 to 1.1.7

src/Types/Queries/ListInvoices.js

2

package.json

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

"name": "paypal-v2-sdk",
"version": "1.1.6",
"version": "1.1.7",
"description": "Unofficial promise-based PayPal API v2 SDK for node.js",

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

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

/**
*
* @param {Object} query
*/
async list(query) {
const response = await this.PayPal.Axios.get(
"https://api.paypal.com/v2/invoicing/invoices",
{
headers: {
"Content-Type": "application/json",
},
params: query,
}
);
return response.data;
}
async create(json) {

@@ -26,0 +43,0 @@ const response = await this.PayPal.Axios.post(

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

const LinkDescription = require("../../Types/General/LinkDescription");
const ListInvoicesQuery = require("../../Types/Queries/ListInvoices");
const ListInvoicesResponse = require("../../Types/Responses/ListInvoices");

@@ -472,2 +474,17 @@ class Invoices extends InvoicesAPI {

/**
*
* @param {ListInvoicesQuery} query
* @returns {ListInvoicesResponse}
*/
async list(query) {
const data = await super.list(query.toAttributeObject());
const listInvoicesResponse = new ListInvoicesResponse(this)
.setItems(data.items?.map((x) => this.constructInvoice(x)))
.setTotalItems(x.total_items)
.setTotalPages(x.total_pages)
.setLinks(x.links);
return listInvoicesResponse;
}
// create new invoice

@@ -506,3 +523,16 @@ // returns invoice object (type)

// uses same builder as create BY ID (can also update via invoice object)
async fullUpdate() {}
/**
*
* @param {Invoice|object} invoiceBuilder
* @returns {Invoice}
*/
async fullUpdate(invoiceBuilder) {
const data = await super.create(
invoiceBuilder instanceof Invoice
? invoiceBuilder.toJson()
: invoiceBuilder
);
const invoice = this.constructInvoice(data);
return invoice;
}

@@ -509,0 +539,0 @@ // cancel a SENT invoice BY ID (can also cancel via invoice object)

@@ -33,2 +33,4 @@ const BasePayPal = require("./BasePayPal");

const InvoicePaymentTerm = require("./Types/Invoices/InvoicePaymentTerm");
const ListInvoicesQuery = require("./Types/Queries/ListInvoices");
const ListInvoicesResponse = require("./Types/Responses/ListInvoices");

@@ -84,2 +86,8 @@ // handlers

},
queries: {
ListInvoices: ListInvoicesQuery.bind(null, this),
},
responses: {
ListInvoices: ListInvoicesResponse.bind(null, this),
},
};

@@ -86,0 +94,0 @@ }

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

}
toJson() {

@@ -13,0 +14,0 @@ return JSON.stringify(this.toAttributeObject());

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