Search in sources :

Example 1 with ApiClient

use of jp.ne.paypay.ApiClient 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);
}
Also used : Payment(jp.ne.paypay.model.Payment) MerchantOrderItem(jp.ne.paypay.model.MerchantOrderItem) ArrayList(java.util.ArrayList) MoneyAmount(jp.ne.paypay.model.MoneyAmount) ApiClient(jp.ne.paypay.ApiClient) ResultInfo(jp.ne.paypay.model.ResultInfo) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with ApiClient

use of jp.ne.paypay.ApiClient 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);
}
Also used : Payment(jp.ne.paypay.model.Payment) MerchantOrderItem(jp.ne.paypay.model.MerchantOrderItem) ArrayList(java.util.ArrayList) MoneyAmount(jp.ne.paypay.model.MoneyAmount) ApiClient(jp.ne.paypay.ApiClient) ResultInfo(jp.ne.paypay.model.ResultInfo) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with ApiClient

use of jp.ne.paypay.ApiClient 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");
}
Also used : ApiClient(jp.ne.paypay.ApiClient) ResultInfo(jp.ne.paypay.model.ResultInfo) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with ApiClient

use of jp.ne.paypay.ApiClient 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");
}
Also used : ApiClient(jp.ne.paypay.ApiClient) ResultInfo(jp.ne.paypay.model.ResultInfo) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with ApiClient

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

the class CashbackApiExample method main.

public static void main(String[] args) throws ApiException {
    ApiClient apiClient = new Configuration().getDefaultApiClient();
    apiClient.setProductionMode(false);
    apiClient.setApiKey("API_KEY");
    apiClient.setApiSecretKey("API_SECRET_KEY");
    apiClient.setAssumeMerchant("YOUR_MERCHANT_ID");
    String userAuthorizationId = "USER_AUTHORIZATION_ID";
    CashbackApi cashbackApi = new CashbackApi(apiClient);
    CashbackDetails cashbackDetails = giveCashback(cashbackApi, userAuthorizationId, 1);
    if (cashbackDetails != null && cashbackDetails.getData() != null) {
        reverseCashback(cashbackApi, cashbackDetails.getData().getMerchantCashbackId(), 1);
    }
}
Also used : Configuration(jp.ne.paypay.Configuration) CashbackApi(jp.ne.paypay.api.CashbackApi) CashbackDetails(jp.ne.paypay.model.CashbackDetails) ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails) ApiClient(jp.ne.paypay.ApiClient)

Aggregations

ApiClient (jp.ne.paypay.ApiClient)9 ResultInfo (jp.ne.paypay.model.ResultInfo)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 Configuration (jp.ne.paypay.Configuration)4 MoneyAmount (jp.ne.paypay.model.MoneyAmount)3 ArrayList (java.util.ArrayList)2 PaymentApi (jp.ne.paypay.api.PaymentApi)2 MerchantOrderItem (jp.ne.paypay.model.MerchantOrderItem)2 Payment (jp.ne.paypay.model.Payment)2 CashbackApi (jp.ne.paypay.api.CashbackApi)1 PendingPaymentApi (jp.ne.paypay.api.PendingPaymentApi)1 UserApi (jp.ne.paypay.api.UserApi)1 WalletApi (jp.ne.paypay.api.WalletApi)1 Cashback (jp.ne.paypay.model.Cashback)1 CashbackDetails (jp.ne.paypay.model.CashbackDetails)1 PaymentDetails (jp.ne.paypay.model.PaymentDetails)1 ReverseCashback (jp.ne.paypay.model.ReverseCashback)1 ReverseCashbackDetails (jp.ne.paypay.model.ReverseCashbackDetails)1