Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assigning DefaultCommercialMailAddress & DefaultStatusUpdatesMailAddress does not work. #85

Open
StanProg opened this issue Oct 8, 2024 · 0 comments

Comments

@StanProg
Copy link

StanProg commented Oct 8, 2024

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('[email protected]');

$customer = new Customer();
$customer->setEmail('[email protected]');
$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: "[email protected]"
    }
    -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":"[email protected]",
      "LanguageId":3,
      "DefaultMailAddress":{
         "Id":0,
         "TypeId":1,
         "TypeName":"",
         "SubType":"",
         "Value":"[email protected]"
      },
      "DefaultCommercialMailAddress":{
         "Id":0,
         "TypeId":1,
         "TypeName":"",
         "SubType":"",
         "Value":"[email protected]"
      },
      "DefaultStatusUpdatesMailAddress":{
         "Id":0,
         "TypeId":1,
         "TypeName":"",
         "SubType":"",
         "Value":"[email protected]"
      },
      "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: "[email protected]"
    }
    -defaultCommercialMailAddress: null
    -defaultStatusUpdatesMailAddress: null
    -metaData: array:1 [
      0 => BillbeeDe\BillbeeAPI\Model\CustomerMetaData^ {#2895
        -id: 93462077
        -typeId: 1
        -typeName: "EMail"
        -subType: ""
        -value: "[email protected]"
      }
    ]
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant