Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paypal-rest-api

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paypal-rest-api - npm Package Compare versions

Comparing version 0.0.45 to 0.0.46

40

lib/invoice/model.js

@@ -56,4 +56,7 @@ "use strict";

if (!this.model.id) {
throw new Error("Model does not have an id. Call create first");
throw new Error("Model id is invalid");
}
if (this.model.status !== "DRAFT") {
throw new Error("Invalid Status");
}
const response = yield this.api.send(this.model.id, options);

@@ -67,4 +70,8 @@ yield this.get();

if (!this.model.id) {
throw new Error("Model does not have an id. Call create first");
throw new Error("Model id is invalid");
}
const validStatuses = ["SENT"];
if (validStatuses.indexOf(this.model.status) === -1) {
throw new Error("Invalid Status");
}
const response = yield this.api.remind(this.model.id, options);

@@ -77,4 +84,8 @@ return this;

if (!this.model.id) {
throw new Error("Model does not have an id. Call create first");
throw new Error("Model id is invalid");
}
const validStatuses = ["SENT"];
if (validStatuses.indexOf(this.model.status) === -1) {
throw new Error("Invalid Status");
}
const response = yield this.api.cancel(this.model.id, options);

@@ -87,2 +98,6 @@ return this;

return __awaiter(this, void 0, void 0, function* () {
const validStatuses = ["DRAFT", "UNPAID", "SENT"];
if (validStatuses.indexOf(this.model.status) === -1) {
throw new Error("Invalid Status");
}
return _super("update").call(this, this.model, options);

@@ -94,4 +109,7 @@ });

return __awaiter(this, void 0, void 0, function* () {
if (!this.model.id) {
throw new Error("Model id is invalid");
}
if (this.model.status !== "DRAFT") {
throw new Error(`Only draft invoices can be deleted`);
throw new Error(`Invalid status`);
}

@@ -104,4 +122,8 @@ return _super("delete").call(this, options);

if (!this.model.id) {
throw new Error("Model does not have an id. Call create first");
throw new Error("Model id is invalid");
}
const validStatuses = ["UNPAID", "SENT"];
if (validStatuses.indexOf(this.model.status) === -1) {
throw new Error("Invalid Status");
}
options.body = payment;

@@ -115,4 +137,8 @@ const response = yield this.api.recordPayment(this.model.id, options);

if (!this.model.id) {
throw new Error("Model does not have an id. Call create first");
throw new Error("Model id is invalid");
}
const validStatuses = ["UNPAID", "SENT"];
if (validStatuses.indexOf(this.model.status) === -1) {
throw new Error("Invalid Status");
}
options.body = refund;

@@ -126,3 +152,3 @@ const response = yield this.api.recordRefund(this.model.id, options);

if (!this.model.id) {
throw new Error("Model does not have an id. Call create first");
throw new Error("Model id is invalid");
}

@@ -129,0 +155,0 @@ options.qs = opts;

2

package.json
{
"name": "paypal-rest-api",
"version": "0.0.45",
"version": "0.0.46",
"description": "A typescript module for integrating with PayPal REST APIs.",

@@ -5,0 +5,0 @@ "license": "MIT",

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