Inheritance: extends Type
 /**
  * @covers BaseActiveRecord::NHSDateAsHTML
  * @todo   Implement testNHSDateAsHTML().
  */
 public function testNHSDateAsHTML()
 {
     $this->model->last_modified_date = '1902-01-01 00:00:00';
     $result = $this->model->NHSDateAsHTML('last_modified_date', $empty_string = '-');
     $expected = '<span class="day">1</span><span class="mth">Jan</span><span class="yr">1902</span>';
     $this->assertEquals($expected, $result);
 }
Example #2
0
 /**
  * @dataProvider dataProvider_Search
  */
 public function testSearch_WithValidTerms_ReturnsExpectedResults($searchTerms, $numResults, $expectedKeys)
 {
     $addresstype = new AddressType();
     $addresstype->setAttributes($searchTerms);
     $addresstyperesults = $addresstype->search();
     $addresstypedata = $addresstyperesults->getData();
     $expectedResults = array();
     if (!empty($expectedKeys)) {
         foreach ($expectedKeys as $key) {
             $expectedResults[] = $this->addresstype($key);
         }
     }
     $this->assertEquals($numResults, $addresstyperesults->getItemCount());
     $this->assertEquals($expectedResults, $addresstypedata);
 }
Example #3
0
 private static function getAddressType($addr_type)
 {
     switch ($addr_type) {
         case 'HOME':
             return \AddressType::model()->find('name=?', array('Home'))->id;
     }
     return;
 }
 /**
  * @covers Anaesthetist::tableName
  */
 public function testTableName()
 {
     $this->assertEquals('anaesthetist', $this->model->tableName());
 }
Example #5
0
 /**
  * @covers Allergy::attributeLabels
  */
 public function testAttributeLabels()
 {
     $expected = array();
     $this->assertEquals($expected, $this->model->attributeLabels());
 }
 public function toXMLString()
 {
     $str = '';
     if ($this->ProfileID != null) {
         $str .= '<ebl:ProfileID>' . PPUtils::escapeInvalidXmlCharsRegex($this->ProfileID) . '</ebl:ProfileID>';
     }
     if ($this->Note != null) {
         $str .= '<ebl:Note>' . PPUtils::escapeInvalidXmlCharsRegex($this->Note) . '</ebl:Note>';
     }
     if ($this->Description != null) {
         $str .= '<ebl:Description>' . PPUtils::escapeInvalidXmlCharsRegex($this->Description) . '</ebl:Description>';
     }
     if ($this->SubscriberName != null) {
         $str .= '<ebl:SubscriberName>' . PPUtils::escapeInvalidXmlCharsRegex($this->SubscriberName) . '</ebl:SubscriberName>';
     }
     if ($this->SubscriberShippingAddress != null) {
         $str .= '<ebl:SubscriberShippingAddress>';
         $str .= $this->SubscriberShippingAddress->toXMLString();
         $str .= '</ebl:SubscriberShippingAddress>';
     }
     if ($this->ProfileReference != null) {
         $str .= '<ebl:ProfileReference>' . PPUtils::escapeInvalidXmlCharsRegex($this->ProfileReference) . '</ebl:ProfileReference>';
     }
     if ($this->AdditionalBillingCycles != null) {
         $str .= '<ebl:AdditionalBillingCycles>' . PPUtils::escapeInvalidXmlCharsRegex($this->AdditionalBillingCycles) . '</ebl:AdditionalBillingCycles>';
     }
     if ($this->Amount != null) {
         $str .= '<ebl:Amount';
         $str .= $this->Amount->toXMLString();
         $str .= '</ebl:Amount>';
     }
     if ($this->ShippingAmount != null) {
         $str .= '<ebl:ShippingAmount';
         $str .= $this->ShippingAmount->toXMLString();
         $str .= '</ebl:ShippingAmount>';
     }
     if ($this->TaxAmount != null) {
         $str .= '<ebl:TaxAmount';
         $str .= $this->TaxAmount->toXMLString();
         $str .= '</ebl:TaxAmount>';
     }
     if ($this->OutstandingBalance != null) {
         $str .= '<ebl:OutstandingBalance';
         $str .= $this->OutstandingBalance->toXMLString();
         $str .= '</ebl:OutstandingBalance>';
     }
     if ($this->AutoBillOutstandingAmount != null) {
         $str .= '<ebl:AutoBillOutstandingAmount>' . PPUtils::escapeInvalidXmlCharsRegex($this->AutoBillOutstandingAmount) . '</ebl:AutoBillOutstandingAmount>';
     }
     if ($this->MaxFailedPayments != null) {
         $str .= '<ebl:MaxFailedPayments>' . PPUtils::escapeInvalidXmlCharsRegex($this->MaxFailedPayments) . '</ebl:MaxFailedPayments>';
     }
     if ($this->CreditCard != null) {
         $str .= '<ebl:CreditCard>';
         $str .= $this->CreditCard->toXMLString();
         $str .= '</ebl:CreditCard>';
     }
     if ($this->BillingStartDate != null) {
         $str .= '<ebl:BillingStartDate>' . PPUtils::escapeInvalidXmlCharsRegex($this->BillingStartDate) . '</ebl:BillingStartDate>';
     }
     if ($this->TrialPeriod != null) {
         $str .= '<ebl:TrialPeriod>';
         $str .= $this->TrialPeriod->toXMLString();
         $str .= '</ebl:TrialPeriod>';
     }
     if ($this->PaymentPeriod != null) {
         $str .= '<ebl:PaymentPeriod>';
         $str .= $this->PaymentPeriod->toXMLString();
         $str .= '</ebl:PaymentPeriod>';
     }
     return $str;
 }
 /**
  * Helper method for setting the type
  *
  * @param AddressType|string $type
  *
  * @return $this
  */
 public function addType($type)
 {
     if ($type instanceof AddressType) {
         $this->type = $type->getAddressType();
     } else {
         $this->type = $type;
     }
     return $this;
 }
 function CustomerAddressType($id)
 {
     App::uses("AddressType", "CustomerManager.Model");
     $customer_address_type = new AddressType();
     return $customer_address_type->find("list", array("conditions" => array("id" => $id)));
 }
 /**
  * @covers AuditTrail::tableName
  */
 public function testTableName()
 {
     $this->assertEquals('tbl_audit_trail', $this->model->tableName());
 }
 public function toXMLString()
 {
     $str = '';
     if ($this->ProfileID != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:ProfileID>' . $this->ProfileID . '</ebl:ProfileID>';
     }
     if ($this->Note != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:Note>' . $this->Note . '</ebl:Note>';
     }
     if ($this->Description != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:Description>' . $this->Description . '</ebl:Description>';
     }
     if ($this->SubscriberName != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:SubscriberName>' . $this->SubscriberName . '</ebl:SubscriberName>';
     }
     if ($this->SubscriberShippingAddress != null) {
         //prop is not a collection
         //prop is complex
         //prop is not enum
         //does not contain attribute or is attribute
         $str .= '<ebl:SubscriberShippingAddress>';
         $str .= $this->SubscriberShippingAddress->toXMLString();
         $str .= '</ebl:SubscriberShippingAddress>';
     }
     if ($this->ProfileReference != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:ProfileReference>' . $this->ProfileReference . '</ebl:ProfileReference>';
     }
     if ($this->AdditionalBillingCycles != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:AdditionalBillingCycles>' . $this->AdditionalBillingCycles . '</ebl:AdditionalBillingCycles>';
     }
     if ($this->Amount != null) {
         //prop is not a collection
         //prop is complex
         //prop is not enum
         //prop containsattribute
         $str .= '<ebl:Amount';
         $str .= $this->Amount->toXMLString();
         $str .= '</ebl:Amount>';
     }
     if ($this->ShippingAmount != null) {
         //prop is not a collection
         //prop is complex
         //prop is not enum
         //prop containsattribute
         $str .= '<ebl:ShippingAmount';
         $str .= $this->ShippingAmount->toXMLString();
         $str .= '</ebl:ShippingAmount>';
     }
     if ($this->TaxAmount != null) {
         //prop is not a collection
         //prop is complex
         //prop is not enum
         //prop containsattribute
         $str .= '<ebl:TaxAmount';
         $str .= $this->TaxAmount->toXMLString();
         $str .= '</ebl:TaxAmount>';
     }
     if ($this->OutstandingBalance != null) {
         //prop is not a collection
         //prop is complex
         //prop is not enum
         //prop containsattribute
         $str .= '<ebl:OutstandingBalance';
         $str .= $this->OutstandingBalance->toXMLString();
         $str .= '</ebl:OutstandingBalance>';
     }
     if ($this->AutoBillOutstandingAmount != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:AutoBillOutstandingAmount>' . $this->AutoBillOutstandingAmount . '</ebl:AutoBillOutstandingAmount>';
     }
     if ($this->MaxFailedPayments != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:MaxFailedPayments>' . $this->MaxFailedPayments . '</ebl:MaxFailedPayments>';
     }
     if ($this->CreditCard != null) {
         //prop is not a collection
         //prop is complex
         //prop is not enum
         //does not contain attribute or is attribute
         $str .= '<ebl:CreditCard>';
         $str .= $this->CreditCard->toXMLString();
         $str .= '</ebl:CreditCard>';
     }
     if ($this->BillingStartDate != null) {
         //prop is not a collection
         //prop not complex
         //prop is not value
         $str .= '<ebl:BillingStartDate>' . $this->BillingStartDate . '</ebl:BillingStartDate>';
     }
     if ($this->TrialPeriod != null) {
         //prop is not a collection
         //prop is complex
         //prop is not enum
         //does not contain attribute or is attribute
         $str .= '<ebl:TrialPeriod>';
         $str .= $this->TrialPeriod->toXMLString();
         $str .= '</ebl:TrialPeriod>';
     }
     if ($this->PaymentPeriod != null) {
         //prop is not a collection
         //prop is complex
         //prop is not enum
         //does not contain attribute or is attribute
         $str .= '<ebl:PaymentPeriod>';
         $str .= $this->PaymentPeriod->toXMLString();
         $str .= '</ebl:PaymentPeriod>';
     }
     return $str;
 }
Example #11
0
 /**
  * @covers Audit::attributeLabels
  */
 public function testAttributeLabels()
 {
     $expected = array('id' => 'ID', 'action' => 'Action', 'target_type' => 'Target type', 'patient_id' => 'Patient', 'episode_id' => 'Episode', 'event_id' => 'Event', 'user_id' => 'User', 'data' => 'Data', 'remote_addr' => 'Remote address', 'http_user_agent' => 'HTTP User Agent', 'server_name' => 'Server name', 'request_uri' => 'Request URI', 'site_id' => 'Site', 'firm_id' => 'Firm');
     $this->assertEquals($expected, $this->model->attributeLabels());
 }
Example #12
0
 public function purchase()
 {
     // Note, we used to add extensions/ to include_path here, that should either
     // be standardized in Loader or we need to load more files here to make
     // up for whatever the PayPal code would otherwise try to load
     require_once 'extensions/PayPal.php';
     require_once 'extensions/PayPal/Profile/Handler/Array.php';
     require_once 'extensions/PayPal/Profile/API.php';
     require_once 'extensions/PayPal/Type/DoDirectPaymentRequestType.php';
     require_once 'extensions/PayPal/Type/DoDirectPaymentRequestDetailsType.php';
     require_once 'extensions/PayPal/Type/DoDirectPaymentResponseType.php';
     //  Add all of the types
     require_once 'extensions/PayPal/Type/BasicAmountType.php';
     require_once 'extensions/PayPal/Type/PaymentDetailsType.php';
     require_once 'extensions/PayPal/Type/AddressType.php';
     require_once 'extensions/PayPal/Type/CreditCardDetailsType.php';
     require_once 'extensions/PayPal/Type/PayerInfoType.php';
     require_once 'extensions/PayPal/Type/PersonNameType.php';
     require_once 'extensions/PayPal/CallerServices.php';
     $environment = $this->live ? 'live' : 'sandbox';
     $dp_request = new DoDirectPaymentRequestType();
     $OrderTotal = new BasicAmountType();
     $OrderTotal->setattr('currencyID', 'USD');
     $OrderTotal->setval($this->amount, 'iso-8859-1');
     $PaymentDetails = new PaymentDetailsType();
     $PaymentDetails->setOrderTotal($OrderTotal);
     $shipTo = new AddressType();
     $shipTo->setName($this->firstName . ' ' . $this->lastName);
     $shipTo->setStreet1($this->address1);
     $shipTo->setStreet2($this->address2);
     $shipTo->setCityName($this->city);
     $shipTo->setStateOrProvince($this->state);
     $shipTo->setCountry('US');
     $shipTo->setPostalCode($this->zip);
     $PaymentDetails->setShipToAddress($shipTo);
     $dp_details = new DoDirectPaymentRequestDetailsType();
     $dp_details->setPaymentDetails($PaymentDetails);
     // Credit Card info
     $card_details = new CreditCardDetailsType();
     $card_details->setCreditCardType($this->creditCardType);
     $card_details->setCreditCardNumber($this->creditCardNumber);
     $card_details->setExpMonth($this->expirationMonth);
     $card_details->setExpYear($this->expirationYear);
     $card_details->setCVV2($this->cvv2Number);
     $payer = new PayerInfoType();
     $person_name = new PersonNameType();
     $person_name->setFirstName($this->firstName);
     $person_name->setLastName($this->lastName);
     $payer->setPayerName($person_name);
     $payer->setPayerCountry('US');
     $payer->setAddress($shipTo);
     $card_details->setCardOwner($payer);
     $dp_details->setCreditCard($card_details);
     $dp_details->setIPAddress($_SERVER['SERVER_ADDR']);
     $dp_details->setPaymentAction('Sale');
     $dp_request->setDoDirectPaymentRequestDetails($dp_details);
     $handler = ProfileHandler_Array::getInstance(array('username' => $this->apiUsername, 'certificateFile' => null, 'subject' => null, 'environment' => $environment));
     $pid = ProfileHandler::generateID();
     $profile = new APIProfile($pid, $handler);
     $profile->setAPIUsername($this->apiUsername);
     $profile->setAPIPassword($this->apiPassword);
     $profile->setSignature($this->apiSignature);
     $profile->setEnvironment($environment);
     $caller = new CallerServices($profile);
     $response = $caller->DoDirectPayment($dp_request);
     if (PayPal::isError($response)) {
         Site::getPage()->addWarning($response->message);
         return false;
     }
     if ($response->Ack == 'Success') {
         return true;
     }
     if (is_array($response->Errors)) {
         foreach ($response->Errors as $error) {
             Site::getPage()->addWarning($error->LongMessage);
         }
     } else {
         Site::getPage()->addWarning($response->Errors->LongMessage);
     }
     return false;
 }