Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Exception during deserialization of the "effectiveStartDate" property of the Subscription entity #30

Closed
moghaddam opened this issue Mar 4, 2019 · 8 comments

Comments

@moghaddam
Copy link

Steps to reproduce

What steps can reproduce the defect?

We've not changed our code but since yesterday we get an exception when we try to suspend a subscription. Seems the value of the effectiveStartDate field in the response doesn't have the Zone while the API expect it to have.

Expected behavior

No exception.

Actual behavior

It throws an exception during the deserialization process in jackson.

Diagnostic logs

Caused by: PartnerApiParsingException: Response: {"id":"BB04FF1E-8ABA-4838-94DD-C40DAE59B9CE","offerId":"5C9FD4CC-EDCE-44A8-8E91-07DF09744609","entitlementId":"","offerName":"Office 365 Business","friendlyName":"One Com CSP Order","quantity":1,"unitType":"Licenses","hasPurchasableAddons":true,"creationDate":"2017-05-02T08:18:30.03Z","effectiveStartDate":"2017-05-02T00:00:00","commitmentEndDate":"2019-05-28T00:00:00","stat
us":"suspended","autoRenewEnabled":true,"isTrial":false,"billingType":"license","billingCycle":"unknown","actions":["Cancel","Edit"],"termDuration":"P1Y","isMicrosoftProduct":true,"suspensionReasons":["CustomerCancellation"],"attentionNeeded":false,"actionTaken":false,"contractType":"subscription","links":{"offer":{"uri":"/offers/5C9FD4CC-EDCE-44A8-8E91-07DF09744609?country=NO","method":"GET","headers":[]},"product":{"uri
":"/customers/{customer-guid}/products/CDD28E44-67E3-425E-BE4C-737FAB2899D3","method":"GET","headers":[]},"sku":{"uri":"/customers/{customer-guid}/products/CDD28E44-67E3-425E-BE4C-737FAB2899D3/skus/5C9FD4CC-EDCE-44A8-8E91-07DF09744609","method":"GET","headers":[]},"availability":{"uri":"/customers{customer-guid}/products/CDD28E44-67E3-425E-BE4C-737FAB2899D3/s
kus/5C9FD4CC-EDCE-44A8-8E91-07DF09744609/availabilities/5C9FD4CC-EDCE-44A8-8E91-07DF09744609","method":"GET","headers":[]},"self":{"uri":"/customers/{customer-guid}/subscriptions/BB04FF1E-8ABA-4838-94DD-C40DAE59B9CE","method":"GET","headers":[]}},"attributes":{"etag":"","objectType":"Subscription"}}
, Base Description: PartnerException: ErrorCategory: RESPONSE_PARSING, ServiceErrorPayload: null, Context: Request Id: 5534c996-1046-4180-b69a-d985ff51ae27, Correlation Id: en-US, Locale: {2}59b05d1b-ac4e-444d-911e-d93b03862b04, Base Description: com.microsoft.store.partnercenter.exception.PartnerResponseParseException: Could not deserialize response. Detailed message: Invalid format: "2017-05-02T00:00:00" is too short
at [Source: (String)"{"id":"BB04FF1E-8ABA-4838-94DD-C40DAE59B9CE","offerId":"5C9FD4CC-EDCE-44A8-8E91-07DF09744609","entitlementId":"","offerName":"Office 365 Business","friendlyName":"One Com CSP Order","quantity":1,"unitType":"Licenses","hasPurchasableAddons":true,"creationDate":"2017-05-02T08:18:30.03Z","effectiveStartDate":"2017-05-02T00:00:00","commitmentEndDate":"2019-05-28T00:00:00","status":"suspended","autoRenewE
nabled":true,"isTrial":false,"billingType":"license","billingCycle":"unknown","actions":["Cancel""[truncated 1048 chars]; line: 1, column: 308] (through reference chain: com.microsoft.store.partnercenter.models.subscriptions.Subscription["effectiveStartDate"])
at com.microsoft.store.partnercenter.network.PartnerServiceProxy.handleResponse(PartnerServiceProxy.java:692)
at com.microsoft.store.partnercenter.network.PartnerServiceProxy.send(PartnerServiceProxy.java:564)
at com.microsoft.store.partnercenter.network.PartnerServiceProxy.patch(PartnerServiceProxy.java:458)
at com.microsoft.store.partnercenter.subscriptions.SubscriptionOperations.patch(SubscriptionOperations.java:287)
at com.one.externalconnectors.csp.subscriptions.UpdateSubscriptionStatus.runScenario(UpdateSubscriptionStatus.java:50)
at com.one.externalconnectors.csp.subscriptions.UpdateSubscriptionStatus.runScenario(UpdateSubscriptionStatus.java:18)
at com.one.externalconnectors.csp.BasePartnerScenario.run(BasePartnerScenario.java:83)
... 149 more
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Invalid format: "2017-05-02T00:00:00" is too short

Environment

We're using the partner center java api version 1.8.1.

@moghaddam
Copy link
Author

In the official documentation of the Subscription resource in Microsoft CSP API, it's mentioned that effectiveStartDate and commitmentEndDate are in UTC time, so probably the date formatter chosen for these two fields should be changed.
As it was working properly until now, it could be due to a change in API response values for these fields (just a guess)

@msize
Copy link

msize commented Mar 4, 2019

I guess it is not issue for Partner Center Java SDK. It is seems relationed with some updates with Azure API end-point. You could submit this report into support of Microsoft.

@ghost
Copy link

ghost commented Mar 4, 2019

Hi @moghaddam,

Can you try the operation again? I just suspended a subscription and captured the request using Fiddler. With my test all three dates were in the correct format

creationDate":"2018-04-25T22:18:33.967Z","effectiveStartDate":"2018-04-25T00:00:00Z","commitmentEndDate":"9999-12-14T00:00:00Z"

So, I am trying to pinpoint what might have caused this with your environment.

@moghaddam
Copy link
Author

Hi @IsaiahWilliams

I tried again just now, it's still the same.

{
  "id": "68CBDD9F-9BD1-4176-9427-A30C4B9EA882",
  "offerId": "5C9FD4CC-EDCE-44A8-8E91-07DF09744609",
  "entitlementId": "",
  "offerName": "Office 365 Business",
  "friendlyName": "Office 365 Business",
  "quantity": 1,
  "unitType": "Licenses",
  "hasPurchasableAddons": true,
  "creationDate": "2019-03-04T09:12:41.18Z",
  "effectiveStartDate": "2019-03-04T00:00:00",
  "commitmentEndDate": "2020-03-28T00:00:00",
  "status": "suspended",
  "autoRenewEnabled": true,
  "isTrial": false,
  "billingType": "license",
  "billingCycle": "unknown",
  "actions": [
    "Cancel",
    "Edit"
  ],
  "termDuration": "P1Y",
  "isMicrosoftProduct": true,
  "attentionNeeded": false,
  "actionTaken": false,
  "contractType": "subscription",
  "links": {
    "offer": {
      "uri": "/offers/5C9FD4CC-EDCE-44A8-8E91-07DF09744609?country=DK",
      "method": "GET",
      "headers": []
    },
    "product": {
      "uri": "/customers/17c82c69-9c71-4551-9cff-5d65bc9f095b/products/CDD28E44-67E3-425E-BE4C-737FAB2899D3",
      "method": "GET",
      "headers": []
    },
    "sku": {
      "uri": "/customers/17c82c69-9c71-4551-9cff-5d65bc9f095b/products/CDD28E44-67E3-425E-BE4C-737FAB2899D3/skus/5C9FD4CC-EDCE-44A8-8E91-07DF09744609",
      "method": "GET",
      "headers": []
    },
    "availability": {
      "uri": "/customers/17c82c69-9c71-4551-9cff-5d65bc9f095b/products/CDD28E44-67E3-425E-BE4C-737FAB2899D3/skus/5C9FD4CC-EDCE-44A8-8E91-07DF09744609/availabilities/5C9FD4CC-EDCE-44A8-8E91-07DF09744609",
      "method": "GET",
      "headers": []
    },
    "self": {
      "uri": "/customers/17c82c69-9c71-4551-9cff-5d65bc9f095b/subscriptions/68CBDD9F-9BD1-4176-9427-A30C4B9EA882",
      "method": "GET",
      "headers": []
    }
  },
  "attributes": {
    "etag": "eyJpZCI6IjY4Y2JkZDlmLTliZDEtNDE3Ni05NDI3LWEzMGM0YjllYTg4MiIsInZlcnNpb24iOjZ9",
    "objectType": "Subscription"
  }
}

@msize
Copy link

msize commented Mar 12, 2019

@moghaddam Could you please say, these issues still present?

@amazo197
Copy link

@moghaddam Could you please say, these issues still present?

yes, it's still present

@ghost
Copy link

ghost commented Mar 22, 2019

Hi @moghaddam, @msize, and @amazo197,

I have modified the way the dates are deserialized with the subscription model. To address the issue I modified the data types from LocalDateTime to DateTime, which means those properties will be represented in UTC now and not the local time. This code has been committed, but we have not pushed out an update to Maven just yet. Our goal is to update the Maven package in the coming days. Once that has been done I will let each of you know.

@ghost
Copy link

ghost commented Mar 22, 2019

Hi @moghaddam, @msize, and @amazo197,

Version 1.12.0 has just been released. This issue has been resolved with that release. I would like to encourage you to update and test. If you encounter any issue please let us know.

@ghost ghost closed this as completed Mar 22, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants