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

Commit

Permalink
1.0.5 release
Browse files Browse the repository at this point in the history
- Clean up and add additional, likely redundant error checks for pull
request #1
  • Loading branch information
Cherry committed Oct 11, 2016
1 parent 788ac0d commit 87fe30c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion stripe_plus_gateway/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.4",
"version": "1.0.5",
"name": "Stripe Plus",
"description": "Forked version of the official Stripe gateway which includes updated offsite storage and ACH payments.",
"authors": [
Expand Down
16 changes: 10 additions & 6 deletions stripe_plus_gateway/stripe_plus_gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ private function removeSource($client_reference_id, $account_reference_id) {
$this->loadApi();
$result = false;
$logUrl = "customers/" . $client_reference_id . "/sources/" . $account_reference_id;
$request = [];
$request = array();
try {
$stripe_customer = $result = \Stripe\Customer::retrieve($client_reference_id);
$source = $stripe_customer->sources->retrieve($account_reference_id);
Expand Down Expand Up @@ -1022,20 +1022,24 @@ private function formatAmount($amount, $currency) {
* @return string Statement description of invoice(s)
*/
private function createDescription($invoice_amounts) {
Loader::loadModels($this, array("Invoices"));
if(!isset($this->Invoices))
Loader::loadModels($this, array("Invoices"));

$desc = "";
if (count($invoice_amounts) > 1) {
$ids = array();
foreach($invoice_amounts as $invoice) {
$ids[] = $this->Invoices->get($invoice['invoice_id'])->id_code;
foreach($invoice_amounts as $invoice) {
$invoice_data = $this->Invoices->get($invoice['invoice_id']);
$ids[] = $invoice_data ? $invoice_data->id_code : $invoice['invoice_id'];
}
$desc = "Invoices " . join(", ", $ids);
if (strlen($desc) > 22) {
$desc = "Multi-invoice payment";
}
}
elseif(count($invoice_amounts) === 1) {
$desc = "Invoice " . $this->Invoices->get($invoice_amounts[0]['invoice_id'])->id_code;
$invoice_data = $this->Invoices->get($invoice['invoice_id']);
$desc = "Invoice " . $invoice_data ? $invoice_data->id_code : $invoice['invoice_id'];
if (strlen($desc) > 22) {
$desc = "Invoice payment";
}
Expand All @@ -1044,7 +1048,7 @@ private function createDescription($invoice_amounts) {
}
return $desc;
}

/**
* Helper function to generate single name from parts
*
Expand Down

0 comments on commit 87fe30c

Please sign in to comment.