Skip to content

Commit

Permalink
Added UpdateEntryDetails and pass city to Acumulus
Browse files Browse the repository at this point in the history
  • Loading branch information
Wouter0100 committed Apr 11, 2018
1 parent 3aeff77 commit 0d962b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Thalent/AcumulusPhp/InvoiceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public function build() {
$customer->addChild('address2', $this->customer->getContactaddress2());
$customer->addChild('postalcode', $this->customer->getContactpostalcode());
$customer->addChild('countrycode', $this->customer->getContactcountrycode());
$customer->addChild('city', $this->customer->getContactcity());
$customer->addChild('vatnumber', $this->customer->getContactvatnumber());
$customer->addChild('telephone', $this->customer->getContacttelephone());
$customer->addChild('fax', $this->customer->getContactfax());
Expand Down
21 changes: 21 additions & 0 deletions src/Thalent/AcumulusPhp/Providers/EntriesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,25 @@ public function getEntryDetails($entry_id)

return $this;
}

public function updateEntryDetails($entry_id, $paymentstatus = 1, $paymentdate = null, $accountnumber = null)
{
if($paymentdate === null) {
$paymentdate = date('Y-m-d');
}

// Validate paymentdate before sending it off
$datetime = \DateTime::createFromFormat("Y-m-d", $paymentdate);
if (!$datetime and $datetime->format('Y-m-d') !== $paymentdate) {
throw new ValidationErrorException("Paymentdate should be in YYYY-MM-DD format");
}

$this->apiCall = 'entry/entry_update.php';
$this->xmlPayload .= sprintf('<entryid>%s</entryid>', $entry_id);
$this->xmlPayload .= sprintf('<paymentstatus>%d</paymentstatus>', $paymentstatus);
$this->xmlPayload .= sprintf('<paymentdate>%s</paymentdate>', $paymentdate);
$this->xmlPayload .= sprintf('<accountnumber>%s</accountnumber>', $accountnumber);

return $this;
}
}

0 comments on commit 0d962b1

Please sign in to comment.