caf_paypal/proxy_paypal

Proxy that allows a CA to pay using PayPal.

Source:

Extends

Methods

dirtyCaptureOrder(id) → {Promise.<orderType>}

Source:

Captures the funds of an accepted order.

This is a dirty call, i.e., outside the transaction that process the request, and it could externalize and forget about its actions if there are failures or errors.

This call is idempotent, and the caller should retry it until it succeeds.

Parameters:
Name Type Description
id string

The identifier of the order.

Throws:

When it cannot capture the order.

Type
Error
Returns:

A promise to an order id.

Type
Promise.<orderType>

dirtyCreateOrder(units) → {Promise.<{id: string}>}

Source:

Creates a PayPal order to buy units.

This is a dirty call, i.e., outside the transaction that process the request, and it could externalize and forget about its actions if there are failures or errors.

In practice this means that it could create "abandoned" orders that PayPal will eventually garbage collect.

Parameters:
Name Type Description
units number

The number of units to purchase.

Throws:

When it cannot create the order.

Type
Error
Returns:

A promise to an object containing an order id.

Type
Promise.<{id: string}>

getClientId() → {string}

Source:

Gets the client id of the payee.

Returns:

The client id of the payee.

Type
string

getPrice(units) → {number}

Source:

Gets the total cost in dollars.

Parameters:
Name Type Description
units number

The number of units.

Returns:

The total cost in dollars.

Type
number