예제 #1
0
        private void attachLinkedCard()
        {
            checkCredentials();
            var    currency     = rb_RUB.Checked ? Currency.RUB : Currency.VND;
            string acquirerCode = null;

            if (m_AuthResult != null && m_AuthResult.ErrorCode == 0 && m_AuthResult.Account != null)
            {
                var acquirersByMethod = m_AuthResult.Account.AcquirersByMethods;
                if (acquirersByMethod != null && acquirersByMethod.Count != 0)
                {
                    if (acquirersByMethod.ContainsKey(PaymentMethod.Card))
                    {
                        var acquirers = acquirersByMethod[PaymentMethod.Card];
                        if (acquirers.Count == 1)
                        {
                            acquirerCode = acquirers.First().Key;
                        }
                        else
                        {
                            int index = Utils.ShowDialog(acquirers.Values.ToList(), "Select acquirer");
                            acquirerCode = acquirers.Keys.ToList()[Math.Max(0, index)];
                        }
                    }
                }
            }
            try
            {
                m_PaymentController.AddLinkedCard(currency, acquirerCode);
                log(DIVIDER);
                log("STARTING LINKED CARD ATTACH");
            }
            catch (InvalidOperationException e)
            {
                log(string.Format("ERROR : {0}", e.Message));
                return;
            }
        }