CAPI-213: fix legacy template details unmarshaling (#155)

This commit is contained in:
Evgeny Levenets 2017-11-02 18:15:55 +03:00 committed by GitHub
parent 5e6527350d
commit 2055ff7385
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -490,12 +490,12 @@ unmarshal(invoice_template, [1, {domain_InvoiceTemplate,
ID,
OwnerID,
ShopID,
{domain_InvoiceDetails, MarshalledProduct, MarshalledDescription, _},
Details,
Lifetime,
MarshalledCost,
Context
}]) ->
Product = unmarshal(str, MarshalledProduct),
{Product, Description} = unmarshal(details_legacy, Details),
Cost = unmarshal(cost_legacy, MarshalledCost),
#domain_InvoiceTemplate{
id = unmarshal(str, ID),
@ -503,7 +503,7 @@ unmarshal(invoice_template, [1, {domain_InvoiceTemplate,
owner_id = unmarshal(str, OwnerID),
invoice_lifetime = unmarshal(lifetime_legacy, Lifetime),
product = Product,
description = unmarshal(str, MarshalledDescription),
description = Description,
details = construct_invoice_template_details(Product, Cost),
context = hg_content:unmarshal(Context)
};
@ -555,6 +555,11 @@ unmarshal(invoice_template_diff, [1, {payproc_InvoiceTemplateUpdateParams,
context = hg_content:unmarshal(Context)
};
unmarshal(details_legacy, {domain_InvoiceDetails, MarshalledProduct, MarshalledDescription}) ->
{unmarshal(str, MarshalledProduct), unmarshal(str, MarshalledDescription)};
unmarshal(details_legacy, {domain_InvoiceDetails, MarshalledProduct, MarshalledDescription, _}) ->
{unmarshal(str, MarshalledProduct), unmarshal(str, MarshalledDescription)};
unmarshal(details, [<<"cart">>, Cart]) ->
{cart, unmarshal(cart, Cart)};