Exemple #1
0
        public void AddPayout(PayoutRecord payout)
        {
            _payoutRepository.Create(payout);

        }
Exemple #2
0
        public void UpdatePayout(PayoutRecord payout)
        {
            _payoutRepository.Update(payout);

        }
        public void SendCompletedPayoutMessage(string pathToTemplates, string pathToMedia, PayoutRecord payout)
        {
            var seller = _contentManager.Query<UserPart, UserPartRecord>().List().FirstOrDefault(user => user.Id == payout.UserId);
            var payoutInf = _payoutInformRepository.Table.Where(inf => inf.TranzactionId == payout.Id).FirstOrDefault();
            var currency = _currencyRepository.Get(payout.Currency_Id).Code;
            var culture = _currencyRepository.Get(payout.Currency_Id).CurrencyCulture;
            var record = _settingsService.GetSettingByCulture(culture).List().First();
            var api = new MandrillApi(record.ApiKey);
            var mandrillMessage = new MandrillMessage() { };
            mandrillMessage.MergeLanguage = MandrillMessageMergeLanguage.Handlebars;
            mandrillMessage.FromEmail = "*****@*****.**";
            mandrillMessage.FromName = "Teeyoot";
            mandrillMessage.Subject = _mailSubjectService
                .GetMailSubject("withdraw-completed-template", CultureUsed);
            //mandrillMessage.Subject = "We have paid you. Definitely!";
            List<MandrillMailAddress> emails = new List<MandrillMailAddress>();
            emails.Add(new MandrillMailAddress(seller.Email, "Seller"));
            FillPayoutRequestMergeVars(mandrillMessage, seller.Email, seller.Id, payoutInf.AccountNumber.ToString(), payoutInf.BankName.ToString(), payoutInf.AccountHolderName.ToString(), payoutInf.ContactNumber.ToString(), "", payout.Amount, currency);
            mandrillMessage.To = emails;
            mandrillMessage.Html = System.IO.File.ReadAllText(pathToTemplates + "withdraw-completed-template-" + _currencyRepository.Get(payout.Currency_Id).CurrencyCulture + ".html");
            SendTmplMessage(api, mandrillMessage);

        }