Пример #1
0
        private static void CreatePaymentRecords(
            CheckoutViewModel checkoutViewModel, 
            string worldId,
            Purchase[] userHistoricalPurchases, 
            CheckoutManager checkoutManager,
            CompleteCheckoutLetterDto completeCheckoutLetterDto, 
            List<CheckoutItemLetterDto> checkoutItemLetterDtoArray,
            List<CheckoutStatementBase> completeCheckoutStatementsArray)
        {
            checkoutManager.StartPaymentEvent(completeCheckoutLetterDto);
            checkoutManager.SetPayerCreditForPayment(completeCheckoutStatementsArray, completeCheckoutLetterDto, worldId);
            checkoutManager.SetPayerDebitForContent(completeCheckoutStatementsArray, completeCheckoutLetterDto);
            checkoutManager.SetSiteAndVatAccountRecords(completeCheckoutStatementsArray, completeCheckoutLetterDto);

            foreach (var purchaseViewModel in checkoutViewModel.PurchasesForUser)
            {
                var checkoutItemLetterDto = new CheckoutItemLetterDto();
                checkoutItemLetterDto.IsLesson = purchaseViewModel.IsLesson;

                checkoutManager.SetTeacherCommission(checkoutItemLetterDto, purchaseViewModel);
                checkoutManager.SetTeacherData(checkoutItemLetterDto, purchaseViewModel);
                checkoutManager.SetAgentCommission(checkoutItemLetterDto, purchaseViewModel);
                checkoutManager.SetTeacherSiteAgentCommissionsCalculations(checkoutItemLetterDto, purchaseViewModel);
                checkoutManager.SetMaam(checkoutItemLetterDto);
                checkoutManager.SetConvertsionCommissions(checkoutItemLetterDto);

                // כתיבת תנועות כספיות

                checkoutManager.TeacherSaleCommissionCredit(completeCheckoutStatementsArray, checkoutItemLetterDto,purchaseViewModel);
                checkoutManager.TeacherSaleCommissionDebit(completeCheckoutStatementsArray, checkoutItemLetterDto,purchaseViewModel);
                checkoutManager.TeacherConversionDebit(completeCheckoutStatementsArray, checkoutItemLetterDto, purchaseViewModel);
                checkoutManager.SiteConversionCredit(completeCheckoutStatementsArray, checkoutItemLetterDto, purchaseViewModel);
                checkoutManager.AgentToAgentConversionCredit(completeCheckoutStatementsArray, checkoutItemLetterDto,purchaseViewModel);
                checkoutManager.AgentToSiteConversionCredit(completeCheckoutStatementsArray, checkoutItemLetterDto,purchaseViewModel);
                checkoutManager.AgentConversionDebit(completeCheckoutStatementsArray, checkoutItemLetterDto, purchaseViewModel);
                checkoutManager.SiteAgentConversionCredit(completeCheckoutStatementsArray, checkoutItemLetterDto,purchaseViewModel);

                // כתיבת רשומות

                checkoutManager.UpdateCoupon(completeCheckoutStatementsArray, purchaseViewModel);
                checkoutManager.UpdatePurchase(completeCheckoutStatementsArray, completeCheckoutLetterDto, purchaseViewModel);

                // טיפול בחבילה
                checkoutManager.HandlePackage(completeCheckoutStatementsArray, purchaseViewModel, checkoutViewModel,
                    userHistoricalPurchases, worldId, completeCheckoutLetterDto.StudentKeyLetter,completeCheckoutLetterDto.StudentCurrencyLetter);

                checkoutItemLetterDtoArray.Add(checkoutItemLetterDto);
            }

            // add basketitemnames
            checkoutManager.GetBasketItemNames(completeCheckoutStatementsArray, checkoutItemLetterDtoArray, checkoutViewModel);
        }