Replies: 1 comment
-
I was able to get this to work by not following RetailTransactionServiceUtilities. Assign the following to the dataElement, so it gets into the XML as a string with the channel timezone already applied: DateTimeUtil::toStr(this.ConvertToUTCDateTimeChannelTimeZone(_salesTable.ShippingDateRequested, _rsoTable.RetailChannel)) public utcdatetime ConvertToUTCDateTimeChannelTimeZone(ValidFromDate _date, RefRecId _channelId)
I used the same on the CreatedDatetime to assign a string to the element CreatedDateElementName: On the CRT side the requested delivery date is defined as the following on my CommerceEntity: [DataMember] Then it is assigned to the commerce entity in the CRT using DateTimeOffset.Parse. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I use the XML format, not Json.
If I look at RetailTransactionServiceTransactions on how it populates the XML and use the same logic to get the ShippingDateRequested and the CreatedDatetime, then the XML looks like it is created correctly.
E.g.
RetailTransactionServiceUtilities::dateToDateTimeStringWithOffset(_salesTable.ReceiptDateRequested, _rsqTable.RetailChannel)
RetailTransactionServiceUtilities::utcDateTimeToDateTimeStringWithOffset(_salesTable.CreatedDateTime)
However I cannot find on the CRT side how this XML-string is deserialized and put in a data entity.
When I run my XML-string through the parser and "roXml = (ArrayOfSalesOrderROXml)serializer.Deserialize(memoryStream);" I get the error that the XML is not correctly formed.
And it has to do with "setAttribute('xmlns', RetailTransactionServiceUtilities::getCrtDataModelXmlNamespace())" in my XML-string.
So how should I create the class ArrayOfSalesOrderROXml into which the XML-string is deserialized to accommodate for the datetimeOffset? I can't find an example of it. GetFulfillmentLines returns an XML-string but I can't find the CRT code that actually deserialize it and put it in the Commerce Entity FulFillmentLines.
Any suggestions are much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions