Exemple #1
0
 protected void MakePayment()
 {
     string userId = System.Configuration.ConfigurationManager.AppSettings["userId"].ToString();
     string password = System.Configuration.ConfigurationManager.AppSettings["password"].ToString();
     string signature = System.Configuration.ConfigurationManager.AppSettings["signature"].ToString();
     var configuration = new Moolah.PayPal.PayPalConfiguration(PaymentEnvironment.Live, userId, password, signature);
     var gateway = new Moolah.PayPal.PayPalExpressCheckout(configuration);
     var details = gateway.GetExpressCheckoutDetails(Request.QueryString["token"]);
     decimal amount = details.OrderDetails.OrderTotal;
     lblConfirm.Text = amount.ToString();
     lblConfirm.Text = Request.QueryString["token"] + " Was successfully placed";
     var response = gateway.DoExpressCheckoutPayment(amount, Moolah.PayPal.CurrencyCodeType.USD, Request["token"], Request["PayerID"]);
     if (response.Status == PaymentStatus.Failed)
     {
         if (response.IsSystemFailure)
             // System failures can indicate issues like a configuration problem
             throw new Exception(response.FailureMessage);
         else
             // Non-system failure messages can be shown directly to the customer
             lblConfirm.Text = response.FailureMessage.ToString();
     }
     else
     {
         lblConfirm.Text = string.Format("Transaction successful! <br />PayPal Reference: <strong>{0}</strong> <br /><br />Thank you {1} for paying online.", response.TransactionReference, Session["name"]);
         Session["transRef"] = response.TransactionReference;
     }
 }
Exemple #2
0
 public PayPalRequestBuilder(PayPalConfiguration configuration)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     _configuration = configuration;
 }
Exemple #3
0
 public PayPalResponseParser(PayPalConfiguration configuration)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     _configuration = configuration;
 }
 /// <summary>
 /// For testing.
 /// </summary>
 public PayPalExpressCheckout(PayPalConfiguration configuration, IHttpClient httpClient,
     IPayPalRequestBuilder requestBuilder, IPayPalResponseParser responseParser)
 {
     if (configuration == null) throw new ArgumentNullException("configuration");
     if (httpClient == null) throw new ArgumentNullException("httpClient");
     if (requestBuilder == null) throw new ArgumentNullException("requestBuilder");
     if (responseParser == null) throw new ArgumentNullException("responseParser");
     _configuration = configuration;
     _httpClient = httpClient;
     _requestBuilder = requestBuilder;
     _responseParser = responseParser;
 }
Exemple #5
0
 /// <summary>
 /// For testing.
 /// </summary>
 public PayPalMassPay(PayPalConfiguration configuration, IHttpClient httpClient,
                      IPayPalRequestBuilder requestBuilder, IPayPalResponseParser responseParser)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     if (httpClient == null)
     {
         throw new ArgumentNullException("httpClient");
     }
     if (requestBuilder == null)
     {
         throw new ArgumentNullException("requestBuilder");
     }
     if (responseParser == null)
     {
         throw new ArgumentNullException("responseParser");
     }
     _configuration  = configuration;
     _httpClient     = httpClient;
     _requestBuilder = requestBuilder;
     _responseParser = responseParser;
 }
Exemple #6
0
 public PayPalRequestBuilder(PayPalConfiguration configuration)
 {
     if (configuration == null) throw new ArgumentNullException("configuration");
     _configuration = configuration;
 }
 public PayPalExpressCheckout(PayPalConfiguration configuration)
     : this(configuration, new HttpClient(), new PayPalRequestBuilder(configuration), new PayPalResponseParser(configuration))
 {
 }
Exemple #8
0
 public PayPalMassPay(PayPalConfiguration configuration)
     : this(configuration, new HttpClient(), new PayPalRequestBuilder(configuration), new PayPalResponseParser(configuration))
 {
 }
Exemple #9
0
 public PayPalExpressCheckout(PayPalConfiguration configuration)
     : this(configuration, new HttpClient(), new PayPalRequestBuilder(configuration), new PayPalResponseParser(configuration))
 {
 }
Exemple #10
0
 public PayPalResponseParser(PayPalConfiguration configuration)
 {
     if (configuration == null) throw new ArgumentNullException("configuration");
     _configuration = configuration;
 }