PaidUpScheduleConnect.calculatePrices()

Calculate prices for a product

Calculate prices for a product

Usage

Hover over inputs/exits for more info.

var PaidUpScheduleConnect = require('pu-schedule-connect');


// Calculate prices for a product

PaidUpScheduleConnect.calculatePrices({

baseUrl: 'http://localhost:9006',

token: 'secret-word',

prices: [ { description: 'some description', dateCharge: 'some string data description', originalPrice: 203, stripePercent: 2.9, stripeFlat: 0.3, paidUpFee: 5, discount: 10, payProcessing: false, payCollecting: true } ],

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

baseUrl required

TDSchedule microservice url.

'http://localhost:9006'
token required

token for authentication.

'secret-word'
prices required

List of amount to calculate

[ { description: 'some description',
    dateCharge: 'some string data description',
    originalPrice: 203,
    stripePercent: 2.9,
    stripeFlat: 0.3,
    paidUpFee: 5,
    discount: 10,
    payProcessing: false,
    payCollecting: true } ]

Exits

error

An unexpected error occurred.

{ status: 500, message: '*' }
success

OK.

{ status: 200,
  body: 
   { prices: 
      [ { description: 'some description',
          dateCharge: 'some date string',
          owedPrice: 343.44,
          discount: 12,
          originalPrice: 300,
          totalFee: 43.44,
          feePaidUp: 4.2,
          feeStripe: 3.6 } ] } }