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

paypal-isomorphic-functions

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paypal-isomorphic-functions - npm Package Compare versions

Comparing version 1.0.18 to 1.0.19

2

dist/payments/v2/index.d.ts
import { IPayPalAccessToken } from "../../oauth";
export declare function capture(token: IPayPalAccessToken, id: string, data?: any, headers?: any): Promise<Response>;
export declare function refund(token: IPayPalAccessToken, id: string, data: any, headers?: any): Promise<Response>;
export declare function cancel(token: IPayPalAccessToken, id: string, headers?: any): Promise<Response>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = require("../../config");
const constants_1 = require("../../payments/constants");
async function capture(token, id, data, headers) {
const payload = data && Object.keys(data).length > 0
? data
: constants_1.DEFAULT_PAYMENT_CAPTURE_PAYLOAD;
const payload = data || {};
const options = {

@@ -21,2 +18,28 @@ method: "POST",

exports.capture = capture;
async function refund(token, id, data, headers) {
const payload = data || {};
const options = {
method: "POST",
headers: {
Authorization: `Bearer ${token.access_token}`,
"Content-Type": "application/json",
...headers
},
body: JSON.stringify(payload)
};
return await fetch(`${config_1.CONFIG.get("PAYPAL_REST_HOSTNAME")}/v2/payments/captures/${id}/refund`, options);
}
exports.refund = refund;
async function cancel(token, id, headers) {
const options = {
method: "POST",
headers: {
Authorization: `Bearer ${token.access_token}`,
"Content-Type": "application/json",
...headers
}
};
return await fetch(`${config_1.CONFIG.get("PAYPAL_REST_HOSTNAME")}/v2/payments/authorizations/${id}/void`, options);
}
exports.cancel = cancel;
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "paypal-isomorphic-functions",
"version": "1.0.18",
"version": "1.0.19",
"description": "Library of helpful paypal functions that can be run in a browser or server",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

import { CONFIG } from "../../config";
import { IPayPalAccessToken } from "../../oauth";
import { DEFAULT_PAYMENT_CAPTURE_PAYLOAD } from "../../payments/constants";

@@ -11,6 +10,3 @@ export async function capture(

) {
const payload =
data && Object.keys(data).length > 0
? data
: DEFAULT_PAYMENT_CAPTURE_PAYLOAD;
const payload = data || {};

@@ -33,1 +29,45 @@ const options = {

}
export async function refund(
token: IPayPalAccessToken,
id: string,
data: any,
headers?: any
) {
const payload = data || {};
const options = {
method: "POST",
headers: {
Authorization: `Bearer ${token.access_token}`,
"Content-Type": "application/json",
...headers
},
body: JSON.stringify(payload)
};
return await fetch(
`${CONFIG.get("PAYPAL_REST_HOSTNAME")}/v2/payments/captures/${id}/refund`,
options
);
}
export async function cancel(
token: IPayPalAccessToken,
id: string,
headers?: any
) {
const options = {
method: "POST",
headers: {
Authorization: `Bearer ${token.access_token}`,
"Content-Type": "application/json",
...headers
}
};
return await fetch(
`${CONFIG.get(
"PAYPAL_REST_HOSTNAME"
)}/v2/payments/authorizations/${id}/void`,
options
);
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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