@flowpay-io/offer
v2.2.2
Published
Flowpay SDK - Offer calculation utilities
Readme
@flowpay-io/offer
Offer calculation and installment plan utilities.
Installation
Use your favorite package manager (eg. npm) to install the Flowpay.js module:
$ npm add @flowpay-io/offerUsage
// JS:
const flowpay = require('@flowpay-io/offer');
// TS:
import { PartnerOffer, ProductType calculateInstallmentPlan } from '@flowpay-io/offer';Calculate installment plan with specified product parameters given provided financing offer
// JS:
var offer = {
id: '1',
products: [
{
product: 'M3',
minAmount: 100000,
maxAmount: 200000,
currency: 'CZK',
ratePerc: 1,
balloon: true,
installmentCount: 3,
prolongationEnabled: true,
postponeEnabled: false,
maxPostponeLength: 0,
maxProlongationLength: 2,
interestRateMultiplier: 1,
postponeFeeMultiplier: 1,
prolongationFeeMultiplier: 1,
},
],
};
var plan = flowpay.calculateInstallmentPlan(
offer,
'M3',
100000,
new Date('2022-01-03'),
0,
false
);
console.log(plan);
// TS:
const offer: PartnerOffer = {
id: '1',
products: [
{
product: ProductType.M3,
minAmount: 100000,
maxAmount: 200000,
currency: 'CZK',
ratePerc: 1,
balloon: true,
installmentCount: 3,
prolongationEnabled: true,
postponeEnabled: false,
maxPostponeLength: 0,
maxProlongationLength: 2,
interestRateMultiplier: 1,
postponeFeeMultiplier: 1,
prolongationFeeMultiplier: 1,
},
],
};
const eligible = checkEligibility(offer, ProductType.M3, 100000, 0, false);
const plan = calculateInstallmentPlan(
offer,
ProductType.M3,
100000,
new Date('2022-01-03'),
0,
false
);
console.log(plan);Links
- Homepage: https://www.flowpay.io
- Documentation: https://developers.flowpay.io
