Exemplo n.º 1
0
        private async Task ResumeAfterBuildCheckCardNumberFormDialog(IDialogContext context, IAwaitable <CardQuery> result)
        {
            var card = await result;

            // For simulation purpose
            ////await Task.Delay(1000);
            if (!MockHelper.IsValidCardNumber(card.CardNumber))
            {
                context.Done(Resources.USER_DLG_CHECKING_CARD_KO);
                return;
            }

            if (!MockHelper.IsCardWorking(card.CardNumber))
            {
                context.Done(Resources.USER_DLG_CHECKING_CARD_BLOCKED);
                return;
            }

            if (!MockHelper.IsCardNoOverDraft(card.CardNumber))
            {
                context.Done(Resources.USER_DLG_CHECKING_CARD_OVERDRAFT);
                return;
            }
            // Keep the card number for the current conversation
            context.UserData.SetValue(ContextUserConstants.CardNumber, card.CardNumber);
            if (_action == null)
            {
                DialogBase.PromptWithdrawalOrPayment(context, ResumeAfterOperationConfirmed);
            }
            else
            {
                _action(context, ResumeAfterOperationConfirmed);
            }
        }
Exemplo n.º 2
0
        public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var message = await result;

            // First contact
            await context.PostAsync(Resources.BOT_WELCOME);

            // Prompt Issue
            DialogBase.PromptPaymentMode(context, this.ResumeAfterCardIssue);
        }
Exemplo n.º 3
0
        public static void PromptWithdrawalOrPayment(IDialogContext context, ResumeAfter <object> resume)
        {
            List <IssueDataModel> listOperations = new List <IssueDataModel>
            {
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL, Title = Resources.BOT_PROMPT_CARD_ISSUE_WITHDRAWAL
                },
                new IssueDataModel {
                    Issue = ISSUE.CARD_PAYMENT, Title = Resources.BOT_PROMPT_CARD_ISSUE_PAYMENT
                },
            };

            DialogBase.PromptSimpleDialogWithConfirmation(context,
                                                          Resources.BOT_PROMPT_CARD_ISSUE,
                                                          Resources.BOT_PROMPT_TRY_AGAIN_CHOOSE_ISSUE,
                                                          Resources.BOT_PROMPT_TOO_MANY_TRY,
                                                          listOperations,
                                                          resume);
        }
Exemplo n.º 4
0
        public static void PromptDomesticOrAbroad(IDialogContext context, ResumeAfter <object> resume)
        {
            List <IssueDataModel> listOperations = new List <IssueDataModel>
            {
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL_DOMESTIC, Title = Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_DOMESTIC
                },
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL_ABROAD, Title = Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_ABROAD
                },
            };


            DialogBase.PromptSimpleDialogWithConfirmation(context,
                                                          Resources.BOT_PROMPT_ISSUE_WITHDRAWAL,
                                                          Resources.BOT_PROMPT_TRY_AGAIN_CHOOSE_ISSUE,
                                                          Resources.BOT_PROMPT_TOO_MANY_TRY,
                                                          listOperations,
                                                          resume);
        }
        private void PromptIssues(IDialogContext context)
        {
            List <IssueDataModel> listOperations = new List <IssueDataModel>
            {
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL_DOMESTIC_OTHER_ATM_CONTACT_CONS, Title = Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_OTHER_ATM_CONTACT_CONS
                },
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL_DOMESTIC_OTHER_ATM_ORDER_NEW_CARD, Title = Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_OTHER_ATM_ORDER_NEW_CARD
                },
            };


            DialogBase.PromptSimpleDialogWithConfirmation(context,
                                                          Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_OTHER_ATM_CARD_KO,
                                                          Resources.BOT_PROMPT_TRY_AGAIN_CHOOSE_ISSUE,
                                                          Resources.BOT_PROMPT_TOO_MANY_TRY,
                                                          listOperations,
                                                          this.ResumeAfterOperationConfirmed);
        }
Exemplo n.º 6
0
        private void PromptIssuesWithdrawalExceededThreshold(IDialogContext context)
        {
            List <IssueDataModel> listOperations = new List <IssueDataModel>
            {
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL_DOMESTIC_YES_INCREASE_THRESHOLD, Title = Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_YES_INCREASE
                },
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL_DOMESTIC_NO_INCREASE_THRESHOLD, Title = Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_NO_INCREASE_CALL_CONS
                },
            };


            DialogBase.PromptSimpleDialogWithConfirmation(context,
                                                          Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_YESNO,
                                                          Resources.BOT_PROMPT_TRY_AGAIN_CHOOSE_ISSUE,
                                                          Resources.BOT_PROMPT_TOO_MANY_TRY,
                                                          listOperations,
                                                          this.ResumeAfterOperationConfirmed);
        }
Exemplo n.º 7
0
        private void PromptIssuesWithdrawalNotExceededThreshold(IDialogContext context)
        {
            List <IssueDataModel> listOperations = new List <IssueDataModel>
            {
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL_DOMESTIC_OTHER_ATM_YES, Title = Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_OTHER_ATM_YES
                },
                new IssueDataModel {
                    Issue = ISSUE.CARD_WITHDRAWAL_DOMESTIC_OTHER_ATM_NO, Title = Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_OTHER_ATM_NO
                },
            };


            DialogBase.PromptSimpleDialogWithConfirmation(context,
                                                          Resources.BOT_PROMPT_ISSUE_WITHDRAWAL_OTHER_ATM,
                                                          Resources.BOT_PROMPT_TRY_AGAIN_CHOOSE_ISSUE,
                                                          Resources.BOT_PROMPT_TOO_MANY_TRY,
                                                          listOperations,
                                                          this.ResumeAfterOperationConfirmed);
        }
Exemplo n.º 8
0
        public static void PromptPaymentMode(IDialogContext context, ResumeAfter <object> resume)
        {
            List <IssueDataModel> listIssues = new List <IssueDataModel>
            {
                new IssueDataModel {
                    Issue = ISSUE.CARD, Title = Resources.BOT_PROMPT_ISSUE_CARD
                },
                new IssueDataModel {
                    Issue = ISSUE.TRANSFER, Title = Resources.BOT_PROMPT_ISSUE_TRANSFER
                },
                new IssueDataModel {
                    Issue = ISSUE.CHEQUE, Title = Resources.BOT_PROMPT_ISSUE_CHEQUE
                }
            };


            DialogBase.PromptSimpleDialogWithConfirmation(context,
                                                          Resources.BOT_PROMPT_ISSUE,
                                                          Resources.BOT_PROMPT_TRY_AGAIN_CHOOSE_ISSUE,
                                                          Resources.BOT_PROMPT_TOO_MANY_TRY,
                                                          listIssues,
                                                          resume);
        }
Exemplo n.º 9
0
 public async Task StartAsync(IDialogContext context)
 {
     DialogBase.PromptDomesticOrAbroad(context, ResumeAfterOperationConfirmed);
 }