/**
  * Creates an search transaction through the HpsPayPlanPaymentMethodService
  */
 public function execute()
 {
     parent::execute();
     $service = new HpsPayPlanPaymentMethodService($this->service->servicesConfig());
     $usableData = array_intersect_key($this->data, array_flip(HpsPayPlanPaymentMethod::getSearchableFields()));
     return $service->search($usableData);
 }
 protected function setUp()
 {
     $config = new HpsServicesConfig();
     $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A';
     $this->service = new HpsPayPlanScheduleService($config);
     $paymentMethodService = new HpsPayPlanPaymentMethodService($config);
     $this->paymentMethod = $paymentMethodService->page(1, 0)->findAll(array('customerIdentifier' => 'SecureSubmit', 'paymentStatus' => HpsPayPlanPaymentMethodStatus::ACTIVE))->results[0];
 }
 /**
  * Creates an get transaction through the HpsPayPlanPaymentMethodService
  */
 public function execute()
 {
     parent::execute();
     if ($this->paymentMethod != null) {
         $this->paymentMethodKey = $this->paymentMethod->paymentMethodKey;
     }
     $service = new HpsPayPlanPaymentMethodService($this->service->servicesConfig());
     return $service->get($this->paymentMethodKey);
 }
 /**
  * Creates an add transaction through the HpsPayPlanPaymentMethodService
  */
 public function execute()
 {
     parent::execute();
     $service = new HpsPayPlanPaymentMethodService($this->service->servicesConfig());
     $obj = new HpsPayPlanPaymentMethod();
     foreach ($this->data as $k => $v) {
         $obj->{$k} = $v;
     }
     unset($usableData, $k, $v);
     return $service->add($obj);
 }
 /**
  * Creates an edit transaction through the HpsPayPlanPaymentMethodService
  */
 public function execute()
 {
     parent::execute();
     if ($this->paymentMethod != null) {
         $this->paymentMethodKey = $this->paymentMethod->paymentMethodKey;
     }
     $service = new HpsPayPlanPaymentMethodService($this->service->servicesConfig());
     $obj = new HpsPayPlanPaymentMethod();
     $obj->paymentMethodKey = $this->paymentMethodKey;
     $usableData = array_intersect_key($this->data, array_flip(HpsPayPlanPaymentMethod::getEditableFields()));
     foreach ($usableData as $k => $v) {
         $obj->{$k} = $v;
     }
     unset($usableData, $k, $v);
     return $service->edit($obj);
 }
 protected function setup()
 {
     $config = new HpsServicesConfig();
     $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A';
     $config->developerId = '002914';
     $config->versionNumber = '1510';
     $scheduleService = new HpsPayPlanScheduleService($config);
     $results = $scheduleService->page(1, 0)->findAll(array('scheduleStatus' => HpsPayPlanScheduleStatus::ACTIVE, 'scheduleIdentifier' => 'SecureSubmit'));
     $this->schedule = isset($results->results[0]) ? $results->results[0] : null;
     if ($this->schedule == null) {
         $customerService = new HpsPayPlanCustomerService($config);
         $id = date('Ymd') . '-SecureSubmit-' . substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 10);
         $newCustomer = new HpsPayPlanCustomer();
         $newCustomer->customerIdentifier = $id;
         $newCustomer->firstName = 'Bill';
         $newCustomer->lastName = 'Johnson';
         $newCustomer->company = 'Heartland Payment Systems';
         $newCustomer->country = 'USA';
         $newCustomer->customerStatus = HpsPayPlanCustomerStatus::ACTIVE;
         $customer = $customerService->add($newCustomer);
         $paymentMethodService = new HpsPayPlanPaymentMethodService($config);
         $newPaymentMethod = new HpsPayPlanPaymentMethod();
         $newPaymentMethod->customerKey = $customer->customerKey;
         $newPaymentMethod->nameOnAccount = 'Bill Johnson';
         $newPaymentMethod->accountNumber = 4111111111111111;
         $newPaymentMethod->expirationDate = '0120';
         $newPaymentMethod->country = 'USA';
         $paymentMethod = $paymentMethodService->add($newPaymentMethod);
         $id = date('Ymd') . '-SecureSubmit-' . substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 10);
         $date = date('m30Y', strtotime(date('Y-m-d', strtotime(date('Y-m-d'))) . '+1 month'));
         $newPaymentSchedule = new HpsPayPlanSchedule();
         $newPaymentSchedule->scheduleIdentifier = $id;
         $newPaymentSchedule->customerKey = $paymentMethod->customerKey;
         $newPaymentSchedule->paymentMethodKey = $paymentMethod->paymentMethodKey;
         $newPaymentSchedule->subtotalAmount = array('value' => 100);
         $newPaymentSchedule->startDate = $date;
         $newPaymentSchedule->frequency = HpsPayPlanScheduleFrequency::WEEKLY;
         $newPaymentSchedule->duration = HpsPayPlanScheduleDuration::LIMITED_NUMBER;
         $newPaymentSchedule->numberOfPayments = 3;
         $newPaymentSchedule->reprocessingCount = 2;
         $newPaymentSchedule->emailReceipt = 'Never';
         $newPaymentSchedule->emailAdvanceNotice = 'No';
         $newPaymentSchedule->scheduleStatus = HpsPayPlanScheduleStatus::ACTIVE;
         $this->schedule = $scheduleService->add($newPaymentSchedule);
     }
     $this->service = new HpsCreditService($config);
 }