Skip to content
This repository has been archived by the owner on Apr 13, 2020. It is now read-only.

Commit

Permalink
Add Invoice Number to stripe statement description
Browse files Browse the repository at this point in the history
  • Loading branch information
naja7host authored Sep 25, 2016
1 parent 646f48d commit ef85c3a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions stripe_plus_gateway/stripe_plus_gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -1022,17 +1022,29 @@ private function formatAmount($amount, $currency) {
* @return string Statement description of invoice(s)
*/
private function createDescription($invoice_amounts) {
Loader::loadModels($this, array("Invoices"));
$desc = "";
if (count($invoice_amounts) > 1) {
$desc = "Multi-invoice payment";
$ids = array();
foreach($invoice_amounts as $invoice) {
$ids[] = $this->Invoices->get($invoice['invoice_id'])->id_code;
}
$desc = "Invoices " . join(", ", $ids);
if (strlen($desc) > 22) {
$desc = "Multi-invoice payment";
}
}
elseif(count($invoice_amounts) === 1) {
$desc = "Invoice payment";
$desc = "Invoice " . $this->Invoices->get($invoice_amounts[0]['invoice_id'])->id_code;
if (strlen($desc) > 22) {
$desc = "Invoice payment";
}
}else{ // no invoice amounts passed, must be a credit deposit
$desc = 'Payment Credit';
}
return $desc;
}

/**
* Helper function to generate single name from parts
*
Expand All @@ -1053,4 +1065,4 @@ private function getCustomerName($source_info, $default="") {
}
return $name;
}
}
}

0 comments on commit ef85c3a

Please sign in to comment.