/** * Create transaction and return result * * @param object $paymentObj * * @since 1.0.0 * @return array */ public function doCheckout($paymentObj, $orderObj = null) { $obj = new StdClass(); $obj->MerchantID = $this->getMerchantID(); $obj->Timestamp = $this->getTimeStamp(); $obj->Amount = $paymentObj->getAmount(); $obj->Country = $paymentObj->getCountry(); $obj->Currency = $paymentObj->getCurrency(); $obj->Description = $paymentObj->getDescription(); $obj->EndUserIP = $this->getIP(); $obj->Issuer = $paymentObj->getPaymentMethodIssuer(); $obj->Language = $paymentObj->getLanguage(); $obj->OrderID = $paymentObj->getOrderID(); $obj->PaymentMethod = $paymentObj->getPaymentMethod(); $obj->Reference = $paymentObj->getReference(); $obj->URLCompleted = ''; $obj->URLError = ''; if ($this->isExtendedCheckout($obj->PaymentMethod)) { $obj->XML = $orderObj->getXML(); } $obj->Checksum = $this->generateChecksum($obj, $this->getSecretCode()); if ($this->isExtendedCheckout($obj->PaymentMethod)) { $result = $this->client->CheckoutExtended(array('request' => $obj)); } else { $result = $this->client->Checkout(array('request' => $obj)); } return (array) $result; }
/** * Normalizes an object into a set of arrays/scalars. * * @param object $object object to normalize * @param string $format format the normalization result will be encoded as * @param array $context Context options for the normalizer * * @return array|string|bool|int|float|null */ public function normalize($object, $format = null, array $context = array()) { /** @var Address $object */ return array_filter(array('@type' => $object->getType(), 'code' => $object->getCode(), 'country' => $object->getCountry())); }
/** * Normalizes an object into a set of arrays/scalars. * * @param object $object object to normalize * @param string $format format the normalization result will be encoded as * @param array $context Context options for the normalizer * * @return array|string|bool|int|float|null */ public function normalize($object, $format = null, array $context = array()) { /** @var PayerAddress $object */ return array_filter(array('line1' => $object->getLine1(), 'line2' => $object->getLine2(), 'line3' => $object->getLine3(), 'city' => $object->getCity(), 'county' => $object->getCounty(), 'postcode' => $object->getPostcode(), 'country' => $object->getCountry()), array(NormaliserHelper::GetClassName(), "filter_data")); }
/** * Normalizes an object into a set of arrays/scalars. * * @param object $object object to normalize * @param string $format format the normalization result will be encoded as * @param array $context Context options for the normalizer * * @return array|string|bool|int|float|null */ public function normalize($object, $format = null, array $context = array()) { /** @var Address $object */ return array_filter(array('@type' => $object->getType(), 'code' => $object->getCode(), 'country' => $object->getCountry()), array(NormaliserHelper::GetClassName(), "filter_data")); }