From 0d962b1a6b0a8b0107a657b8ea0b8b434cd93aa2 Mon Sep 17 00:00:00 2001 From: Wouter van Os Date: Wed, 11 Apr 2018 12:59:37 +0200 Subject: [PATCH] Added UpdateEntryDetails and pass city to Acumulus --- src/Thalent/AcumulusPhp/InvoiceBuilder.php | 1 + .../AcumulusPhp/Providers/EntriesProvider.php | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Thalent/AcumulusPhp/InvoiceBuilder.php b/src/Thalent/AcumulusPhp/InvoiceBuilder.php index 529ebaf..a3161fb 100644 --- a/src/Thalent/AcumulusPhp/InvoiceBuilder.php +++ b/src/Thalent/AcumulusPhp/InvoiceBuilder.php @@ -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()); diff --git a/src/Thalent/AcumulusPhp/Providers/EntriesProvider.php b/src/Thalent/AcumulusPhp/Providers/EntriesProvider.php index 90306ca..e3641ad 100644 --- a/src/Thalent/AcumulusPhp/Providers/EntriesProvider.php +++ b/src/Thalent/AcumulusPhp/Providers/EntriesProvider.php @@ -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('%s', $entry_id); + $this->xmlPayload .= sprintf('%d', $paymentstatus); + $this->xmlPayload .= sprintf('%s', $paymentdate); + $this->xmlPayload .= sprintf('%s', $accountnumber); + + return $this; + } }