paypal-isomorphic-functions
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -6,1 +6,2 @@ import { IPayPalAccessToken } from "../oauth/interfaces"; | ||
export declare function authorize(token: IPayPalAccessToken, id: string, data?: any, headers?: any): Promise<Response>; | ||
export declare function capture(token: IPayPalAccessToken, id: string, data?: any, headers?: any): Promise<Response>; |
@@ -51,4 +51,6 @@ "use strict"; | ||
Authorization: `Bearer ${token.access_token}`, | ||
"Content-Type": "application/json" | ||
} | ||
"Content-Type": "application/json", | ||
...headers | ||
}, | ||
body: JSON.stringify(payload) | ||
}; | ||
@@ -58,2 +60,16 @@ return await fetch(`${config_1.CONFIG.get("PAYPAL_REST_HOSTNAME")}/v2/checkout/orders/${id}/authorize`, options); | ||
exports.authorize = authorize; | ||
async function capture(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/checkout/orders/${id}/capture`, options); | ||
} | ||
exports.capture = capture; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "paypal-isomorphic-functions", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "Library of helpful paypal functions that can be run in a browser or server", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -85,5 +85,6 @@ import { IPayPalAccessToken } from "../oauth/interfaces"; | ||
Authorization: `Bearer ${token.access_token}`, | ||
"Content-Type": "application/json" | ||
} | ||
// body: JSON.stringify(payload) | ||
"Content-Type": "application/json", | ||
...headers | ||
}, | ||
body: JSON.stringify(payload) | ||
}; | ||
@@ -95,1 +96,25 @@ return await fetch( | ||
} | ||
export async function capture( | ||
token: IPayPalAccessToken, | ||
id: string, | ||
data?: any, | ||
headers?: any | ||
) { | ||
// TODO: add a default | ||
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/checkout/orders/${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
366480
1393
28