Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 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;
 }