public UpdateCustomerMobileCreditCardResponse AddMobileCustomerCreditCard(CustomerCreditCards customer, string token) { UpdateCustomerMobileCreditCardResponse result = null; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "CustomerMobile/AddMobileCustomerCreditCard"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var myContent = JsonConvert.SerializeObject(customer); var buffer = Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = client.PostAsync(client.BaseAddress, byteContent).Result; if (response.IsSuccessStatusCode) { var responseStream = response.Content.ReadAsStringAsync().Result; result = JsonConvert.DeserializeObject <UpdateCustomerMobileCreditCardResponse>(responseStream); } } } catch (Exception ex) { throw ex; } return(result); }
/// <summary> /// Checks if the Customer CreditCard expired /// </summary> public static bool IsCredirCardExpired(CustomerCreditCards creditCard) { if (null == creditCard) { throw new ArgumentNullException("creditCard"); } DateTime today = DateTime.Today; return(!(creditCard.ccExpireDateSpecified && ((creditCard.ccExpireDate.Year > today.Year) || ((creditCard.ccExpireDate.Year == today.Year) && (creditCard.ccExpireDate.Month >= today.Month))))); }
public UpdateCustomerMobileCreditCardResponse AddMobileCustomerCreditCard(CustomerCreditCards customer, string token) { UpdateCustomerMobileCreditCardResponse response = new UpdateCustomerMobileCreditCardResponse(); try { response = customerService.AddMobileCustomerCreditCard(customer, token); } catch (Exception ex) { throw ex; } return(response); }
public AddPaymentMethodPage() { InitializeComponent(); token = App.Current.Properties["currentToken"].ToString(); customerCreditCards = new CustomerCreditCards(); cardResponse = null; //List<string> cardTypes = Enum.GetValues(typeof(CreditCardType)).Cast<CreditCardType>().Select(t => t.ToString()).ToList(); List <string> cardTypes = new List <string>() { "Visa", "Mastercard", "American Express", "Discover" }; CardTypePicker.ItemsSource = cardTypes; On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); }
private UpdateCustomerMobileCreditCardResponse addCreditCard(CustomerCreditCards customerCreditCards, string token) { CustomerController controller = new CustomerController(); return(controller.AddMobileCustomerCreditCard(customerCreditCards, token)); }