use of jp.ne.paypay.model.ResultInfo in project paypayopa-sdk-java by paypay.
the class PaymentApiTest method setUp.
@BeforeEach
public void setUp() {
apiClient = Mockito.mock(ApiClient.class);
api.setApiClient(apiClient);
resultInfo = new ResultInfo();
resultInfo.setMessage("SUCCESS");
payment = new Payment();
payment.setAmount(new MoneyAmount().amount(10).currency(MoneyAmount.CurrencyEnum.JPY));
payment.merchantPaymentId("merchantPaymentId").userAuthorizationId("userAuthorizationId").requestedAt(Instant.now().getEpochSecond()).storeId(RandomStringUtils.randomAlphabetic(8)).terminalId(RandomStringUtils.randomAlphanumeric(8)).orderReceiptNumber(RandomStringUtils.randomAlphanumeric(8)).orderDescription("Payment for Order ID:" + UUID.randomUUID().toString());
MerchantOrderItem merchantOrderItem = new MerchantOrderItem().category("Dessert").name("Red Velvet Cake").productId(RandomStringUtils.randomAlphanumeric(8)).quantity(1).unitPrice(new MoneyAmount().amount(10).currency(MoneyAmount.CurrencyEnum.JPY));
List<MerchantOrderItem> merchantOrderItems = new ArrayList<>();
merchantOrderItems.add(merchantOrderItem);
payment.orderItems(merchantOrderItems);
}
use of jp.ne.paypay.model.ResultInfo in project paypayopa-sdk-java by paypay.
the class PendingPaymentApiTest method setUp.
@BeforeEach
public void setUp() {
apiClient = Mockito.mock(ApiClient.class);
api.setApiClient(apiClient);
paymentApi.setApiClient(apiClient);
resultInfo = new ResultInfo();
resultInfo.setMessage("SUCCESS");
payment = new Payment();
payment.setAmount(new MoneyAmount().amount(10).currency(MoneyAmount.CurrencyEnum.JPY));
payment.merchantPaymentId("merchantPaymentId").userAuthorizationId("userAuthorizationId").requestedAt(Instant.now().getEpochSecond()).storeId(RandomStringUtils.randomAlphabetic(8)).terminalId(RandomStringUtils.randomAlphanumeric(8)).orderReceiptNumber(RandomStringUtils.randomAlphanumeric(8)).orderDescription("Payment for Order ID:" + UUID.randomUUID().toString());
MerchantOrderItem merchantOrderItem = new MerchantOrderItem().category("Dessert").name("Red Velvet Cake").productId(RandomStringUtils.randomAlphanumeric(8)).quantity(1).unitPrice(new MoneyAmount().amount(10).currency(MoneyAmount.CurrencyEnum.JPY));
List<MerchantOrderItem> merchantOrderItems = new ArrayList<>();
merchantOrderItems.add(merchantOrderItem);
payment.orderItems(merchantOrderItems);
}
use of jp.ne.paypay.model.ResultInfo in project paypayopa-sdk-java by paypay.
the class UserApiTest method setUp.
@BeforeEach
public void setUp() {
apiClient = Mockito.mock(ApiClient.class);
api.setApiClient(apiClient);
resultInfo = new ResultInfo();
resultInfo.setMessage("SUCCESS");
}
use of jp.ne.paypay.model.ResultInfo in project paypayopa-sdk-java by paypay.
the class WalletApiTest method setUp.
@BeforeEach
public void setUp() {
ApiClient apiClient = Mockito.mock(ApiClient.class);
api.setApiClient(apiClient);
resultInfo = new ResultInfo();
resultInfo.setMessage("SUCCESS");
}
use of jp.ne.paypay.model.ResultInfo in project paypayopa-sdk-java by paypay.
the class ApiClientTest method deserializeTest.
@Test
public void deserializeTest() throws ApiException {
Request.Builder requestBuild = new Request.Builder();
requestBuild.url("http://paypay.ne.jp/v2/qrcode");
requestBuild.header("content-type", "application/json");
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), "{\"merchantPaymentId\":'paymentId'}");
requestBuild.post(requestBody);
Request request = requestBuild.build();
Response.Builder builder = new Response.Builder();
builder.header("content-type", "application/json");
builder.request(request);
builder.code(200);
builder.protocol(Protocol.HTTP_2);
ResultInfo resultInfo = new ResultInfo();
resultInfo.setMessage("SUCCESS");
QRCodeDetails qrCodeDetails = new QRCodeDetails();
qrCodeDetails.setResultInfo(resultInfo);
JSON json = new JSON();
builder.body(ResponseBody.create(MediaType.parse("application/json"), json.serialize(qrCodeDetails)));
Response response = builder.build();
Type localVarReturnType = new TypeToken<QRCodeDetails>() {
}.getType();
Object result = apiClient.deserialize(response, localVarReturnType);
Assert.assertTrue(result instanceof QRCodeDetails);
localVarReturnType = new TypeToken<File>() {
}.getType();
result = apiClient.deserialize(response, localVarReturnType);
Assert.assertTrue(result instanceof File);
json.setLenientOnJson(true);
builder.body(ResponseBody.create(MediaType.parse("application/json"), json.serialize(qrCodeDetails)));
response = builder.build();
result = apiClient.deserialize(response, localVarReturnType);
Assert.assertTrue(result instanceof File);
result = apiClient.deserialize(null, localVarReturnType);
Assert.assertNull(result);
builder.header("content-disposition", "filename=test.json");
response = builder.build();
result = apiClient.deserialize(response, localVarReturnType);
Assert.assertNotNull(result);
Assert.assertTrue(result.toString().endsWith(".json"));
}
Aggregations