Ejemplo n.º 1
0
        public void ProcessDeclineEmail(string processorPaymentId)
        {
            try
            {
                var apiToken = ApiLogin();
                var result   = GetDonationByProcessorPaymentId(processorPaymentId, apiToken, false);

                var rec = _ministryPlatformService.GetRecordsDict(_distributionPageId, apiToken, string.Format(",,,,,,,,\"{0}\"", result.donationId));

                if (rec.Count == 0 || (rec.Last().ToNullableInt("dp_RecordID")) == null)
                {
                    throw (new DonationNotFoundException(processorPaymentId));
                }

                var program              = rec.First().ToString("Statement_Title");
                var paymentType          = PaymentType.GetPaymentType(result.paymentTypeId).name;
                var declineEmailTemplate = PaymentType.GetPaymentType(result.paymentTypeId).declineEmailTemplateId;

                _donorService.SendEmail(declineEmailTemplate, result.donorId, result.donationAmt / Constants.StripeDecimalConversionValue, paymentType, result.donationDate,
                                        program, result.donationNotes);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(
                          string.Format(
                              "ProcessDeclineEmail failed. processorPaymentId: {0},", processorPaymentId), ex);
            }
        }