public void Init()
        {
            InitTestClass();

            request.Verb       = HttpMethod.Post;
            request.RequestUri = $"v2/creditcards/expirationupdates";

            command = new UpdateCreditCardExpirationCommand();
            command.PaymentMethodId = "";
            command.Month           = 5;
            command.Year            = 5828;
        }
Пример #2
0
        public async Task <bool> PostExpirationDate(int ownerId, DateTime date)
        {
            bool ret = false;

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

                // get payment method
                List <PaymentMethod> methods = await GetAccountPaymentMethods(ownerId);

                PaymentMethod method = methods.First();
                if (method.Type == BillingPaymentMethodTypes.CreditCard.ToString())
                {
                    // update date
                    UpdateCreditCardExpirationCommand command = new UpdateCreditCardExpirationCommand();
                    command.PaymentMethodId = method.Id;
                    command.Year            = date.Year;
                    command.Month           = date.Month;

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

                    ret = returnPost.Success;
                }
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
            }
            return(ret);
        }