API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

VatZone HomeCountry not being set from Debtor_UpdateFromData [bug?]

I can update the VatZone for a debtor through the API just fine when the values EU or Abroad are selected, however when I try to Update a debtor to "HomeCountry" nothing happens.

Is it possible you have a bug that it is not being set back to HomeCountry in the UpdateFromData ?

Please let me know if you have any requests for further information (code/agreement number... ?)
created Apr 18, 2013 by tg24
100% Accept Rate
Q 6 A 3 C 5

1 Answer

Best answer
Please provide some example code that shows the problem. Don't post the agreement number/password, just the integration part of your code where the problem occurs.
answered Apr 25, 2013 by Jostein
selected May 13, 2013 by tg24
Followed is the code  that performs the customer update. There is more to the function, but it is irrelevant since that part of the code works. We have namespaces set up and an implementation of the webservice which allows us (in php) to create objects to pass to the webservice, and ask the webservice instance to communicate.

I've heard from another source that he is experiencing the same problem. You can freely update between EU and Abroad through the API, but setting a customer's VAT zone back to HomeCountry through the API can't be done. Only through the user interface.    

public static function UpdateCustomerData($customer) {
        $ws = WebserviceInstance::getInstance();
        $debtor_handle = new \Economic\DebtorHandle();
        $debtor_handle->Number = $customer->ID;
        $debtor_get_data = new \Economic\Debtor_GetData();
        $debtor_get_data->entityHandle = $debtor_handle;
        $debtor_data = $ws->Debtor_GetData($debtor_get_data);
        $debtor_data = $debtor_data->Debtor_GetDataResult;

        // Set the vatzone
        switch ($customer->vatzone) {
                case "eu":
                    $debtor_data->VatZone = "EU";
                case "international":
                    $debtor_data->VatZone = "Abroad";
                case "domestic":
                    $debtor_data->VatZone = "HomeCountry";
       $debtor_update = new \Economic\Debtor_UpdateFromData();
        $debtor_update->data = $debtor_data;
        $debtor_response = $ws->Debtor_UpdateFromData($debtor_update);
        $debtor_response = $debtor_response->Debtor_UpdateFromDataResult;   
        return $debtor_response;
Thank you, you are right. I have reported this as a bug internally for further processing.
Visma e-conomic A/S