public function locateMultipleTerminals($endUserId = null, $requestedAccuracy = 1000) { $locationResponse = null; if (isset($endUserId) && is_array($endUserId) && count($endUserId) > 0 && $requestedAccuracy > 0) { if (!is_null($this->endpoint) && property_exists($this->endpoint, 'Location')) { $url = $this->endpoint->getLocationEndpoint(); } else { $url = 'http://localhost:8080/oneapiserver/LocationService/1/location/queries/location'; } $url = $url . '?requestedAccuracy=' . urlencode($requestedAccuracy); for ($i = 0; $i < count($endUserId); $i++) { $url = $url . '&address=' . urlencode($endUserId[$i]); } error_log('Request is ' . $url); $request = new JSONRequest($url, $this->username, $this->password, 'GET'); $response = $request->execute(); if ($response->getResponseBody()) { $jsondata = json_decode($response->getResponseBody()); } $responseInfo = $response->getResponseInfo(); $location = $response->getLocation(); $locationResponse = new LocationResponse($responseInfo["http_code"], $responseInfo["content_type"], $location, $jsondata); } return $locationResponse; }
public function __construct(PDO $pdo) { parent::__construct($pdo); // override the json_numeric_check, because it converts "1.0" to 1, // which is not wanted for mod versionCodes $this->setJsonEncodeOption(0); // this means we have to do manual casting though }
public function cancelDeliveryNotifications($subscriptionId) { $responseCode = null; if ($subscriptionId) { if (!is_null($this->endpoint) && property_exists($this->endpoint, 'CancelSMSDeliverySubscription')) { $url = $this->endpoint->getCancelSMSDeliverySubscriptionEndpoint(); } else { $url = 'http://localhost:8080/oneapiserver/CancelSMSDeliveryService/1/smsmessaging/outbound/subscriptions/{subscriptionId}'; } $url = str_replace('{subscriptionId}', urlencode($subscriptionId), $url); $request = new JSONRequest($url, $this->username, $this->password, 'DELETE', null); $response = $request->execute(); $responseInfo = $response->getResponseInfo(); error_log("SMSSend::cancelDeliveryNotifications httpResponseCode=" . $responseInfo["http_code"]); $responseCode = $responseInfo["http_code"]; } return $responseCode; }
/** See JSONMessage constructor. $ex must be-a Exception or a string describing an exception. If !$ex then a useless default message is used, reminding the caller to pass the second argument. */ public function __construct(JSONRequest $req, $ex) { if (!$req instanceof JSONRequest) { $req = new JSONRequest(); $req->setType("error"); } parent::__construct($req); if (!$ex instanceof Exception) { if (!$ex) { $ex = "No error text passed to " . __CLASS__ . "::__construct(request,error)."; } $ex = new JSONError('' . $ex, JSONMessage::ErrIDException); } $code = $ex->getCode(); if (!$code) { $code = JSONMessage::ErrIDException; } $this->setResult($code, $ex->getMessage()); }
public function refund($endUserId, $referenceCode, $description, $currency, $amount, $code, $clientCorrelator, $originalServerReferenceCode, $onBehalfOf, $purchaseCategoryCode, $channel, $taxAmount, $serviceId, $productId) { $paymentResponse = null; if ($endUserId && $referenceCode && $description && $currency && $amount) { if (!is_null($this->endpoint) && property_exists($this->endpoint, 'AmountRefund')) { $url = $this->endpoint->getAmountRefundEndpoint(); } else { $url = 'http://localhost:8080/oneapiserver/AmountRefundService/1/payment/{endUserId}/transactions/amount'; } $url = str_replace('{endUserId}', urlencode($endUserId), $url); $formParameters = new FormParameters(); $formParameters->put("endUserId", $endUserId); $formParameters->put("transactionOperationStatus", "refunded"); $formParameters->put("referenceCode", $referenceCode); $formParameters->put("description", $description); $formParameters->put("currency", $currency); $formParameters->put("amount", $amount); $formParameters->put("code", $code); $formParameters->put("clientCorrelator", $clientCorrelator); $formParameters->put("originalServerReferenceCode", $originalServerReferenceCode); $formParameters->put("onBehalfOf", $onBehalfOf); $formParameters->put("purchaseCategoryCode", $purchaseCategoryCode); $formParameters->put("channel", $channel); $formParameters->put("taxAmount", $taxAmount); $formParameters->put("serviceId", $serviceId); $formParameters->put("productId", $productId); $request = new JSONRequest($url, $this->username, $this->password, 'POST', $formParameters->getParameterSet()); $response = $request->execute(); if ($response->getResponseBody()) { $jsondata = json_decode($response->getResponseBody()); } error_log("Charge::refund response=" . print_r($response, true)); error_log("Charge::refund jsondata=" . print_r($jsondata, true)); $responseInfo = $response->getResponseInfo(); $location = $response->getLocation(); $paymentResponse = new PaymentResponse($responseInfo["http_code"], $responseInfo["content_type"], $location, $jsondata); error_log("Charge::refund paymentResponse=" . print_r($paymentResponse, true)); } return $paymentResponse; }
public function __construct(PDO $pdo) { parent::__construct($pdo); // $this->setOption("cacheEnabled", false); }
public function releaseReservation($endUserId, $referenceCode, $referenceSequence) { $paymentResponse = null; if ($endUserId && $referenceCode && $referenceSequence) { if (!is_null($this->endpoint) && property_exists($this->endpoint, 'AmountReservationRelease')) { $url = $this->endpoint->getAmountReservationReleaseEndpoint(); } else { $url = 'http://localhost:8080/oneapiserver/AmountReserveReleaseService/1/payment/{endUserId}/transactions/amountReservation/{transactionId}'; } $url = str_replace('{endUserId}', urlencode($endUserId), $url); $url = str_replace('{transactionId}', urlencode($referenceCode), $url); $formParameters = new FormParameters(); $formParameters->put("endUserId", $endUserId); $formParameters->put("transactionOperationStatus", "released"); $formParameters->put("referenceCode", $referenceCode); $formParameters->put("referenceSequence", $referenceSequence); $request = new JSONRequest($url, $this->username, $this->password, 'POST', $formParameters->getParameterSet()); $response = $request->execute(); if ($response->getResponseBody()) { $jsondata = json_decode($response->getResponseBody()); } error_log("Charge::refund response=" . print_r($response, true)); error_log("Charge::refund jsondata=" . print_r($jsondata, true)); $responseInfo = $response->getResponseInfo(); $location = $response->getLocation(); $paymentResponse = new PaymentResponse($responseInfo["http_code"], $responseInfo["content_type"], $location, $jsondata); error_log("Reservation::releaseReservation paymentResponse=" . print_r($paymentResponse, true)); } return $paymentResponse; }