xolphin / xolphin-api-php

Xolphin API module for PHP
8 stars 16 forks source link

`getMessage` will throw an exception when requesting certificate on test env #18

Closed vdhicts closed 4 years ago

vdhicts commented 4 years ago

When requesting a certificate the test env returns this data:

Xolphin\Responses\Request {#730 ▼
  +id: 960000000
  +domainName: "test1.ssl-test.nl"
  +subjectAlternativeNames: []
  +years: 1
  +company: "Xolphin B.V."
  +dateOrdered: DateTime @1463757971 {#780 ▶}
  +validations: array:2 [▶]
  +department: "Support"
  +address: null
  +zipcode: null
  +city: "Heerhugowaard"
  +province: "Noord-Holland"
  +country: "NL"
  +reference: null
  +approverFirstName: null
  +approverLastName: null
  +approverEmail: "admin@ssl-test.nl"
  +approverPhone: null
  +kvk: null
  +product: Xolphin\Responses\Product {#764 ▶}
  +requiresAction: false
  +brandValidation: false
  +notes: []
  -message: null
  -errors: null
  +page: null
  +limit: null
  +pages: null
  +total: null
  #_embedded: {#767 ▶}
}

The method getMessage on the Xolphin\Responses\Request class is inhereted from Xolphin\Responses\Base. In this example the message is null, but the getMessage method has a string as return value defined, see: https://github.com/xolphin/xolphin-api-php/blob/d8610720f80948ab4fb3f1f0310782dfe823155f/src/Responses/Base.php#L76

This will throw an exception. I didn't expect an exception, as the getMessage description is: Information about current request. So it seems its not tied to a error response.

I'm not sure if this is a problem with the response of the test env, or if the code could use an update. when its the code, I would like to suggest two options:

If you appreciate it, I can make a PR for this, but I would like to discuss this first.

ghost commented 4 years ago

The issue has been resolved in version 2.0.1. Thanks for your report and suggestion.