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);
}
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");
}
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());
}
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());
}
}
Aggregations