Version 1.0.0
offers the PR_ProspectivePayment
type, which allows you to retrieve prospective Instalment Plan pricing for given loan principal amounts.
Here's documentation of the types available in 1.0.0
:
PR_ProspectivePayment
A theoretical payment amount, and the number of months over which that payment
would be made, if an applicant successfully applied for a Procuret Instalment
Plan.
Properties
.periods
-Number
- The number of months over which payment would be made.amount
-PR_Amount
- The monthly payment amount.supplierId
-String
- The ID of the Procuret supplier for which this
price is valid.
Static Methods
.retrieve
Retrieve a single PR_ProspectivePayment
for given parameters. To use this
method, you must know a valid months
value in advance. If you don't know
a valid months
value in advance, prefer .retrieveAllAvailable
.
Parameters
callback
-Function<Error?, PR_ProspectivePayment?>
- A function taking
optional error and result parameters, in which you can handle the API response.principal
-String
- A string-encoded number representing the principal
value of the prospective loan. For example, a total invoice value. Minimum
value500
currency units.supplierId
-String
- Your Supplier ID. Consult your Procuret
partnership manager if you are unsure of this value.denomination
-PR_Currency
- The monetary denomination of theprincipal
value.months
-Number
- The integer number of months over which the instalment
plan would be paid.endpoint
-Optional<String>
- Optionally override the API endpoint.
Useful in testing a demonstration environments.- [undocumented, do not use, do not provide a value]
Example Usage
PR_ProspectivePayment.retrieve(
(error, prospectivePayment) => {
if (error) { console.log('An error occurred'); return; }
console.log('A successful applicant would pay \
' + payment.amount.asDenominatedString + ' per month');
return;
},
"600", // $600
"511291212", // some Supplier ID
PR_Currency.AUD, // Australian dollars
12 // 12 months
);
.retrieveAllAvailable
Retrieve all available PR_ProspectivePayment
for given parameters. This is
a convenient way to display all potential instalment plan payment amounts to
a potential applicant.
Parameters
callback
-Function<Error?, PR_ProspectivePayment?>
- A function taking
optional error and result parameters, in which you can handle the API response.principal
-String
- A string-encoded number representing the principal
value of the prospective loan. For example, a total invoice value. Minimum
value500
currency units.denomination
-PR_Currency
- The monetary denomination of theprincipal
value.supplierId
-String
- Your Supplier ID. Consult your Procuret
partnership manager if you are unsure of this value.endpoint
-Optional<String>
- Optionally override the API endpoint.
Useful in testing a demonstration environments.- [undocumented, do not use, do not provide a value]
Example Usage
PR_ProspectivePayment.retrieveAllAvailable(
(error, availablePayments) => {
if (error) { console.log('An error occurred'); return; }
const availablePayments = payments.map((p) => {
return p.amount.asDenominatedString
});
console.log('Applicants may choose from the following payments \
' + availablePayments);
return;
},
"600", // $600
PR_Currency.AUD, // Australian dollars
"511291212", // some Supplier ID
12 // 12 months
);
PR_Currency
A unit of monetary denomination
Properties
iso_4217
-String
- The ISO 4217 code of this currencysymbol
-String
- The common-use symbol for this currencyexponent
-Number
- The integer exponent of the currency's subunitsname
-String
- The full-form name of this currencyindexid
-Number
- A unique integer identifier for the currency in the
Procure context
Static Properties
.AUD
-PR_Currency
- Australian dollars.NZD
-PR_Currency
- New Zealand dollars.allAvailable
-Array<PR_Currency>
- All available currencies
PR_Amount
A monetary amount, a combination of magnitude and currency denomination
Properties
asNumber
-Number
- The amount magnitude cast to a JavaScriptNumber
asLocaleString
-String
- A Locale-defined string representationasSymbolisedString
-String
- The amount prefixed by its currency symbolasDenominatedString
-String
- The amount prefixed by its ISO 4217 codemagnitude
-String
- The undenominated magnitude of the amountdenomination
-PR_Currency
- The denomination of the amountisGreaterThanZero
-Boolean
-true
if the magnitude of the amount is
greater than zero, elsefalse