/// <summary> /// Processes the user response (click of button on dialog) to a PendingSubscriptionAuthorizationDialog. /// --- Ignore: does nothing. /// --- Report Fraud: sends fraud report to Gloebit /// --- Authorize: Delivers authorization link to user /// </summary> /// <param name="client">IClientAPI of sender of response</param> /// <param name="chat">response sent</param> protected override void ProcessResponse(IClientAPI client, OSChatMessage chat) { switch (chat.Message) { case "Ignore": // User actively ignored. remove from our message listener break; case "Respond": // Resend authorization link string subscriptionIDStr = SubscriptionID.ToString(); string apiUrl = apiW.m_url.ToString(); GloebitSubscription sub = GloebitSubscription.GetBySubscriptionID(subscriptionIDStr, apiUrl); // TODO: Do we need to check if this is null? Shouldn't happen. // Send Authorize URL apiW.AuthorizeSubscription(client.AgentId, SubscriptionAuthorizationID.ToString(), sub, false); break; case "Report Fraud": // Report to Gloebit // TODO: fire off fraud report to Gloebit break; default: m_log.ErrorFormat("[GLOEBITMONEYMODULE] PendingSubscriptionAuthorizationDialog.ProcessResponse Received unexpected dialog response message:{0}", chat.Message); break; } }
/// <summary> /// Processes the user response (click of button on dialog) to a CreateSubscriptionAuthorizationDialog. /// --- Ignore: does nothing. /// --- Report Fraud: sends fraud report to Gloebit /// --- Authorize: Creates pending authorization subscription for this user and the referenced subscription /// </summary> /// <param name="client">IClientAPI of sender of response</param> /// <param name="chat">response sent</param> protected override void ProcessResponse(IClientAPI client, OSChatMessage chat) { switch (chat.Message) { case "Ignore": // User actively ignored. remove from our message listener break; case "Authorize": // Create authorization string subscriptionIDStr = SubscriptionID.ToString(); string apiUrl = apiW.m_url.ToString(); GloebitSubscription sub = GloebitSubscription.GetBySubscriptionID(subscriptionIDStr, apiUrl); // IF null, there was a db error on storing this -- test store functions for db impl if (sub == null) { string msg = String.Format("[GLOEBITMONEYMODULE] CreateSubscriptionAuthorizationDialog.ProcessResponse Could not retrieve subscription. Likely DB error when storing subID:{0}", subscriptionIDStr); m_log.Error(msg); throw new Exception(msg); } apiW.AuthorizeSubscription(AgentID, String.Empty, sub, false); break; case "Report Fraud": // Report to Gloebit // TODO: fire off fraud report to Gloebit break; default: m_log.ErrorFormat("[GLOEBITMONEYMODULE] CreateSubscriptionAuthorizationDialog.ProcessResponse Received unexpected dialog response message:{0}", chat.Message); break; } }