use of com.squareup.okhttp.Call in project paypayopa-sdk-java by paypay.
the class PendingPaymentApi method createPendingPaymentWithHttpInfo.
/**
* Create a pending payment
* Sends a push notification to the user requesting payment. **Timeout: 30s**
*
* @param payment Payment
* @return ApiResponse<PaymentDetails>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
protected ApiResponse<PaymentDetails> createPendingPaymentWithHttpInfo(Payment payment) throws ApiException {
Call call = createPendingPaymentCall(payment);
Type localVarReturnType = new TypeToken<PaymentDetails>() {
}.getType();
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_REQUEST_ORDER);
}
use of com.squareup.okhttp.Call in project paypayopa-sdk-java by paypay.
the class UserApi method getMaskedUserProfileWithHttpInfo.
/**
* Get masked user profile
* Get the masked phone number of the user
* @param userAuthorizationId (required)
* @return ApiResponse<MaskedUserProfileResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
protected ApiResponse<MaskedUserProfileResponse> getMaskedUserProfileWithHttpInfo(String userAuthorizationId) throws ApiException {
Call call = getMaskedUserProfileValidateBeforeCall(userAuthorizationId);
Type localVarReturnType = new TypeToken<MaskedUserProfileResponse>() {
}.getType();
return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_SECURE_USER_PROFILE);
}
use of com.squareup.okhttp.Call in project paypayopa-sdk-java by paypay.
the class WalletApi method checkWalletBalanceWithHttpInfo.
/**
* Check user wallet balance
* Check if user has enough balance to make a payment **Timeout: 15s**
* @param userAuthorizationId (required)
* @param amount (required)
* @param currency (required)
* @param productType (optional)
* @return ApiResponse<WalletBalance>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
protected ApiResponse<WalletBalance> checkWalletBalanceWithHttpInfo(String userAuthorizationId, Integer amount, String currency, ProductType productType) throws ApiException {
Call call = checkWalletBalanceValidateBeforeCall(userAuthorizationId, amount, currency, productType);
Type localVarReturnType = new TypeToken<WalletBalance>() {
}.getType();
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CHECK_BALANCE);
}
use of com.squareup.okhttp.Call in project log-helper by Redick01.
the class OkHttpExample method main.
public static void main(String[] args) throws IOException {
String url = "http://127.0.0.1:8081/order/getPayCount?orderNo=1";
OkHttpClient okHttpClient = new OkHttpClient();
okHttpClient.interceptors().add(new TraceIdOkhttpInterceptor());
Request request = new Request.Builder().url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
}
use of com.squareup.okhttp.Call in project casa by GluuFederation.
the class StytchService method verifyCode.
public boolean verifyCode(String methodId, String code) {
OkHttpClient httpClient = new OkHttpClient();
String data = "{\"method_id\": \"" + methodId + "\", \"code\": \"" + code + "\" }";
logger.debug("method_id -" + methodId + "-code " + code);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), data);
String asB64 = new String(new Base64().encode((properties.get("PROJECT_ID") + ":" + properties.get("SECRET")).getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
String authHeader = "Basic " + new String(asB64);
Request request = new Request.Builder().url(getScriptPropertyValue("AUTH_ENDPOINT")).post(body).addHeader(HttpHeaders.AUTHORIZATION, authHeader).addHeader("Content-Type", "application/json").build();
Call call = httpClient.newCall(request);
logger.debug(request.toString() + "-" + request.headers() + "-" + request.body().toString());
try {
Response response = call.execute();
if (response.code() == 200 || response.code() == 201) {
return true;
} else {
String responseBody = response.body().string();
Map<String, String> map = mapper.readValue(responseBody, Map.class);
logger.debug("Response for verifyCode user was : " + response.code() + "---" + response.message() + "Error details:" + map);
// should be ok.
return false;
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
return true;
}
}
Aggregations