Ejemplo n.º 1
0
 public bool CreatePaypalPreapproval(paypal_preapproval paypal_preapproval)
 {
     using (var db = OpenConnectionFromPool())
     {
         string sql = @"INSERT INTO paypal_preapproval(
                         created_at, 
                         starting_date,
                         ending_date,
                         max_amount_per_payment,
                         max_number_of_payments,
                         max_total_amount_of_all_payments,
                         sender_email,
                         preapproval_key,
                         current_number_of_payments,
                         current_total_amount_of_all_payments,
                         is_active,
                         flag
                         )
                     VALUES( 
                         @created_at,
                         @starting_date,
                         @ending_date,
                         @max_amount_per_payment,
                         @max_number_of_payments,
                         @max_total_amount_of_all_payments,
                         @sender_email,
                         @preapproval_key,
                         @current_number_of_payments,
                         @current_total_amount_of_all_payments,
                         @is_active,
                         @flag)";
         return 1 == db.Execute(sql, paypal_preapproval);
     }
 }
Ejemplo n.º 2
0
        public bool CreatePaypalPreapproval(paypal_preapproval paypal_preapproval)
        {
            var repo = Repo.Instance;
            using (var db = repo.OpenConnectionFromPool())
            {
                return repo.CreatePaypalPreapproval(paypal_preapproval);
            }

        }
Ejemplo n.º 3
0
        public PreapprovalResponse PaypalPreapprovalRequest(paypal_preapproval obj)
        {
            var headers = PaypalHelper.GetHeader();

            RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");

            PreapprovalRequest payRequest = new PreapprovalRequest
            {
                requestEnvelope = requestEnvelope,
                returnUrl = ConfigurationManager.AppSettings["PAYPAL_CONFIRM_RETURN_URL"] + obj.flag,
                cancelUrl = ConfigurationManager.AppSettings["PAYPAL_CONFIRM_CANCEL_URL"],
                pinType = "NOT_REQUIRED",
                currencyCode = ConfigurationManager.AppSettings["DEFAULT_PAYPAL_CURRENCY"],
                maxAmountPerPayment = obj.max_amount_per_payment,
                maxNumberOfPayments = obj.max_number_of_payments,
                maxTotalAmountOfAllPayments = obj.max_total_amount_of_all_payments,
                senderEmail = obj.sender_email,
                startingDate = obj.starting_date.ToString("yyyy-MM-dd'T'HH:mm:ss.000zzz"),
                endingDate = obj.ending_date.ToString("yyyy-MM-dd'T'HH:mm:ss.000zzz")
            };


            AdaptivePaymentsService adaptivePaymentsService = new AdaptivePaymentsService(headers);
            PreapprovalResponse payResponse = adaptivePaymentsService.Preapproval(payRequest);
            return payResponse;
        }