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.12 to 1.0.13

7

dist/payments/constants.d.ts

@@ -54,1 +54,8 @@ export declare const DEFAULT_PAYMENT_CREATE_PAYLOAD: {

};
export declare const DEFAULT_PAYMENT_CAPTURE_PAYLOAD: {
amount: {
value: string;
currency_code: string;
};
final_capture: boolean;
};

@@ -69,2 +69,9 @@ "use strict";

};
exports.DEFAULT_PAYMENT_CAPTURE_PAYLOAD = {
amount: {
value: "1.99",
currency_code: "USD"
},
final_capture: true
};
//# sourceMappingURL=constants.js.map

1

dist/payments/index.d.ts
import { IPayPalAccessToken } from "../oauth/interfaces";
export declare function create(token: IPayPalAccessToken, data?: any, headers?: any): Promise<Response>;
export declare function capture(token: IPayPalAccessToken, id: string, data?: any, headers?: any): Promise<Response>;

@@ -19,2 +19,16 @@ "use strict";

exports.create = create;
async function capture(token, id, data, headers) {
const payload = Object.keys(data).length > 0 ? data : constants_1.DEFAULT_PAYMENT_CAPTURE_PAYLOAD;
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/authorizations/${id}/capture`, options);
}
exports.capture = capture;
//# sourceMappingURL=index.js.map

2

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

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

@@ -67,1 +67,9 @@ export const DEFAULT_PAYMENT_CREATE_PAYLOAD = {

};
export const DEFAULT_PAYMENT_CAPTURE_PAYLOAD = {
amount: {
value: "1.99",
currency_code: "USD"
},
final_capture: true
};
import { IPayPalAccessToken } from "../oauth/interfaces";
import { CONFIG } from "../config";
import { DEFAULT_PAYMENT_CREATE_PAYLOAD } from "./constants";
import {
DEFAULT_PAYMENT_CREATE_PAYLOAD,
DEFAULT_PAYMENT_CAPTURE_PAYLOAD
} from "./constants";

@@ -27,1 +30,27 @@ export async function create(

}
export async function capture(
token: IPayPalAccessToken,
id: string,
data?: any,
headers?: any
) {
const payload =
Object.keys(data).length > 0 ? data : DEFAULT_PAYMENT_CAPTURE_PAYLOAD;
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/authorizations/${id}/capture`,
options
);
}

Sorry, the diff of this file is not supported yet

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