public static async Task <Domain.Socioboard.Models.User> FbLogin(string accessToken, string BaseUrl) { Domain.Socioboard.Models.User user = null; List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >(); Parameters.Add(new KeyValuePair <string, string>("AccessToken", accessToken)); HttpResponseMessage response = await WebApiReq.PostReq("/api/User/FacebookLogin", Parameters, "", "", BaseUrl); if (response.IsSuccessStatusCode) { try { user = await response.Content.ReadAsAsync <Domain.Socioboard.Models.User>(); } catch { } } return(user); }
public async Task <string> PaypalInitialPayment(string token, string payerId, string description, string amount) { var responseData = string.Empty; try { var parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("METHOD", "DoExpressCheckoutPayment"), new KeyValuePair <string, string>("VERSION", "204.0"), new KeyValuePair <string, string>("USER", _appSettings.PaypalApiUsername), new KeyValuePair <string, string>("PWD", _appSettings.PaypalApiPassword), new KeyValuePair <string, string>("SIGNATURE", _appSettings.PaypalApiSignature), new KeyValuePair <string, string>("TOKEN", token), new KeyValuePair <string, string>("PAYERID", payerId), new KeyValuePair <string, string>("PAYMENTREQUEST_0_PAYMENTACTION", "Sale"), new KeyValuePair <string, string>("PAYMENTREQUEST_0_AMT", amount), new KeyValuePair <string, string>("PAYMENTREQUEST_0_CURRENCYCODE", "USD"), new KeyValuePair <string, string>("PAYMENTREQUEST_0_DESC", "Initial Payment") }; var response = await WebApiReq.PostReq("", parameters, "", "", _appSettings.PaypalExpressUrl); if (response.IsSuccessStatusCode) { try { responseData = await response.Content.ReadAsStringAsync(); } catch (Exception e) { Console.WriteLine(e); throw; } } } catch (Exception e) { Console.WriteLine(e); throw; } return(responseData); }
public async Task <string> GetPayPalPayerId(string token) { var payerId = string.Empty; try { var parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("METHOD", "GetExpressCheckoutDetails"), new KeyValuePair <string, string>("VERSION", "204.0"), new KeyValuePair <string, string>("TOKEN", HttpUtility.UrlEncode(token)), new KeyValuePair <string, string>("USER", _appSettings.PaypalApiUsername), new KeyValuePair <string, string>("PWD", _appSettings.PaypalApiPassword), new KeyValuePair <string, string>("SIGNATURE", _appSettings.PaypalApiSignature), }; var response = await WebApiReq.PostReq("", parameters, "", "", _appSettings.PaypalExpressUrl); if (response.IsSuccessStatusCode) { try { var data = await response.Content.ReadAsStringAsync(); payerId = Uri.UnescapeDataString(Utils.GetBetween(data, "PAYERID=", "&")); } catch (Exception e) { Console.WriteLine(e); } } } catch (Exception e) { Console.WriteLine(e); } return(payerId); }
public async Task <string> GetRecurringProfileDetails(string profileId) { var responseData = string.Empty; try { var parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("METHOD", "GetRecurringPaymentsProfileDetails"), new KeyValuePair <string, string>("VERSION", "204.0"), new KeyValuePair <string, string>("USER", _appSettings.PaypalApiUsername), new KeyValuePair <string, string>("PWD", _appSettings.PaypalApiPassword), new KeyValuePair <string, string>("SIGNATURE", _appSettings.PaypalApiSignature), new KeyValuePair <string, string>("PROFILEID", profileId), }; var response = await WebApiReq.PostReq("", parameters, "", "", _appSettings.PaypalExpressUrl); if (response.IsSuccessStatusCode) { try { responseData = await response.Content.ReadAsStringAsync(); } catch (Exception e) { Console.WriteLine(e); throw; } } } catch (Exception e) { Console.WriteLine(e); throw; } return(responseData); }