balanced / balanced-dashboard

The Balanced dashboard.
https://dashboard.balancedpayments.com/
Other
2.29k stars 385 forks source link

Use new invoicing schema to get invoice charges #1627

Open mjallday opened 9 years ago

mjallday commented 9 years ago

This is required since we are going to start providing more granular charges and additional dimensions.

Currently the invoice returns data using a set of attributes per charge. e.g.

{
         "card_credits_total_fee":0,
         "bank_account_debit_variable_fee_cap":500,
         "refunds_count":0,
         "bank_account_debits_total_amount":0,
}

This is unwieldy so I've changed it to return a fees collection and each item within this array has a standard set of attributes

{
    "fees":[
            {
               "count":0,
               "total_fee":0,
               "variable_fee_cap":500,
               "name":"bank_account_debits",
               "variable_fee_percentage":1.0,
               "fixed_fee":30,
               "total_amount":0
            },
    ]
}

hopefully it should now be as simple as iterating over this list of fees in order to render the invoice charges.

e.g. (var fee in fees) { print fee.name; }