Search in sources :

Example 1 with NotDataResponse

use of jp.ne.paypay.model.NotDataResponse in project paypayopa-sdk-java by paypay.

the class PendingPaymentApiTest method cancelPaymentTest.

/**
 * Cancel a payment
 *
 * This api is used to cancel the pending order.  **Timeout: 15s**
 *
 * @throws ApiException if the Api call fails
 */
@Test
public void cancelPaymentTest() throws ApiException {
    String merchantPaymentId = "merchantpaymentid";
    NotDataResponse notDataResponse = new NotDataResponse();
    notDataResponse.setResultInfo(resultInfo);
    ApiResponse<NotDataResponse> notDataResponseApiResponse = new ApiResponse<>(00001, null, notDataResponse);
    Assert.assertEquals(notDataResponseApiResponse.getStatusCode(), 00001);
    Assert.assertNull(notDataResponseApiResponse.getHeaders());
    Mockito.when(apiClient.escapeString(merchantPaymentId)).thenReturn(merchantPaymentId);
    Mockito.when(api.cancelPendingOrderWithHttpInfo(merchantPaymentId)).thenReturn(notDataResponseApiResponse);
    NotDataResponse response = api.cancelPendingOrder(merchantPaymentId);
    Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
Also used : NotDataResponse(jp.ne.paypay.model.NotDataResponse) ApiResponse(jp.ne.paypay.ApiResponse) Test(org.junit.jupiter.api.Test)

Example 2 with NotDataResponse

use of jp.ne.paypay.model.NotDataResponse in project paypayopa-sdk-java by paypay.

the class UserApiTest method unlinkUserTest.

/**
 * Unlink user
 *
 * Unlink a user from the client  **Timeout: 15s**
 *
 * @throws ApiException
 *          if the Api call fails
 */
@Test
public void unlinkUserTest() throws ApiException {
    String userAuthorizationId = "userAuthorizationId";
    NotDataResponse notDataResponse = new NotDataResponse();
    notDataResponse.setResultInfo(resultInfo);
    ApiResponse<NotDataResponse> notDataResponseApiResponse = new ApiResponse<>(00001, null, notDataResponse);
    Mockito.when(apiClient.escapeString(userAuthorizationId)).thenReturn(userAuthorizationId);
    Mockito.when(api.unlinkUserWithHttpInfo(userAuthorizationId)).thenReturn(notDataResponseApiResponse);
    NotDataResponse response = api.unlinkUser(userAuthorizationId);
    Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
Also used : NotDataResponse(jp.ne.paypay.model.NotDataResponse) ApiResponse(jp.ne.paypay.ApiResponse) Test(org.junit.jupiter.api.Test)

Example 3 with NotDataResponse

use of jp.ne.paypay.model.NotDataResponse in project paypayopa-sdk-java by paypay.

the class PaymentApiTest method cancelPaymentTest.

/**
 * Cancel a payment
 *
 * This api is used in case, while creating a payment, the client can not determine the status of the payment. For example, client get timeout or the response cannot contain the information to indicate the exact payment status.  By calling this api, if accepted, the OPA will guarantee the money eventually goes back to user&#x27;s account.  &lt;/br&gt;&lt;b style&#x3D;\&quot;color:red\&quot;&gt;Note:&lt;/b&gt; The Cancel API can be used until 00:14:59 AM the day after the Payment has happened. &lt;/br&gt;For 00:15 AM or later, please call the refund API to refund the payment.  **Timeout: 15s**
 *
 * @throws ApiException if the Api call fails
 */
@Test
public void cancelPaymentTest() throws ApiException {
    String merchantPaymentId = "merchantpaymentid";
    NotDataResponse notDataResponse = new NotDataResponse();
    notDataResponse.setResultInfo(resultInfo);
    ApiResponse<NotDataResponse> notDataResponseApiResponse = new ApiResponse<>(00001, null, notDataResponse);
    Assert.assertEquals(notDataResponseApiResponse.getStatusCode(), 00001);
    Assert.assertNull(notDataResponseApiResponse.getHeaders());
    Mockito.when(apiClient.escapeString(merchantPaymentId)).thenReturn(merchantPaymentId);
    Mockito.when(api.cancelPaymentWithHttpInfo(merchantPaymentId)).thenReturn(notDataResponseApiResponse);
    NotDataResponse response = api.cancelPayment(merchantPaymentId);
    Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
Also used : NotDataResponse(jp.ne.paypay.model.NotDataResponse) ApiResponse(jp.ne.paypay.ApiResponse) Test(org.junit.jupiter.api.Test)

Example 4 with NotDataResponse

use of jp.ne.paypay.model.NotDataResponse in project paypayopa-sdk-java by paypay.

the class PaymentApi method cancelPaymentWithHttpInfo.

/**
 * Cancel a payment
 * This api is used in case, while creating a payment, the client can not determine the status of the payment. For example, client get timeout or the response cannot contain the information to indicate the exact payment status.  By calling this api, if accepted, the OPA will guarantee the money eventually goes back to user&#x27;s account.  &lt;/br&gt;&lt;b style&#x3D;\&quot;color:red\&quot;&gt;Note:&lt;/b&gt; The Cancel API can be used until 00:14:59 AM the day after the Payment has happened. &lt;/br&gt;For 00:15 AM or later, please call the refund API to refund the payment.  **Timeout: 15s**
 *
 * @param merchantPaymentId (required)
 * @return ApiResponse&lt;NotDataResponse&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
protected ApiResponse<NotDataResponse> cancelPaymentWithHttpInfo(String merchantPaymentId) throws ApiException {
    Call call = cancelPaymentValidateBeforeCall(merchantPaymentId);
    Type localVarReturnType = new TypeToken<NotDataResponse>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.CANCEL_PAYMENT);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) NotDataResponse(jp.ne.paypay.model.NotDataResponse)

Example 5 with NotDataResponse

use of jp.ne.paypay.model.NotDataResponse in project paypayopa-sdk-java by paypay.

the class PaymentApi method deleteQRCodeWithHttpInfo.

/**
 * Delete a Code
 * Delete a created Code.  **Timeout: 15s**
 *
 * @param codeId (required)
 * @return ApiResponse&lt;NotDataResponse&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
protected ApiResponse<NotDataResponse> deleteQRCodeWithHttpInfo(String codeId) throws ApiException {
    Call call = deleteQRCodeValidateBeforeCall(codeId);
    Type localVarReturnType = new TypeToken<NotDataResponse>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.DELETE_QRCODE);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) NotDataResponse(jp.ne.paypay.model.NotDataResponse)

Aggregations

NotDataResponse (jp.ne.paypay.model.NotDataResponse)13 Type (java.lang.reflect.Type)5 ApiResponse (jp.ne.paypay.ApiResponse)5 Test (org.junit.jupiter.api.Test)5 Call (com.squareup.okhttp.Call)4 ApiException (jp.ne.paypay.ApiException)4 TypeToken (com.google.gson.reflect.TypeToken)2 MediaType (com.squareup.okhttp.MediaType)1 Request (com.squareup.okhttp.Request)1 RequestBody (com.squareup.okhttp.RequestBody)1 Response (com.squareup.okhttp.Response)1 File (java.io.File)1 JSON (jp.ne.paypay.JSON)1 QRCodeDetails (jp.ne.paypay.model.QRCodeDetails)1 ResponseParameters (jp.ne.paypay.model.ResponseParameters)1 ResultInfo (jp.ne.paypay.model.ResultInfo)1 UserAuthorizationStatus (jp.ne.paypay.model.UserAuthorizationStatus)1