Search in sources :

Example 41 with Call

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);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) PaymentDetails(jp.ne.paypay.model.PaymentDetails)

Example 42 with Call

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&lt;MaskedUserProfileResponse&gt;
 * @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);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) MaskedUserProfileResponse(jp.ne.paypay.model.MaskedUserProfileResponse)

Example 43 with Call

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&lt;WalletBalance&gt;
 * @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);
}
Also used : Call(com.squareup.okhttp.Call) ProductType(jp.ne.paypay.model.ProductType) Type(java.lang.reflect.Type) WalletBalance(jp.ne.paypay.model.WalletBalance)

Example 44 with Call

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();
}
Also used : Response(com.squareup.okhttp.Response) Call(com.squareup.okhttp.Call) OkHttpClient(com.squareup.okhttp.OkHttpClient) Request(com.squareup.okhttp.Request) TraceIdOkhttpInterceptor(com.redick.support.okhttp.TraceIdOkhttpInterceptor)

Example 45 with Call

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;
    }
}
Also used : Response(com.squareup.okhttp.Response) Call(com.squareup.okhttp.Call) OkHttpClient(com.squareup.okhttp.OkHttpClient) Base64(org.apache.commons.codec.binary.Base64) Request(com.squareup.okhttp.Request) IOException(java.io.IOException) RequestBody(com.squareup.okhttp.RequestBody)

Aggregations

Call (com.squareup.okhttp.Call)46 Type (java.lang.reflect.Type)28 Request (com.squareup.okhttp.Request)13 Response (com.squareup.okhttp.Response)13 OkHttpClient (com.squareup.okhttp.OkHttpClient)9 PaymentDetails (jp.ne.paypay.model.PaymentDetails)8 RequestBody (com.squareup.okhttp.RequestBody)5 IOException (java.io.IOException)5 HttpUrl (com.squareup.okhttp.HttpUrl)4 HashMap (java.util.HashMap)4 ReverseCashbackDetails (jp.ne.paypay.model.ReverseCashbackDetails)4 TypeToken (com.google.gson.reflect.TypeToken)3 NotDataResponse (jp.ne.paypay.model.NotDataResponse)3 Base64 (org.apache.commons.codec.binary.Base64)3 Pair (jp.ne.paypay.Pair)2 Request (com.android.volley.Request)1 ApiCommand (com.cloudera.api.swagger.model.ApiCommand)1 ApiCommandList (com.cloudera.api.swagger.model.ApiCommandList)1 ApiHost (com.cloudera.api.swagger.model.ApiHost)1 ApiHostList (com.cloudera.api.swagger.model.ApiHostList)1