Info |
---|
Object merging is done automatically by the Centinel API. This feature will always occur with all requests and cannot be disabled or behavior changed. |
Examples
Below are examples of how the merging can affect your objects in different ways.
Info |
---|
Remember that all merging types are active at once. The examples are broken out to help explain the different ways things are merged. |
Additive Merge
Additive merging will take unique fields from each object to create a fuller more complete object
Code Block | ||||
---|---|---|---|---|
| ||||
{
"OrderDetails":{
"Amount":1500,
"CurrencyCode": "840"
}
} |
Code Block | ||||
---|---|---|---|---|
| ||||
{
"OrderDetails":{
"OrderDescription":"My new order"
}
} |
Code Block | ||||
---|---|---|---|---|
| ||||
{
"OrderDetails":{
"Amount":1500,
"CurrencyCode": "840",
"OrderDescription":"My new order"
}
} |
Update Merging
Update merging will overwrite stale fields from the JWT order object with the more recent browser object
Code Block | ||||
---|---|---|---|---|
| ||||
{
"OrderDetails":{
"Amount":1500
}
} |
Code Block | ||||
---|---|---|---|---|
| ||||
{
"OrderDetails":{
"Amount":2500
}
} |
Code Block | ||||
---|---|---|---|---|
| ||||
{
"OrderDetails":{
"Amount":2500
}
} |
Real World Example
You may not have all the data when you create the JWT, so most likely your JWT order object will be a bit more sparse than the browser object.
Code Block | ||||
---|---|---|---|---|
| ||||
{
"OrderDetails":{
"Amount":2500,
"CurrencyCode": "840",
"OrderNumber":"sa4lj2kds34SAIu97sde12d3"
},
"Cart":[
{
"Name":"Blue Jeans",
"Quantity":1
}
],
"Consumer":{
"ShippingAddress":{
"FirstName": "John",
"LastName":"Smith",
"Address1":"8100 Tyler Blvd.",
"City": "Mentor",
"State":"Ohio",
"PostalCode":"44060"
}
}
} |
Code Block | ||||
---|---|---|---|---|
| ||||
{
"Consumer":{
"Account":{
"AccountNumber": 4000...0002,
"ExpirationMonth": 01,
"ExpirationYear": 2020,
"NameOnCard":"John Smith"
},
"BillingAddress":{
"FirstName": "John",
"LastName":"Smith",
"Address1":"8100 Tyler Blvd.",
"City": "Mentor",
"State":"Ohio",
"PostalCode":"44060"
},
"ShippingAddress":{
"FirstName": "John",
"LastName":"Smith",
"Address1":"123 Main Street",
"City": "Cleveland",
"State":"Ohio",
"PostalCode":"44091"
}
}
} |
Code Block | ||||
---|---|---|---|---|
| ||||
{
"OrderDetails":{
"Amount":2500,
"CurrencyCode": "840",
"OrderNumber":"sa4lj2kds34SAIu97sde12d3"
},
"Cart":[
{
"Name":"Blue Jeans",
"Quantity":1
}
],
"Consumer":{
"Account":{
"AccountNumber": 4000...0002,
"ExpirationMonth": 01,
"ExpirationYear": 2020,
"NameOnCard":"John Smith"
},
"BillingAddress":{
"FirstName": "John",
"LastName":"Smith",
"Address1":"8100 Tyler Blvd.",
"City": "Mentor",
"State":"Ohio",
"PostalCode":"44060"
},
"ShippingAddress":{
"FirstName": "John",
"LastName":"Smith",
"Address1":"123 Main Street",
"City": "Cleveland",
"State":"Ohio",
"PostalCode":"44091"
}
}
} |