Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #23 from jonasdekeukelaere/invoice-as-sent
Browse files Browse the repository at this point in the history
Invoice as sent
  • Loading branch information
tijsverkoyen authored May 3, 2021
2 parents 22ab865 + 8f87a36 commit ae19f61
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Factr.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,20 @@ public function invoiceSendByMail($id, $to = null, $cc = null, $bcc = null, $sub
return Mail::initializeWithRawData($rawData);
}

/**
* Marking invoice as sent by mail.
*
* @param string $id
* @param string $email
*/
public function invoiceMarkAsSentByMail($id, $email)
{
$parameters = array();
$parameters['by'] = 'mail';
$parameters['to'] = $email;
$this->doCall('invoices/' . (string) $id . '/sent', $parameters, 'POST');
}

/**
* Adding a payment to an invoice.
*
Expand Down
12 changes: 12 additions & 0 deletions Invoice/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class Invoice
*/
protected $discountDescription;

/**
* @var bool
*/
protected $prepareForSending = false;

/**
* @param \SumoCoders\Factr\Client\Client $client
*/
Expand Down Expand Up @@ -394,6 +399,11 @@ public function setDiscountDescription($discountDescription)
return $this;
}

public function prepareForSending()
{
$this->prepareForSending = true;
}

/**
* Initialize the object with raw data
*
Expand Down Expand Up @@ -482,6 +492,8 @@ public function toArray($forApi = false)
foreach ($this->getHistory() as $history) {
$data['history'][] = $history->toArray($forApi);
}
} else {
$data['prepare_for_sending'] = $this->prepareForSending;
}

return $data;
Expand Down

0 comments on commit ae19f61

Please sign in to comment.