Example #1
0
        private IGateway GetGateway(CMSDataContext db, PaymentInfo pi)
        {
            var tempgateway = db.Setting("TemporaryGateway", "");

            if (!tempgateway.HasValue())
            {
                return(db.Gateway());
            }

            var gateway = db.Setting("TransactionGateway", "");

            switch (gateway.ToLower()) // Check to see if standard gateway is set up
            {
            case "sage":
                if ((pi.PreferredGivingType == "B" && pi.SageBankGuid.HasValue) ||
                    (pi.PreferredGivingType == "C" && pi.SageCardGuid.HasValue))
                {
                    return(db.Gateway());
                }
                break;

            case "transnational":
                if ((pi.PreferredGivingType == "B" && pi.TbnBankVaultId.HasValue) ||
                    (pi.PreferredGivingType == "C" && pi.TbnCardVaultId.HasValue))
                {
                    return(db.Gateway());
                }
                break;
            }

            // fall back to temporary gateway because the user hasn't migrated their payments off of the temporary gateway yet
            return(db.Gateway(usegateway: tempgateway));
        }
Example #2
0
        private IGateway GetGateway(CMSDataContext db, PaymentInfo pi)
        {
            var account = MultipleGatewayUtils.GetAccount(db, pi.GatewayAccountId);

            if (account.IsNull())
            {
                throw new Exception("This process does not have a gateway configured");
            }

            bool IsTesting = MultipleGatewayUtils.GatewayTesting(db, PaymentProcessTypes.RecurringGiving);

            switch (account.GatewayId)
            {
            // case (int)GatewayTypes.Pushpay:
            // break;
            case (int)GatewayTypes.Sage:
                if ((pi.PreferredGivingType == "B" && pi.SageBankGuid.HasValue) ||
                    (pi.PreferredGivingType == "C" && pi.SageCardGuid.HasValue))
                {
                    return(db.Gateway(IsTesting, account));
                }
                break;

            case (int)GatewayTypes.Transnational:
                if ((pi.PreferredGivingType == "B" && pi.TbnBankVaultId.HasValue) ||
                    (pi.PreferredGivingType == "C" && pi.TbnCardVaultId.HasValue))
                {
                    return(db.Gateway(IsTesting, account));
                }
                break;

            case (int)GatewayTypes.Acceptiva:
                if (pi.AcceptivaPayerId.HasValue() &&
                    (pi.PreferredGivingType == "B" || pi.PreferredGivingType == "C"))
                {
                    return(db.Gateway(IsTesting, account));
                }
                break;

            case (int)GatewayTypes.BluePay:
                if ((pi.PreferredGivingType == "B") ||
                    (pi.PreferredGivingType == "C" && string.IsNullOrEmpty(pi.BluePayCardVaultId)))
                {
                    return(db.Gateway(IsTesting, account));
                }
                break;

            default:
                break;
            }

            // fall back to default gateway
            return(db.Gateway(IsTesting, null, processType: PaymentProcessTypes.RecurringGiving));
        }
Example #3
0
        public static void ResolvePrevDaysVirtualCheckRejects(CMSDataContext db, DateTime start, DateTime end)
        {
            var gateway  = db.Gateway();
            var response = gateway.GetReturnedChecks(start, end);


            //var ds = gw.VirtualCheckRejects(dt);
            //var items = from r in ds.Tables[0].AsEnumerable()
            //            let rejectdt = r["reject_date"].ToDate() ?? DateTime.MinValue
            //            where rejectdt > DateTime.MinValue
            //            select new
            //            {
            //                rejectdt,
            //                trantype = r["trantype"],
            //                amt = r["rejedt_amount"].ToString().ToDecimal(),
            //                tranid = r["customer_number"].ToInt(),
            //                rejectcode = r["reject_code"].ToString(),
            //                message = r["correction_info"].ToString(),
            //            };

            /*
             * Create a new transaction to reverse the original
             * If the transaction was for online giving or recurring giving, then reverse the contribution.
             * If the transaction contained an extra donation, then reverse that contribution.
             * Send an email to the payor.
             * Send an email notification to the online notify list for the associated organization
             */
        }
Example #4
0
 public bool CanCredit(CMSDataContext db)
 {
     return db.Gateway().CanVoidRefund
         && Approved == true
         && Voided != true
         && Credited != true
         && (Coupon ?? false) == false
         && TransactionId.HasValue()
         && Batchtyp == "eft" || Batchtyp == "bankcard"
         && Amt > 0;
 }
Example #5
0
 public bool CanVoid(CMSDataContext db)
 {
     return db.Gateway().CanVoidRefund
         && Approved == true
         && !CanCredit(db)
         && Voided != true
         && Credited != true
         && (Coupon ?? false) == false
         && TransactionId.HasValue()
         && Amt > 0;
 }
Example #6
0
 public bool CanCredit(CMSDataContext db)
 {
     return(db.Gateway().CanVoidRefund &&
            Approved == true &&
            Voided != true &&
            Credited != true &&
            (Coupon ?? false) == false &&
            TransactionId.HasValue() &&
            Batchtyp == "eft" || Batchtyp == "bankcard" &&
            Amt > 0);
 }
Example #7
0
 public bool CanVoid(CMSDataContext db)
 {
     return(db.Gateway().CanVoidRefund &&
            Approved == true &&
            !CanCredit(db) &&
            Voided != true &&
            Credited != true &&
            (Coupon ?? false) == false &&
            TransactionId.HasValue() &&
            Amt > 0);
 }
Example #8
0
        private IGateway GetGateway(CMSDataContext db, PaymentInfo pi)
        {
            var tempgateway = db.Setting("TemporaryGateway", "");

            if (!tempgateway.HasValue())
                return db.Gateway();

            var gateway = db.Setting("TransactionGateway", "");
            switch (gateway.ToLower()) // Check to see if standard gateway is set up
            {
                case "sage":
                    if ((pi.PreferredGivingType == "B" && pi.SageBankGuid.HasValue) ||
                        (pi.PreferredGivingType == "C" && pi.SageCardGuid.HasValue))
                        return db.Gateway();
                    break;
                case "transnational":
                    if ((pi.PreferredGivingType == "B" && pi.TbnBankVaultId.HasValue) ||
                        (pi.PreferredGivingType == "C" && pi.TbnCardVaultId.HasValue))
                        return db.Gateway();
                    break;
            }

            // fall back to temporary gateway because the user hasn't migrated their payments off of the temporary gateway yet
            return db.Gateway(usegateway: tempgateway);
        }
Example #9
0
 private IGateway GetGateway(CMSDataContext db)
 {
     return(gateway ?? (gateway = db.Gateway(name: TransactionGateway)));
 }