Commit 5e82f76b authored by Karel Slaný's avatar Karel Slaný
Browse files

Try downloading PDZ send information even though recipient search fails.

parent 517c6039
......@@ -591,24 +591,33 @@ void IsdsWrapper::addRecipientIntoModel(const DataboxModelEntry &dbEntry,
switch (errCode) {
case TaskRecipientInfo::TR_SUCCESS:
break;
case TaskRecipientInfo::TR_DB_NOT_OVM_NO_DB_INFO:
case TaskRecipientInfo::TR_DB_UNKN_OVM_UNKN_PDZ:
Dialogues::message(Dialogues::WARNING,
tr("Unknown Message Type"),
tr("No information about the recipient data box '%1' could be obtained. It is unknown whether public or commercial messages can be sent to this recipient.").arg(dbEntry.dbID()),
QString(), Dialogues::OK, Dialogues::OK);
break;
case TaskRecipientInfo::TR_DB_NO_PUBLIC_NO_PDZ:
case TaskRecipientInfo::TR_DB_UNKN_PUBLIC_NO_PDZ:
Dialogues::message(Dialogues::WARNING,
tr("Unknown Message Type"),
tr("No commercial message to the recipient data box '%1' can be sent. It is unknown whether a public messages can be sent to this recipient.").arg(dbEntry.dbID()),
QString(), Dialogues::OK, Dialogues::OK);
break;
case TaskRecipientInfo::TR_DB_UNKNOWN_PUBLIC_NO_PDZ:
case TaskRecipientInfo::TR_DB_NO_PUBLIC_UNKN_PDZ:
Dialogues::message(Dialogues::WARNING,
tr("Unknown Message Type"),
tr("No public message to the recipient data box '%1' can be sent. It is unknown whether a commercial messages can be sent to this recipient.").arg(dbEntry.dbID()),
QString(), Dialogues::OK, Dialogues::OK);
break;
case TaskRecipientInfo::TR_DB_NO_PUBLIC_NO_PDZ:
Dialogues::message(Dialogues::CRITICAL,
tr("Cannot send message"),
tr("No public data message nor a commercial data message (PDZ) can be sent to the recipient data box '%1'.").arg(dbEntry.dbID()),
tr("Receiving of PDZs has been disabled in the recipient data box or there are no available payment methods for PDZs."),
Dialogues::OK, Dialogues::OK);
m_databoxModel->removeEntry(dbEntry.dbID());
return;
break;
case TaskRecipientInfo::TR_DB_NO_ACTIVE:
Dialogues::message(Dialogues::CRITICAL,
tr("Data box is not active"),
......@@ -640,15 +649,6 @@ void IsdsWrapper::addRecipientIntoModel(const DataboxModelEntry &dbEntry,
return;
}
break;
case TaskRecipientInfo::TR_DB_NO_PUBLIC_PDZ_UNKNOWN:
Dialogues::message(Dialogues::CRITICAL,
tr("Cannot send message"),
tr("No public data message nor a commercial data message (PDZ) can be sent to the recipient data box '%1'.").arg(dbEntry.dbID()),
tr("Receiving of PDZs has been disabled in the recipient data box or there are no available payment methods for PDZs."),
Dialogues::OK, Dialogues::OK);
m_databoxModel->removeEntry(dbEntry.dbID());
return;
break;
default:
m_databoxModel->removeEntry(dbEntry.dbID());
return;
......
......@@ -188,8 +188,9 @@ enum TaskRecipientInfo::Result TaskRecipientInfo::recipientInfo(
recipDbType= dbType2Str(foundBoxes.at(0).dbType());
/* Test if recipient data box is OVM or sub-OVM */
recipDbEffectiveOVM = (entry.dbType() < Isds::Type::BT_PO)
? Isds::Type::BOOL_TRUE : Isds::Type::BOOL_FALSE;
recipDbEffectiveOVM =
((Isds::Type::BT_NULL < entry.dbType()) && (entry.dbType() < Isds::Type::BT_PO))
? Isds::Type::BOOL_TRUE : Isds::Type::BOOL_FALSE;
} else if (foundBoxes.isEmpty()) {
......@@ -197,8 +198,12 @@ enum TaskRecipientInfo::Result TaskRecipientInfo::recipientInfo(
/* No data box found. */
return TR_DB_NOT_EXISTS;
} else {
/* Search error. */
return TR_DB_SEARCH_ERROR;
/*
* Search error -- maybe because of insufficient
* privileges.
* Try downloading PDZ sending information instead
* of exiting here.
*/
}
} else {
......@@ -219,14 +224,15 @@ enum TaskRecipientInfo::Result TaskRecipientInfo::recipientInfo(
bool canSendNormal = sendPublic;
enum Isds::Type::Error error = Isds::pdzSendInfo(*session, dbID,
Isds::Type::PMT_NORMAL, canSendNormal, Q_NULLPTR, &lastError);
if (error == Isds::Type::ERR_SUCCESS && canSendNormal) {
Isds::pdzSendInfo(*session, dbID, Isds::Type::PMT_INIT,
canSendInitiatoryPDZ, Q_NULLPTR, &lastError);
if (error == Isds::Type::ERR_SUCCESS) {
canSendNormalPDZ = canSendNormal ?
Isds::Type::BOOL_TRUE : Isds::Type::BOOL_FALSE;
if (canSendNormal) {
Isds::pdzSendInfo(*session, dbID, Isds::Type::PMT_INIT,
canSendInitiatoryPDZ, Q_NULLPTR, &lastError);
}
}
canSendNormalPDZ = canSendNormal ? Isds::Type::BOOL_TRUE
: Isds::Type::BOOL_FALSE;
dmTypes = setPossiblePdzPaymentMethods(pdzInfos,
canSendNormal, canSendInitiatoryPDZ, canUseInitReply);
}
......@@ -239,14 +245,14 @@ enum TaskRecipientInfo::Result TaskRecipientInfo::recipientInfo(
* I'm not OVM and I could not download any information about
* the recipient.
*/
result = TR_DB_NOT_OVM_NO_DB_INFO;
result = TR_DB_UNKN_OVM_UNKN_PDZ;
} else if ((recipDbEffectiveOVM == Isds::Type::BOOL_NULL) &&
(canSendNormalPDZ == Isds::Type::BOOL_FALSE)) {
/*
* Don't know whether I can send public and I cannot send PDZs.
*/
result = TR_DB_UNKNOWN_PUBLIC_NO_PDZ;
result = TR_DB_UNKN_PUBLIC_NO_PDZ;
} else if ((recipDbEffectiveOVM == Isds::Type::BOOL_FALSE) &&
(canSendNormalPDZ == Isds::Type::BOOL_NULL)) {
......@@ -254,13 +260,12 @@ enum TaskRecipientInfo::Result TaskRecipientInfo::recipientInfo(
* Cannot send public message and don't know whether I can send
* PDZs.
*/
result = TR_DB_NO_PUBLIC_PDZ_UNKNOWN;
result = TR_DB_NO_PUBLIC_UNKN_PDZ;
} else if ((recipDbEffectiveOVM == Isds::Type::BOOL_FALSE) &&
(canSendNormalPDZ == Isds::Type::BOOL_FALSE)) {
/* I cannot send a public nor a commercial message. */
result = TR_DB_NO_PUBLIC_NO_PDZ;
canSendNormalPDZ = Isds::Type::BOOL_NULL;
}
dbEntry.setDbName(recipName);
......
......@@ -45,10 +45,10 @@ public:
TR_DB_NO_ACTIVE, /*!< Recipient data box is not active. */
TR_DB_NOT_EXISTS, /*!< Recipient data box does not exists. */
TR_DB_SEARCH_ERROR, /*!< Recipient data box search error. */
TR_DB_NOT_OVM_NO_DB_INFO, /*!< Recipient data box info error. */
TR_DB_NO_PUBLIC_NO_PDZ, /*!< Data box no PDZ nor public. */
TR_DB_UNKNOWN_PUBLIC_NO_PDZ, /*!< Data box only DPZ, public unknown. */
TR_DB_NO_PUBLIC_PDZ_UNKNOWN, /*!< Data box only public, PDZ unknown. */
TR_DB_UNKN_OVM_UNKN_PDZ, /*!< No information about OVM or PDZ. */
TR_DB_UNKN_PUBLIC_NO_PDZ, /*!< No information about OVM, no PDZ. */
TR_DB_NO_PUBLIC_UNKN_PDZ, /*!< No OVM, no information about PDZ. */
TR_DB_NO_PUBLIC_NO_PDZ, /*!< No OVM, no PDZ. */
TR_ERR /*!< Other internal error. */
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment