/// <summary>
        /// Decision Point Registration Charge
        /// </summary>
        /// <param name="payment">StripePayment</param>
        /// <param name="paymentResponse">PaymentResponse</param>
        /// <createdby>Sumit Saurav</createdby>
        /// <createdDate>may/22/2014</createdDate>
        /// <returns>string type result.</returns>
        public static string DecisionPointRegistrationCharge(StripePayment payment, PaymentResponse paymentResponse)
        {
            RecurringPaymentResponseParam objRecurring            = null;
            DecisionPointRepository       decisionPointRepository = null;

            #region Create Customer

            //create customer and set annual plan.
            string AnnualCustomerId = CreateCustomer(payment, paymentResponse);

            //save customer details in the database
            objRecurring = new RecurringPaymentResponseParam()
            {
                UserId     = paymentResponse.UserId,
                CustomerId = AnnualCustomerId,
                Amount     = Convert.ToInt32(paymentResponse.CompanyFee),
                Remark     = "Annual and Monthly Plans",
                Type       = "insert"
            };
            decisionPointRepository = new DecisionPointRepository();
            decisionPointRepository.MakeRecurringPayment(objRecurring);
            #endregion


            #region Make Registration payment
            //get credit card details
            StripeCreditCardInfo cc = GetCC(paymentResponse);
            //make first time payment.
            StripeCharge charge      = payment.Charge(Convert.ToInt32(paymentResponse.Amount), "usd", cc, paymentResponse.TransactionType);
            string       charge_id   = charge.ID;
            StripeCharge charge_info = payment.GetCharge(charge_id);
            #endregion

            return(charge_id);
        }
        /// <summary>
        /// Annual Monthly Payment Charge deduction method
        /// </summary>
        /// <param name="payment">StripePayment</param>
        /// <param name="paymentResponse"><RecurringPaymentResponseParam/param>
        ///  <createdby>Sumit Saurav</createdby>
        /// <createdDate>may/22/2014</createdDate>
        /// <returns>string result</returns>
        public static string AnnualMonthlyPaymentCharge(StripePayment payment, RecurringPaymentResponseParam paymentResponse)
        {
            StripeCharge charge      = payment.Charge(Convert.ToInt32(paymentResponse.Amount), "usd", paymentResponse.CustomerId, paymentResponse.Remark);
            string       charge_id   = charge.ID;
            StripeCharge charge_info = payment.GetCharge(charge_id);
            string       result      = string.Empty;

            return(result);
        }
Exemple #3
0
        static void TestSimpleCharge(StripePayment payment)
        {
            StripeCreditCardInfo cc     = GetCC();
            StripeCharge         charge = payment.Charge(5001, "usd", cc, "Test charge");

            Console.WriteLine(charge);
            string       charge_id   = charge.ID;
            StripeCharge charge_info = payment.GetCharge(charge_id);

            Console.WriteLine(charge_info);

            StripeCharge refund = payment.Refund(charge_info.ID);

            Console.WriteLine(refund.Created);
        }
        /// <summary>
        /// Annual Monthly Payment Charge deduction method
        /// </summary>
        /// <param name="payment">StripePayment</param>
        /// <param name="paymentResponse"><RecurringPaymentResponseParam/param>
        ///  <createdby>Sumit Saurav</createdby>
        /// <createdDate>july/19/2014</createdDate>
        /// <returns>string result</returns>
        public static int AnnualMonthlyPaymentFailCharge(StripePayment payment, RecurringPaymentResponseParam paymentResponse)
        {
            RecurringPaymentResponseParam objRecurring            = null;
            DecisionPointRepository       decisionPointRepository = null;
            StripeCharge charge      = payment.Charge(Convert.ToInt32(paymentResponse.Amount), "usd", paymentResponse.CustomerId, paymentResponse.Remark);
            string       charge_id   = charge.ID;
            StripeCharge charge_info = payment.GetCharge(charge_id);

            //save customer details in the database
            objRecurring = new RecurringPaymentResponseParam()
            {
                UserId     = paymentResponse.UserId,
                CustomerId = paymentResponse.CustomerId,
                Amount     = Convert.ToInt32(paymentResponse.Amount),
                Remark     = paymentResponse.Remark,
                ChargeId   = charge_id,
            };
            decisionPointRepository = new DecisionPointRepository();
            return(decisionPointRepository.MakeRecurringPaymentTransaction(objRecurring));
        }