public void recurring_013_AddScheduleCCheckPPD()
        {
            var schedule = new HpsPayPlanSchedule {
                ScheduleIdentifier = GetIdentifier("CheckPPD"),
                CustomerKey = _customerPersonKey,
                ScheduleStatus = HpsPayPlanScheduleStatus.Active,
                PaymentMethodKey = _paymentMethodKeyCheckPpd,
                SubtotalAmount = new HpsPayPlanAmount("3003"),
                StartDate = "02012027",
                Frequency = HpsPayPlanScheduleFrequency.Monthly,
                Duration = HpsPayPlanScheduleDuration.LimitedNumber,
                ReprocessingCount = 1,
                NumberOfPayments = 2,
                ProcessingDateInfo = "1"
            };

            _payPlanService.AddSchedule(schedule);
        }
        public void recurring_011_AddScheduleCheckCCD()
        {
            var schedule = new HpsPayPlanSchedule {
                ScheduleIdentifier = GetIdentifier("CheckCCD"),
                CustomerKey = _customerCompanyKey,
                ScheduleStatus = HpsPayPlanScheduleStatus.Active,
                PaymentMethodKey = _paymentMethodKeyCheckCcd,
                SubtotalAmount = new HpsPayPlanAmount("3004"),
                StartDate = "02012027",
                Frequency = HpsPayPlanScheduleFrequency.Biweekly,
                Duration = HpsPayPlanScheduleDuration.Ongoing,
                ReprocessingCount = 1
            };

            var response = _payPlanService.AddSchedule(schedule);
            Assert.IsNotNull(response);
            Assert.IsNotNull(response.ScheduleKey);

            _scheduleKeyCheckCcd = response.ScheduleKey;
        }
        public void recurring_012_AddScheduleCreditVisa()
        {
            var schedule = new HpsPayPlanSchedule {
                ScheduleIdentifier = GetIdentifier("CreditV"),
                CustomerKey = _customerPersonKey,
                ScheduleStatus = HpsPayPlanScheduleStatus.Active,
                PaymentMethodKey = _paymentMethodKeyVisa,
                SubtotalAmount = new HpsPayPlanAmount("3001"),
                StartDate = "02012027",
                Frequency = HpsPayPlanScheduleFrequency.Weekly,
                Duration = HpsPayPlanScheduleDuration.Ongoing,
                ReprocessingCount = 1
            };

            _payPlanService.AddSchedule(schedule);
        }
        public void recurring_009_AddScheduleCreditMasterCard()
        {
            var schedule = new HpsPayPlanSchedule {
                ScheduleIdentifier = GetIdentifier("CreditMC"),
                CustomerKey = _customerPersonKey,
                ScheduleStatus = HpsPayPlanScheduleStatus.Active,
                PaymentMethodKey = _paymentMethodKeyMasterCard,
                SubtotalAmount = new HpsPayPlanAmount("3002"),
                StartDate = "02012027",
                Frequency = HpsPayPlanScheduleFrequency.Weekly,
                Duration = HpsPayPlanScheduleDuration.EndDate,
                EndDate = "04012027",
                ReprocessingCount = 2
            };

            var response = _payPlanService.AddSchedule(schedule);
            Assert.IsNotNull(response);
            Assert.IsNotNull(response.ScheduleKey);

            _scheduleKeyMasterCard = response.ScheduleKey;
        }
        public HpsPayPlanSchedule DeleteSchedule(HpsPayPlanSchedule schedule, bool forceDelete = false)
        {
            if (schedule == null)
                throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument,
                    "schedule must be an instance of HpsPayPlanSchedule.", "schedule");

            return DeleteSchedule(schedule.ScheduleKey, forceDelete);
        }
        public HpsPayPlanSchedule GetSchedule(HpsPayPlanSchedule schedule)
        {
            if (schedule == null)
                throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument,
                    "schedule must be an instance of HpsPayPlanSchedule.", "schedule");

            return GetSchedule(schedule.ScheduleKey);
        }
        public HpsPayPlanSchedule EditSchedule(HpsPayPlanSchedule schedule)
        {
            if (schedule == null)
                throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument,
                    "schedule must be an instance of HpsPayPlanSchedule.", "schedule");

            schedule.EndDate = string.IsNullOrEmpty(schedule.EndDate) ? null : schedule.EndDate;
            schedule.StartDate = string.IsNullOrEmpty(schedule.EndDate) ? null : schedule.EndDate;
            schedule.NextProcessingDate = string.IsNullOrEmpty(schedule.NextProcessingDate) ? null : schedule.NextProcessingDate;
            schedule.PreviousProcessingDate = string.IsNullOrEmpty(schedule.PreviousProcessingDate) ? null : schedule.PreviousProcessingDate;

            var data = schedule.GetEditableFieldsWithValues();
            var response = DoRequest("PUT", "schedules/" + schedule.ScheduleKey, data);

            return HydrateObject<HpsPayPlanSchedule>(response);
        }
        /* SCHEDULE METHODS */

        public HpsPayPlanSchedule AddSchedule(HpsPayPlanSchedule schedule)
        {
            if (schedule == null)
                throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument,
                    "schedule must be an instance of HpsPayPlanSchedule.", "schedule");

            var data = schedule.GetEditableFieldsWithValues();
            data.Add("customerKey", schedule.CustomerKey);
            data.Add("numberOfPayments", schedule.NumberOfPayments);

            var response = DoRequest("POST", "schedules", data);
            return HydrateObject<HpsPayPlanSchedule>(response);
        }