Look for <loan> element in <permissions> node in addition to <loanToken> one

This commit is contained in:
Grégory Soutadé 2022-06-05 13:51:57 +02:00
parent 7b6b1471fe
commit 3d4e6e3918

View File

@ -31,10 +31,23 @@ namespace gourou
node = doc.select_node("/envelope/loanToken/loan").node(); node = doc.select_node("/envelope/loanToken/loan").node();
if (!node) if (node)
EXCEPTION(FFI_INVALID_LOAN_TOKEN, "No loanToken/loan element in document");
properties["id"] = node.first_child().value(); properties["id"] = node.first_child().value();
else
{
node = doc.select_node("/envelope/fulfillmentResult/resourceItemInfo/licenseToken/permissions/display/loan").node();
if (node)
properties["id"] = node.first_child().value();
else
{
node = doc.select_node("/envelope/fulfillmentResult/resourceItemInfo/licenseToken/permissions/play/loan").node();
if (node)
properties["id"] = node.first_child().value();
else
EXCEPTION(FFI_INVALID_LOAN_TOKEN, "No loanToken/loan element in document");
}
}
node = doc.select_node("/envelope/loanToken/operatorURL").node(); node = doc.select_node("/envelope/loanToken/operatorURL").node();
@ -50,6 +63,7 @@ namespace gourou
else else
{ {
node = doc.select_node("/envelope/fulfillmentResult/resourceItemInfo/licenseToken/permissions/play/until").node(); node = doc.select_node("/envelope/fulfillmentResult/resourceItemInfo/licenseToken/permissions/play/until").node();
if (node) if (node)
properties["validity"] = node.first_child().value(); properties["validity"] = node.first_child().value();
else else