Search in sources :

Example 1 with LinkQRCodeResponse

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

the class PaymentApi method createAccountLinkQRCodeWithHttpInfo.

/**
 * Create an Account Link QRCode
 * Create an ACCOUNT LINK QR and display it to the user.  **Timeout: 10s**
 *
 * @param body Account Link Code Creation
 * @return ApiResponse<LinkQRCodeResponse>
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
protected ApiResponse<LinkQRCodeResponse> createAccountLinkQRCodeWithHttpInfo(Object body) throws ApiException {
    Call call = createAccountLinkQrCodeCall(body);
    Type localVarReturnType = new TypeToken<LinkQRCodeResponse>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_QR_SESSION);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) LinkQRCodeResponse(jp.ne.paypay.model.LinkQRCodeResponse)

Example 2 with LinkQRCodeResponse

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

the class PaymentApiTest method createAccountLinkQRCodeFailedTest.

/**
 * Create an Account Link QRCode Failed response
 * Create an ACCOUNT LINK QR and display it to the user.  **Timeout: 10s**
 *
 * @throws ApiException if the Api call fails
 */
@Test
public void createAccountLinkQRCodeFailedTest() throws ApiException {
    AccountLinkQRCode accountLinkQRCode = new AccountLinkQRCode();
    List<AuthorizationScope> scopes = new ArrayList<>();
    scopes.add(AuthorizationScope.DIRECT_DEBIT);
    accountLinkQRCode.setScopes(scopes).setNonce(RandomStringUtils.randomAlphanumeric(8).toLowerCase()).setDeviceId("device_id").setRedirectUrl("merchant.domain/test").setPhoneNumber("phone_number").setReferenceId("reference_id").setRedirectType(QRCode.RedirectTypeEnum.WEB_LINK);
    Assert.assertNotNull(accountLinkQRCode.toString());
    LinkQRCodeResponse linkQRCodeResponse = new LinkQRCodeResponse();
    resultInfo.setMessage("FAILED");
    linkQRCodeResponse.setResultInfo(resultInfo);
    ApiResponse<LinkQRCodeResponse> paymentDetailsApiResponse = new ApiResponse<>(8100001, null, linkQRCodeResponse);
    Mockito.when(api.createAccountLinkQRCodeWithHttpInfo(accountLinkQRCode)).thenReturn(paymentDetailsApiResponse);
    LinkQRCodeResponse response = api.createAccountLinkQRCode(accountLinkQRCode);
    Assert.assertEquals(response.getResultInfo().getMessage(), "FAILED");
}
Also used : LinkQRCodeResponse(jp.ne.paypay.model.LinkQRCodeResponse) ArrayList(java.util.ArrayList) AccountLinkQRCode(jp.ne.paypay.model.AccountLinkQRCode) AuthorizationScope(jp.ne.paypay.model.AuthorizationScope) ApiResponse(jp.ne.paypay.ApiResponse) Test(org.junit.jupiter.api.Test)

Example 3 with LinkQRCodeResponse

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

the class PaymentApiTest method createAccountLinkQRCodeTest.

/**
 * Create an Account Link QRCode
 * Create an ACCOUNT LINK QR and display it to the user.  **Timeout: 10s**
 *
 * @throws ApiException if the Api call fails
 */
@Test
public void createAccountLinkQRCodeTest() throws ApiException {
    AccountLinkQRCode accountLinkQRCode = new AccountLinkQRCode();
    List<AuthorizationScope> scopes = new ArrayList<>();
    scopes.add(AuthorizationScope.DIRECT_DEBIT);
    accountLinkQRCode.setScopes(scopes);
    accountLinkQRCode.setNonce(RandomStringUtils.randomAlphanumeric(8).toLowerCase());
    accountLinkQRCode.setDeviceId("device_id");
    accountLinkQRCode.setRedirectUrl("merchant.domain/test");
    accountLinkQRCode.setPhoneNumber("phone_number");
    accountLinkQRCode.setReferenceId("reference_id");
    accountLinkQRCode.setRedirectType(QRCode.RedirectTypeEnum.WEB_LINK);
    LinkQRCodeResponse linkQRCodeResponse = new LinkQRCodeResponse();
    linkQRCodeResponse.setResultInfo(resultInfo);
    LinkQRCodeResponseData linkQRCodeResponseData = new LinkQRCodeResponseData();
    linkQRCodeResponseData.setLinkQRCodeURL("urlLink");
    linkQRCodeResponse.setData(linkQRCodeResponseData);
    ApiResponse<LinkQRCodeResponse> paymentDetailsApiResponse = new ApiResponse<>(8100001, null, linkQRCodeResponse);
    Mockito.when(api.createAccountLinkQRCodeWithHttpInfo(accountLinkQRCode)).thenReturn(paymentDetailsApiResponse);
    Assert.assertNotNull(accountLinkQRCode.toString());
    Assert.assertNotNull(accountLinkQRCode.getScopes());
    Assert.assertNotNull(accountLinkQRCode.getNonce());
    Assert.assertNotNull(accountLinkQRCode.getDeviceId());
    Assert.assertNotNull(accountLinkQRCode.getRedirectUrl());
    Assert.assertNotNull(accountLinkQRCode.getPhoneNumber());
    Assert.assertNotNull(accountLinkQRCode.getReferenceId());
    LinkQRCodeResponse response = api.createAccountLinkQRCode(accountLinkQRCode);
    Assert.assertNotNull(response.toString());
    Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
    Assert.assertNotNull(response.getData());
    Assert.assertNotNull(response.getData().getLinkQRCodeURL());
}
Also used : LinkQRCodeResponseData(jp.ne.paypay.model.LinkQRCodeResponseData) LinkQRCodeResponse(jp.ne.paypay.model.LinkQRCodeResponse) ArrayList(java.util.ArrayList) AccountLinkQRCode(jp.ne.paypay.model.AccountLinkQRCode) AuthorizationScope(jp.ne.paypay.model.AuthorizationScope) ApiResponse(jp.ne.paypay.ApiResponse) Test(org.junit.jupiter.api.Test)

Example 4 with LinkQRCodeResponse

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

the class PaymentApiExample method createAccountLinkQrCode.

private static void createAccountLinkQrCode(final PaymentApi apiInstance) {
    try {
        AccountLinkQRCode accountLinkQRCode = new AccountLinkQRCode();
        List<AuthorizationScope> scopes = new ArrayList<>();
        scopes.add(AuthorizationScope.DIRECT_DEBIT);
        scopes.add(AuthorizationScope.PENDING_PAYMENTS);
        scopes.add(AuthorizationScope.CONTINUOUS_PAYMENTS);
        scopes.add(AuthorizationScope.PREAUTH_CAPTURE_NATIVE);
        accountLinkQRCode.setScopes(scopes);
        accountLinkQRCode.setNonce(RandomStringUtils.randomAlphanumeric(8).toLowerCase());
        accountLinkQRCode.setDeviceId("device_id");
        accountLinkQRCode.setRedirectUrl("merchant.domain/test");
        accountLinkQRCode.setPhoneNumber("phone_number");
        accountLinkQRCode.setReferenceId("reference_id");
        accountLinkQRCode.setRedirectType(QRCode.RedirectTypeEnum.WEB_LINK);
        LinkQRCodeResponse response = apiInstance.createAccountLinkQRCode(accountLinkQRCode);
        System.out.println(response.getResultInfo().getCode());
        System.out.println(response.getData());
    } catch (ApiException e) {
        e.printStackTrace();
        System.out.println(e.getResponseBody());
    }
}
Also used : LinkQRCodeResponse(jp.ne.paypay.model.LinkQRCodeResponse) ArrayList(java.util.ArrayList) AccountLinkQRCode(jp.ne.paypay.model.AccountLinkQRCode) AuthorizationScope(jp.ne.paypay.model.AuthorizationScope) ApiException(jp.ne.paypay.ApiException)

Aggregations

LinkQRCodeResponse (jp.ne.paypay.model.LinkQRCodeResponse)4 ArrayList (java.util.ArrayList)3 AccountLinkQRCode (jp.ne.paypay.model.AccountLinkQRCode)3 AuthorizationScope (jp.ne.paypay.model.AuthorizationScope)3 ApiResponse (jp.ne.paypay.ApiResponse)2 Test (org.junit.jupiter.api.Test)2 Call (com.squareup.okhttp.Call)1 Type (java.lang.reflect.Type)1 ApiException (jp.ne.paypay.ApiException)1 LinkQRCodeResponseData (jp.ne.paypay.model.LinkQRCodeResponseData)1