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

paypal-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paypal-wrapper - npm Package Compare versions

Comparing version

to
0.0.2

2

package.json
{
"name": "paypal-wrapper",
"version": "0.0.1",
"version": "0.0.2",
"description": "Paypal REST API Wrapper",

@@ -5,0 +5,0 @@ "main": "paypalwrapper.js",

@@ -38,4 +38,6 @@ ((paypalWrapper, request)=>{

paypalWrapper.payments = {
paypalWrapper.payments = { };
paypalWrapper.payments.payment = {
buildPayerObjPaypal : ()=>{

@@ -107,3 +109,30 @@ return {

buildUpdateOpObjReplaceAmount : (transNum, total, currency, subtotal, shipping)=>{
return {
"op": "replace",
"path": "/transactions/" + transNum + "/amount",
"value": {
"total": total,
"currency": currency,
"details": {
"subtotal": subtotal,
"shipping": shipping
}
}
};
},
buildUpdateOpObjReplaceShipping : (transNum, name, line1, city, postal, countryCode)=>{
return {
"op": "add",
"path": "/transactions/" + transNum + "/item_list/shipping_address",
"value": {
"recipient_name": name,
"line1": line1,
"city": city,
"postal_code": postal,
"country_code": countryCode
}
};
},

@@ -143,8 +172,172 @@ //Get Payment

updatePayment : (paymentID, opsArray, cb)=>{
var path = "/v1/payments/payment/payment_id";
var headers = { };
var body = opsArray;
AJAX(path, "PATCH", headers, body, cb);
}
};
paypalWrapper.payments.sale = {
find : (saleID, cb)=>{
var path = "/v1/payments/sale/" + saleID;
var headers = { };
var body = undefined;
AJAX(path, "GET", headers, body, cb);
},
refund : (saleID, total, currency, invoiceNum, cb)=>{
var path = "/v1/payments/sale/sale_id/refund";
var headers = { };
var body = {
"amount": {
"total": total,
"currency": currency
},
"invoice_number": invoiceNum
};
AJAX(path, "POST", headers, body, cb);
},
findRefund : (refundID, cb)=>{
var path = "/v1/payments/refund/" + refundID;
var headers = { };
var body = undefined;
AJAX(path, "GET", headers, body, cb);
},
};
paypalWrapper.payments.auth = {
details : (authID, cb)=>{
var path = "/v1/payments/authorization/" + authID;
var headers = { };
var body = undefined;
AJAX(path, "GET", headers, body, cb);
},
capture : (authID, cb)=>{
var path = "/v1/payments/authorization/" + authID + "/capture";
var headers = { };
var body = undefined;
AJAX(path, "GET", headers, body, cb);
},
voidauth : (authID, cb)=>{
var path = "/v1/payments/authorization/" + authID + "/void";
var headers = { };
var body = undefined;
AJAX(path, "POST", headers, body, cb);
},
reauth : (authID, cb)=>{
var path = "/v1/payments/authorization/" + authID + "/reauthorize";
var headers = { };
var body = undefined;
AJAX(path, "POST", headers, body, cb);
},
};
paypalWrapper.payments.capture = {
details : (captureID, cb)=>{
var path = "/v1/payments/capture/" + captureID;
var headers = { };
var body = undefined;
AJAX(path, "GET", headers, body, cb);
},
refund : (captureID, total, currency, cb)=>{
var path = "/v1/payments/capture/" + captureID + "/refund";
var headers = { };
var body = {
"amount": {
"currency": currency,
"total": total
}
};
AJAX(path, "POST", headers, body, cb);
},
};
paypalWrapper.payments.order = {
details : (orderID, cb)=>{
var path = "/v1/payments/orders/" + orderID;
var headers = { };
var body = undefined;
AJAX(path, "GET", headers, body, cb);
},
authorize : (orderID, total, currency, cb)=>{
var path = "/v1/payments/orders/" + orderID + "/authorize";
var headers = { };
var body = {
"amount": {
"currency": currency,
"total": total
}
};
AJAX(path, "POST", headers, body, cb);
},
capture : (orderID, total, currency, cb)=>{
var path = "/v1/payments/orders/" + orderID + "/capture";
var headers= { };
var body = {
"amount": {
"currency": currency,
"total": total
},
"is_final_capture": true
};
AJAX(path, "POST", headers, body, cb);
},
void : (orderID, cb)=>{
var path = "/v1/payments/orders/" + orderID + "/do-void";
var headers = { };
var body = undefined;
AJAX(path, "POST", headers, body, cb);
},
};
})

@@ -151,0 +344,0 @@ (