Skip to content

Commit

Permalink
added new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Train committed Nov 6, 2019
1 parent 09a5ad6 commit 8bee0e9
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion src/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Customer extends BaseObject
use Operations\Update;
use Operations\Delete;

/*
/**
* Sends a PDF statement to the customer
*
* @param array $params
Expand All @@ -27,6 +27,42 @@ public function sendStatement(array $params = [], array $opts = [])
return Util::buildObjects($email, $response['body']);
}

/**
* Sends a PDF statement to the customer by SMS
*
* @param array $params
* @param array $opts
*
* @return array(Invoiced\TextMessage)
*/
public function sendStatementSMS(array $params = [], array $opts = [])
{
$response = $this->_client->request('post', $this->getEndpoint().'/text_messages', $params, $opts);

// build text message objects
$textMessage = new TextMessage($this->_client);

return Util::buildObjects($textMessage, $response['body']);
}

/**
* Sends a statement to the customer by mail
*
* @param array $params
* @param array $opts
*
* @return array(Invoiced\Letter)
*/
public function sendStatementLetter(array $params = [], array $opts = [])
{
$response = $this->_client->request('post', $this->getEndpoint().'/letters', $params, $opts);

// build letter objects
$letter = new Letter($this->_client);

return Util::buildObjects($letter, $response['body']);
}

/**
* Gets the customer's current balance.
*
Expand All @@ -53,6 +89,19 @@ public function contacts()
return $line;
}

/**
* Gets a note object for this customer.
*
* @return Note
*/
public function listNotes()
{
$line = new Note($this->_client);
$line->setEndpointBase($this->getEndpoint());

return $line;
}

/**
* Gets a line item object for this customer.
*
Expand Down Expand Up @@ -83,4 +132,21 @@ public function invoice(array $params = [], array $opts = [])

return Util::convertToObject($invoice, $response['body']);
}

/**
* Creates a consolidated invoice for this customer.
*
* @param array $params
*
* @return Invoice
*/
public function consolidateInvoices(array $params = [])
{
$response = $this->_client->request('post', $this->getEndpoint().'/consolidate_invoices', $params);

// build invoice object
$invoice = new Invoice($this->_client);

return Util::convertToObject($invoice, $response['body']);
}
}

0 comments on commit 8bee0e9

Please sign in to comment.