Skip to content

Assigning DefaultCommercialMailAddress & DefaultStatusUpdatesMailAddress does not work. #85

Description

@StanProg

Problem

The problem is that when I build the order Object I see DefaultCommercialMailAddress & DefaultCommercialMailAddress set correctly, regardless if the email is the same with one CustomerMetaData object 9like on the sample code below), or I pass 3 different instances of CustomerMetaData with different emails.

Result

DefaultCommercialMailAddress & DefaultCommercialMailAddress are null at the returned object from the createObject response
image

Expected result

I expect both email addresses to be set.

Code

Note" I've skipped in the code below the unrelated Customer & Order methods

use BillbeeDe\BillbeeAPI\Model\Customer;
use BillbeeDe\BillbeeAPI\Model\CustomerMetaData;
use BillbeeDe\BillbeeAPI\Model\Order;
...

$customerMetaData = new CustomerMetaData();
$customerMetaData->setTypeId(CustomerMetaData::TYPE_MAIL);
$customerMetaData->setValue('info@email.com');

$customer = new Customer();
$customer->setEmail('info@email.com');
$customer->setDefaultMailAddress($customerMetaData);
// the next 2 are set to null when the order is created
$customer->setDefaultCommercialMailAddress($customerMetaData);
$customer->setDefaultStatusUpdatesMailAddress($customerMetaData);

$order = new Order();
$order->setCustomer($customer);

build Order object

  +customer: BillbeeDe\BillbeeAPI\Model\Customer^ {#2539
    -defaultMailAddress: BillbeeDe\BillbeeAPI\Model\CustomerMetaData^ {#2522
      -id: 0
      -typeId: 1
      -typeName: ""
      -subType: ""
      -value: "info@email.com"
    }
    -defaultCommercialMailAddress: BillbeeDe\BillbeeAPI\Model\CustomerMetaData^ {#2522}
    -defaultStatusUpdatesMailAddress: BillbeeDe\BillbeeAPI\Model\CustomerMetaData^ {#2522}
    -metaData: []
  }

serialized data of Customer

This is the data passed to the Customer of the Order that is passed in CustomerEndpoint::createCustomer() which calls the client post() method.

   "Customer":{
      "Name":"My Company GmbH",
      "Email":"info@email.com",
      "LanguageId":3,
      "DefaultMailAddress":{
         "Id":0,
         "TypeId":1,
         "TypeName":"",
         "SubType":"",
         "Value":"info@email.com"
      },
      "DefaultCommercialMailAddress":{
         "Id":0,
         "TypeId":1,
         "TypeName":"",
         "SubType":"",
         "Value":"info@email.com"
      },
      "DefaultStatusUpdatesMailAddress":{
         "Id":0,
         "TypeId":1,
         "TypeName":"",
         "SubType":"",
         "Value":"info@email.com"
      },
      "MetaData":[
         
      ]
   },

created Order object

  +customer: BillbeeDe\BillbeeAPI\Model\Customer^ {#3062
    +id: 20000000068747997
    +number: 167559
    -type: 1
    -defaultMailAddress: BillbeeDe\BillbeeAPI\Model\CustomerMetaData^ {#2898
      -id: 93462077
      -typeId: 1
      -typeName: "EMail"
      -subType: ""
      -value: "info@email.com"
    }
    -defaultCommercialMailAddress: null
    -defaultStatusUpdatesMailAddress: null
    -metaData: array:1 [
      0 => BillbeeDe\BillbeeAPI\Model\CustomerMetaData^ {#2895
        -id: 93462077
        -typeId: 1
        -typeName: "EMail"
        -subType: ""
        -value: "info@email.com"
      }
    ]
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions