Beispiel #1
0
        private void CreatePlanAndSubscription(RecurringGift gift, StripeAccount account, MinistryPlatformContext mpDB, StripeOnboardingContext stripeDB)
        {
            var plan         = _paymentService.CreatePlan(MapToRecurringGiftDto(gift), MapToContactDonor(gift));
            var subscription = _paymentService.CreateSubscription(plan.Id, account.StripeCustomer.CustomerId, GetStartDate(gift));

            UpdateRecurringGiftAndDonorAccount(gift, account, subscription, mpDB, stripeDB);
        }
Beispiel #2
0
 private MpContactDonor MapToContactDonor(RecurringGift gift)
 {
     return(new MpContactDonor
     {
         DonorId = gift.Donor_ID,
     });
 }
        private void CreatePlanAndSubscription(RecurringGift gift, StripeAccount account, MinistryPlatformContext mpDB, StripeOnboardingContext stripeDB)
        {
            var plan = _paymentService.CreatePlan(MapToRecurringGiftDto(gift), MapToContactDonor(gift));
            var subscription = _paymentService.CreateSubscription(plan.Id, account.StripeCustomer.CustomerId, GetStartDate(gift));
            UpdateRecurringGiftAndDonorAccount(gift, account, subscription, mpDB, stripeDB);

        }
Beispiel #4
0
 private RecurringGiftDto MapToRecurringGiftDto(RecurringGift gift)
 {
     return(new RecurringGiftDto
     {
         PlanInterval = gift.Frequency_ID == 1 ? PlanInterval.Weekly : PlanInterval.Monthly,
         PlanAmount = gift.Amount,
     });
 }
 private RecurringGiftDto MapToRecurringGiftDto(RecurringGift gift)
 {
     return new RecurringGiftDto
     {
         PlanInterval = gift.Frequency_ID == 1 ? PlanInterval.Weekly : PlanInterval.Monthly,
         PlanAmount = gift.Amount,
     };
 }
Beispiel #6
0
        private void UpdateRecurringGiftAndDonorAccount(RecurringGift gift, StripeAccount account, StripeSubscription subscription,
                                                        MinistryPlatformContext mpDB, StripeOnboardingContext stripeDB)
        {
            gift.Subscription_ID = subscription.Id;
            gift.DonorAccount.Processor_Account_ID = account.NewCardId;
            gift.DonorAccount.Processor_ID         = account.StripeCustomer.CustomerId;
            mpDB.SaveChanges();

            account.StripeCustomer.Imported = true;
            stripeDB.SaveChanges();
        }
        private void UpdateRecurringGiftAndDonorAccount(RecurringGift gift, StripeAccount account, StripeSubscription subscription,
            MinistryPlatformContext mpDB, StripeOnboardingContext stripeDB)
        {
            gift.Subscription_ID = subscription.Id;
            gift.DonorAccount.Processor_Account_ID = account.NewCardId;
            gift.DonorAccount.Processor_ID = account.StripeCustomer.CustomerId;
            mpDB.SaveChanges();

            account.StripeCustomer.Imported = true;
            stripeDB.SaveChanges();
        }
Beispiel #8
0
 private DateTime GetStartDate(RecurringGift gift)
 {
     return((gift.Frequency_ID == 1 ? GetStartDateForWeek() : GetStartForMonth(gift)).AddMonths(_additionalTrialPeriod));
 }
Beispiel #9
0
 private DateTime GetStartForMonth(RecurringGift gift)
 {
     return(gift.Day_Of_Month == 5 ? GetStartForMonth5th() : GetStartForMonth20th());
 }
 private DateTime GetStartDate(RecurringGift gift)
 {
     return (gift.Frequency_ID == 1 ? GetStartDateForWeek() : GetStartForMonth(gift)).AddMonths(_additionalTrialPeriod);
 }
 private ContactDonor MapToContactDonor(RecurringGift gift)
 {
     return new ContactDonor
     {
         DonorId = gift.Donor_ID,
     };
 }
 private DateTime GetStartForMonth(RecurringGift gift)
 {
     return gift.Day_Of_Month == 5 ? GetStartForMonth5th() : GetStartForMonth20th();
 }