Skip to content

Commit

Permalink
Merge pull request #43 from paypay/PP-46305
Browse files Browse the repository at this point in the history
PP-46305 set requested At internally
  • Loading branch information
Shreyansh Pandey committed Sep 16, 2020
2 parents a7676cd + dd4f55b commit b054576
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
6 changes: 0 additions & 6 deletions src/main/java/jp/ne/paypay/example/PaymentApiExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import jp.ne.paypay.model.WalletBalance;
import org.apache.commons.lang3.RandomStringUtils;

import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -59,7 +58,6 @@ private static Payment getPaymentObject(String merchantPaymentId, String userAut
payment.setAmount(new MoneyAmount().amount(amount).currency(MoneyAmount.CurrencyEnum.JPY));
payment.setMerchantPaymentId(merchantPaymentId);
payment.setUserAuthorizationId(userAuthorizationId);
payment.setRequestedAt(Instant.now().getEpochSecond());
payment.setStoreId(RandomStringUtils.randomAlphabetic(8));
payment.setTerminalId(RandomStringUtils.randomAlphanumeric(8));
payment.setOrderReceiptNumber(RandomStringUtils.randomAlphanumeric(8));
Expand Down Expand Up @@ -270,7 +268,6 @@ private static void capturePayment(final PaymentApi apiInstance, String merchant
captureObject.setMerchantPaymentId(merchantPaymentId);
captureObject.setAmount(new MoneyAmount().amount(amount).currency(MoneyAmount.CurrencyEnum.JPY));
captureObject.setOrderDescription("new Order");
captureObject.setRequestedAt(Instant.now().getEpochSecond());
PaymentDetails paymentDetails = apiInstance.capturePaymentAuth(captureObject);
System.out.println(paymentDetails);
} catch (ApiException e) {
Expand All @@ -287,7 +284,6 @@ private static void createRefund(final PaymentApi apiInstance, String paymentId,
refund.setMerchantRefundId(refundId);
refund.setPaymentId(paymentId);
refund.setReason("Testing");
refund.setRequestedAt(Instant.now().getEpochSecond());
RefundDetails result = apiInstance.refundPayment(refund);
System.out.println("\nAPI RESPONSE\n------------------\n");
System.out.println(result);
Expand All @@ -306,7 +302,6 @@ private static QRCodeDetails createQRCode(final PaymentApi apiInstance, int amou
qrCode.setStoreId(RandomStringUtils.randomAlphabetic(8));
qrCode.setStoreInfo("Just Bake");
qrCode.setTerminalId(RandomStringUtils.randomAlphanumeric(8));
qrCode.setRequestedAt(Instant.now().getEpochSecond());
qrCode.setRedirectUrl("https://paypay.ne.jp/");
qrCode.setRedirectType(QRCode.RedirectTypeEnum.WEB_LINK);//For Deep Link, RedirectTypeEnum.APP_DEEP_LINK
qrCode.setOrderDescription("Payment for Order ID:"+UUID.randomUUID().toString());
Expand Down Expand Up @@ -370,7 +365,6 @@ private static void paymentRevertAuth(final PaymentApi apiInstance, String payme
PaymentStateRevert payment = new PaymentStateRevert();
payment.setPaymentId(paymentId);
payment.setMerchantRevertId(UUID.randomUUID().toString());
payment.setRequestedAt(Instant.now().getEpochSecond());
RevertAuthResponse result = apiInstance.revertAuth(payment);
System.out.println("\nAPI RESPONSE\n------------------\n");
System.out.println(result);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/jp/ne/paypay/model/CaptureObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.gson.annotations.SerializedName;

import java.time.Instant;
import java.util.Objects;

import io.swagger.annotations.ApiModelProperty;
Expand Down Expand Up @@ -32,7 +33,7 @@ public class CaptureObject {

@SerializedName("requestedAt")
@NotNull(message = "requestedAt is required")
private Long requestedAt = null;
private Long requestedAt = Instant.now().getEpochSecond();

@SerializedName("orderDescription")
@NotEmpty(message = "orderDescription is required")
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/jp/ne/paypay/model/Payment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.gson.annotations.SerializedName;

import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -34,7 +35,7 @@ public class Payment extends PaymentState {

@SerializedName("requestedAt")
@NotNull(message = "requestedAt is required")
private Long requestedAt = null;
private Long requestedAt = Instant.now().getEpochSecond();

@SerializedName("storeId")
@Size(max =255 ,message = "maximum 255 characters allowed for storeId")
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/jp/ne/paypay/model/PaymentStateRevert.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.gson.annotations.SerializedName;

import java.time.Instant;
import java.util.Objects;

import io.swagger.annotations.ApiModelProperty;
Expand All @@ -22,7 +23,7 @@ public class PaymentStateRevert {
private String paymentId = null;

@SerializedName("requestedAt")
private Long requestedAt = null;
private Long requestedAt = Instant.now().getEpochSecond();

@SerializedName("reason")
private String reason = null;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/jp/ne/paypay/model/QRCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -59,7 +60,7 @@ public class QRCode {
private String terminalId = null;

@SerializedName("requestedAt")
private Long requestedAt = null;
private Long requestedAt = Instant.now().getEpochSecond();

@SerializedName("isAuthorization")
private Boolean isAuthorization = null;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/jp/ne/paypay/model/Refund.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.gson.annotations.SerializedName;

import java.time.Instant;
import java.util.Objects;

import io.swagger.annotations.ApiModelProperty;
Expand Down Expand Up @@ -32,7 +33,7 @@ public class Refund extends RefundState {

@SerializedName("requestedAt")
@NotNull(message = "requestedAt is required")
private Long requestedAt = null;
private Long requestedAt = Instant.now().getEpochSecond();

@SerializedName("reason")
@Size(max = 255, message = "maximum 255 characters allowed for reason")
Expand Down

0 comments on commit b054576

Please sign in to comment.