Exemplo n.º 1
0
 public void UpdateCustomerCardInfo(UserSubscriptionsUpdateRequest model)
 {
     DataProvider.ExecuteNonQuery("dbo.UserSubscriptions_UpdateCardInfo",
                                  inputParamMapper: (SqlParameterCollection inputs) =>
     {
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@CustomerId", model.CustomerId, SqlDbType.NVarChar, 50));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@CurrentCard", model.CurrentCard, SqlDbType.NVarChar, 4));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@CardExpMonth", model.CardExpMonth, SqlDbType.Int));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@CardExpYear", model.CardExpYear, SqlDbType.Int));
     });
 }
Exemplo n.º 2
0
        public void UpdateCustomerCard(UserSubscriptionUpdateStripeRequest model)
        {
            StripeConfiguration.SetApiKey("");

            var options = new StripeCustomerUpdateOptions
            {
                SourceToken = model.SourceTokenOrExistingSourceId
            };

            var            customerService = new StripeCustomerService();
            StripeCustomer customer        = customerService.Update(model.CustomerId, options);

            UserSubscriptionsUpdateRequest userSubCardUpdate = new UserSubscriptionsUpdateRequest
            {
                CustomerId   = model.CustomerId,
                CurrentCard  = customer.Sources.Data[0].Card.Last4,
                CardExpMonth = customer.Sources.Data[0].Card.ExpirationMonth,
                CardExpYear  = customer.Sources.Data[0].Card.ExpirationYear
            };

            UpdateCustomerCardInfo(userSubCardUpdate);
        }