public Response<PayPal.Api.Payment> CreatePayment(PayPal.Api.Payment payment) { Response<PayPal.Api.Payment> response = null; PaymentBusiness paymentBusiness = null; PayPal<PayPal.Api.Payment> paypal = null; try { paymentBusiness = new PaymentBusiness(); paypal = paymentBusiness.Create(payment); response = new Response<PayPal.Api.Payment>(paypal.Object, ResponseStatus.Success, "Success"); } catch (Exception ex) { response = new Response<PayPal.Api.Payment>(null, ResponseStatus.Error, ex.Message); } return response; }
public Response<PayPal.Api.Payment> GetPayment(String codePayment) { Response<PayPal.Api.Payment> response = null; PaymentBusiness paymentBusiness = null; try { paymentBusiness = new PaymentBusiness(); PayPal<PayPal.Api.Payment> paypal = paymentBusiness.Get(codePayment); if (paypal.IsValid) response = new Response<PayPal.Api.Payment>(paypal.Object, ResponseStatus.Success, "Success"); else { response = new Response<PayPal.Api.Payment>(paypal.Object, ResponseStatus.ErrorValidation, "Success"); response.Validations = paypal.Validations; } } catch (Exception ex) { response = new Response<PayPal.Api.Payment>(null, ResponseStatus.Error, ex.Message); } return response; }