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

Commit

Permalink
Add a payment method property
Browse files Browse the repository at this point in the history
  • Loading branch information
StijnVrolijk committed Nov 19, 2019
1 parent 2c7c7f2 commit 483953d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Invoice/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Invoice
/**
* @var string
*/
protected $iid, $state, $description, $shownRemark;
protected $iid, $state, $paymentMethod, $description, $shownRemark;

/**
* @var \DateTime
Expand Down Expand Up @@ -288,6 +288,23 @@ public function getState()
return $this->state;
}

/**
* @param string $paymentMethod Possible payment methods are:
* not_paid, cheque, transfer, bankcontact, cash, direct_debit and paid
*/
public function setPaymentMethod($paymentMethod)
{
$this->paymentMethod = $paymentMethod;
}

/**
* @return string
*/
public function getPaymentMethod()
{
return $this->paymentMethod;
}

/**
* @param float $total
*/
Expand Down Expand Up @@ -391,6 +408,7 @@ public static function initializeWithRawData($data)
if(isset($data['client_id'])) $item->setClientId($data['client_id']);
if(isset($data['iid'])) $item->setIid($data['iid']);
if(isset($data['state'])) $item->setState($data['state']);
if(isset($data['payment_method'])) $item->setPaymentMethod($data['payment_method']);
if(isset($data['generated'])) $item->setGenerated(new \DateTime('@' . strtotime($data['generated'])));
if(isset($data['description'])) $item->setDescription($data['description']);
if(isset($data['shown_remark'])) $item->setShownRemark($data['shown_remark']);
Expand Down Expand Up @@ -433,6 +451,7 @@ public function toArray($forApi = false)
$data = array();
$data['client_id'] = $this->getClientId();
$data['state'] = $this->getState();
$data['payment_method'] = $this->getPaymentMethod();
$data['description'] = $this->getDescription();
$data['shown_remark'] = $this->getShownRemark();
$discount = $this->getDiscount();
Expand Down
1 change: 1 addition & 0 deletions tests/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
$invoice->setDescription('description');
$invoice->setShownRemark('shown_remark');
$invoice->setState('created');
$invoice->setPaymentMethod('not_paid');

try {
// $response = $factr->accountApiToken(USERNAME, PASSWORD);
Expand Down

0 comments on commit 483953d

Please sign in to comment.