Exemple #1
0
 void ICreditCard.AddParametersToRequest(RestRequest request)
 {
     request.AddParameter("card[number]", Number);
     request.AddParameter("card[exp_month]", ExpMonth);
     request.AddParameter("card[exp_year]", ExpYear);
     if (Cvc.HasValue())
     {
         request.AddParameter("card[cvc]", Cvc);
     }
     if (Name.HasValue())
     {
         request.AddParameter("card[name]", Name);
     }
     if (AddressLine1.HasValue())
     {
         request.AddParameter("card[address_line1]", AddressLine1);
     }
     if (AddressLine2.HasValue())
     {
         request.AddParameter("card[address_line2]", AddressLine2);
     }
     if (AddressZip.HasValue())
     {
         request.AddParameter("card[address_zip]", AddressZip);
     }
     if (AddressState.HasValue())
     {
         request.AddParameter("card[address_state]", AddressState);
     }
     if (AddressCountry.HasValue())
     {
         request.AddParameter("card[address_country]", AddressCountry);
     }
 }
Exemple #2
0
 void IObjectValidation.AddParametersToRequest(RestRequest request)
 {
     if (Token.HasValue())
     {
         request.AddParameter("source", Token);
     }
     else
     {
         request.AddParameter("source[object]", "card");
         request.AddParameter("source[number]", Number);
         request.AddParameter("source[exp_month]", ExpMonth);
         request.AddParameter("source[exp_year]", ExpYear);
         if (Cvc.HasValue())
         {
             request.AddParameter("source[cvc]", Cvc);
         }
         if (Name.HasValue())
         {
             request.AddParameter("source[name]", Name);
         }
         if (AddressLine1.HasValue())
         {
             request.AddParameter("source[address_line1]", AddressLine1);
         }
         if (AddressLine2.HasValue())
         {
             request.AddParameter("source[address_line2]", AddressLine2);
         }
         if (AddressCity.HasValue())
         {
             request.AddParameter("source[address_city]", AddressCity);
         }
         if (AddressState.HasValue())
         {
             request.AddParameter("source[address_state]", AddressState);
         }
         if (AddressZip.HasValue())
         {
             request.AddParameter("source[address_zip]", AddressZip);
         }
         if (AddressCountry.HasValue())
         {
             request.AddParameter("source[address_country]", AddressCountry);
         }
     }
 }