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);

        }
        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();
        }
示例#3
0
 private static void ImportAccount(string oldAccountId, StripeJsonAccount accountDetails, StripeCustomer customer)
 {
     var account = new StripeAccount
     {
         Type = accountDetails.Type,
         OldCardId = oldAccountId,
         NewCardId = accountDetails.NewAccountId,
         Fingerprint = accountDetails.Fingerprint,
         Last4 = accountDetails.Last4,
         ExpMonth = accountDetails.ExpMonth,
         ExpYear = accountDetails.ExpYear,
         Institution = accountDetails.Institution,
     };
     
     customer.StripeAccounts.Add(account);
 }