Jump to content

srn

Members
  • Posts

    31
  • Joined

Posts posted by srn

  1. Partial refund support is a requirement for us with any payment provider.

     

    http://www.blesta.com/forums/index.php?/topic/1596-partial-refund/ suggests a full refund and then another charge for the same amount. But this second charge may require explicit authorization by the customer, and there's no guarantee they'll take the time to do it.

     

    Partial refund support from within blesta would greatly streamline the customer support workflow.

  2. Example API call:

     

    php /var/www/index.php api/invoices/edit.json -u <user> -k <key> -m POST -p invoice_id=<invoice_id>&vars%5Blines%5D%5B0%5D%5Bid%5D=<invoice_line_id>

     

    Expected behavior:

     

    Line item is deleted from invoice.

     

    Actual behavior:

     

    Failure due to an empty description for the line item

     

    The below patch allows the line item to be deleted.

     

    diff --git a/app/models/invoices.php b/app/models/invoices.php
    index 30e6925..7ce7fe6 100644
    --- a/app/models/invoices.php
    +++ b/app/models/invoices.php
    @@ -387,6 +387,8 @@ class Invoices extends AppModel {
             // No lines set, no descriptions required
             if (!isset($vars['lines'])) {
                 $vars['lines'] = array();
    +        }
    +        if(empty($vars['lines'])) {
                 $line_rules['lines[][description]']['empty']['if_set'] = true;
             }
             // If status is proforma, but changing to active, amounts are likely applied, and the amount applied rule can be ignored
    @@ -447,7 +449,7 @@ class Invoices extends AppModel {
                         $this->addDelivery($invoice_id, array('method'=>$vars['delivery'][$i]), $vars['client_id']);
                 }
                 
    -            if (!empty($vars['lines'])) {
    +            if (!empty($vars['lines']) || !empty($delete_items)) {
                     // Get the tax rules
                     $tax_rules = $this->getTaxRules($invoice->client_id);
                     
    @@ -523,7 +525,7 @@ class Invoices extends AppModel {
                         $this->unsetMeta($invoice_id);
                 }
                 
    -            if (!empty($vars['lines'])) {
    +            if (!empty($vars['lines']) || !empty($delete_items)) {
                     // Update totals/set closed status
                     $this->setClosed($invoice_id);
                 }
     

  3. It is not uncommon for people to accidentally check in sensitive information such as database logins and API keys (x-ref http://arstechnica.com/security/2015/03/ubers-epic-db-blunder-is-hardly-an-exception-github-is-awash-in-passwords/) and the blesta encryption key is almost as sensitive. I think there should really be a script that uses the old key and a newly generated key and descrypts/re-encrypts the data in the database.

×
×
  • Create New...