public async Task <PaymentMethod> PostPaymentMethodsETFS(int ownerId, BillingParameters billingParam)
        {
            PaymentMethod ret = null;
            SaveEftPaymentMethodCommand command = new SaveEftPaymentMethodCommand();

            try
            {
                ownerCollection = testDataManager.GetEnrolledOwnerCollection(ownerId);
                IReadOnlyList <Account> accounts = await GetBillingAccountByPolicyHolderId(ownerCollection.OwnerInformation.UniqueId.ToString());

                command             = GetSaveEftPaymentMethodCommandFromBillingParameter(accounts.First(), billingParam);
                command.AccountName = $"bat{billingParam.BankAccountNameOnAccount}";

                RestRequestSpecification req = new RestRequestSpecification();
                req.Verb        = HttpMethod.Post;
                req.Headers     = Headers;
                req.ContentType = "application/json";
                req.RequestUri  = $"v2/paymentmethods/efts";
                req.Content     = JsonSerializer.Serialize(command);
                var returnPost = await asyncRestClientBilling.ExecuteAsync <string>(req);

                ret = JsonSerializer.Deserialize <PaymentMethod>(returnPost.Value);
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
            }
            return(ret);
        }
        public async Task <List <PaymentMethod> > PostPaymentMethodsAccountEtfs(string accountId)
        {
            List <PaymentMethod> ret = new List <PaymentMethod>();

            try
            {
                SaveEftPaymentMethodCommand command = new SaveEftPaymentMethodCommand();

                RestRequestSpecification req = new RestRequestSpecification();
                req.Verb        = HttpMethod.Post;
                req.Headers     = Headers;
                req.ContentType = "application/json";
                req.Content     = JsonSerializer.Serialize(command);
                req.RequestUri  = $"v2/paymentmethods?accountId={accountId}";
                var returnPost = await asyncRestClientBilling.ExecuteAsync <string>(req);

                if (returnPost.Success)
                {
                    ret = JsonSerializer.Deserialize <List <PaymentMethod> >(returnPost.Value);
                }
                else
                {
                    ret = null;
                }
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
                ret = null;
            }
            return(ret);
        }
        public SaveEftPaymentMethodCommand GetSaveEftPaymentMethodCommandFromBillingParameter(Account account, BillingParameters billingParam)
        {
            SaveEftPaymentMethodCommand ret = new SaveEftPaymentMethodCommand();

            ret.AccountName       = $"518{billingParam.BankAccountNameOnAccount}";
            ret.BankAccountNumber = "632756";
            ret.BankAccountType   = billingParam.BankAccountAccountType == LegacyPlatform.Constants.BankAccountType.Checking ? "Checking" : "Saving";
            ret.BankName          = billingParam.BankAccountBankName;
            ret.BankRoutingNumber = billingParam.BankAccountTransitNumber;
            ret.Currency          = account.Currency;
            //ret.Data = null;
            //ret.DynamicMessage = null;
            ret.IsBillingDefault = false;
            ret.KeyList          = new List <TruFoundation.EnterpriseCatalog.DynamicEntityKey>();
            //ret.MessageInfo = null;
            ret.OriginatingUserId = Guid.NewGuid();
            ret.PartyId           = account.PartyId;
            ret.PaymentMethodId   = Guid.Parse(account.DefaultPaymentMethodId);
            //ret.SensitiveStringProperties = string.Empty;
            ret.Time   = DateTime.UtcNow.ToLocalTime();
            ret.UserId = Guid.NewGuid();
            return(ret);
        }
Exemple #4
0
        public async Task PaymentMethodsETFS_emptyCommand()
        {
            command = new SaveEftPaymentMethodCommand();
            command.PaymentMethodId = Guid.Empty;
            //command.PartyId = BillingApiTestSettings.Default.BillingApiPaymentMethodsEFTSPartyId;
            command.Currency          = string.Empty;
            command.BankRoutingNumber = string.Empty;
            command.BankAccountNumber = string.Empty;
            command.BankAccountType   = string.Empty;
            command.BankName          = string.Empty;
            command.AccountName       = string.Empty;
            //command.IsBillingDefault = true;
            //command.Data = null;
            //command.DynamicMessage = string.Empty;
            command.KeyList = new List <Trupanion.TruFoundation.EnterpriseCatalog.DynamicEntityKey>();
            //command.MessageInfo = string.Empty;
            command.OriginatingUserId = Guid.Empty;
            request.Content           = JsonSerializer.Serialize(command);
            etfsResult = await asyncRestClientBilling.ExecuteAsync <string>(request);

            Assert.IsFalse(etfsResult.Success, $"successed of command is empty");
            Assert.IsTrue(etfsResult.Message.Contains("Supplied string must be non-null and non-whitespace"), $"unexpectedmessage - {etfsResult.Message}");
        }
Exemple #5
0
        public void Init()
        {
            InitTestClass();

            request.Verb       = HttpMethod.Post;
            request.RequestUri = $"v2/paymentmethods/efts";

            command = new SaveEftPaymentMethodCommand();
            command.PaymentMethodId   = BillingApiTestSettings.Default.BillingPaymentMethodsEFFSPOSTPartyId;
            command.PartyId           = BillingApiTestSettings.Default.BillingApiPaymentMethodsEFTSPartyId;
            command.Currency          = "USD";
            command.BankRoutingNumber = "125000024";
            command.BankAccountNumber = "518518";
            command.BankAccountType   = "Checking";
            command.BankName          = "bank account usa tests";
            command.AccountName       = "518 518";
            command.IsBillingDefault  = true;
            command.Data = null;
            //command.DynamicMessage = string.Empty;
            command.KeyList = new List <Trupanion.TruFoundation.EnterpriseCatalog.DynamicEntityKey>();
            //command.MessageInfo = string.Empty;
            command.OriginatingUserId = Guid.NewGuid();
        }