Skip to content

Commit

Permalink
SP-737 Type Review: Java
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarzybok-sumoheavy committed Jan 11, 2024
1 parent 34f4ac2 commit 4ccadfb
Show file tree
Hide file tree
Showing 51 changed files with 832 additions and 197 deletions.
14 changes: 11 additions & 3 deletions src/main/java/com/bitpay/sdk/model/bill/Bill.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
import com.bitpay.sdk.exceptions.BitPayGenericException;
import com.bitpay.sdk.model.Currency;
import com.bitpay.sdk.model.ModelConfiguration;
import com.bitpay.sdk.util.serializer.Iso8601ToZonedDateTimeDeserializer;
import com.bitpay.sdk.util.serializer.ZonedDateTimeToIso8601Serializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.time.ZonedDateTime;
import java.util.List;

Expand All @@ -39,7 +43,7 @@ public class Bill {
private String country = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private List<String> cc;
private String phone = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private String dueDate = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private ZonedDateTime dueDate;
private Boolean passProcessingFee;
private String status = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private String url = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
Expand Down Expand Up @@ -395,7 +399,8 @@ public void setPhone(final String phone) {
*/
@JsonProperty("dueDate")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getDueDate() {
@JsonSerialize(using = ZonedDateTimeToIso8601Serializer.class)
public ZonedDateTime getDueDate() {
return this.dueDate;
}

Expand All @@ -405,7 +410,8 @@ public String getDueDate() {
* @param dueDate the due date
*/
@JsonProperty("dueDate")
public void setDueDate(final String dueDate) {
@JsonDeserialize(using = Iso8601ToZonedDateTimeDeserializer.class)
public void setDueDate(final ZonedDateTime dueDate) {
this.dueDate = dueDate;
}

Expand Down Expand Up @@ -480,6 +486,7 @@ public void setUrl(final String url) {
*/
@JsonIgnore
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@JsonSerialize(using = ZonedDateTimeToIso8601Serializer.class)
public ZonedDateTime getCreatedDate() {
return this.createdDate;
}
Expand All @@ -490,6 +497,7 @@ public ZonedDateTime getCreatedDate() {
* @param createdDate the create date
*/
@JsonProperty("createdDate")
@JsonDeserialize(using = Iso8601ToZonedDateTimeDeserializer.class)
public void setCreatedDate(final ZonedDateTime createdDate) {
this.createdDate = createdDate;
}
Expand Down
22 changes: 15 additions & 7 deletions src/main/java/com/bitpay/sdk/model/invoice/InvoiceTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
package com.bitpay.sdk.model.invoice;

import com.bitpay.sdk.model.ModelConfiguration;
import com.bitpay.sdk.util.serializer.Iso8601ToZonedDateTimeDeserializer;
import com.bitpay.sdk.util.serializer.ZonedDateTimeToIso8601Serializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.math.BigDecimal;
import java.util.Date;
import java.time.ZonedDateTime;
import java.util.Map;

/**
Expand All @@ -26,8 +30,8 @@ public class InvoiceTransaction {

private BigDecimal amount;
private Integer confirmations;
private Date time;
private Date receivedTime;
private ZonedDateTime time;
private ZonedDateTime receivedTime;
private String txid = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private Map<String, BigDecimal> exRates;
private Integer outputIndex;
Expand Down Expand Up @@ -84,7 +88,8 @@ public void setConfirmations(final Integer confirmations) {
* @return the received time
*/
@JsonIgnore
public Date getReceivedTime() {
@JsonSerialize(using = ZonedDateTimeToIso8601Serializer.class)
public ZonedDateTime getReceivedTime() {
return this.receivedTime;
}

Expand All @@ -94,7 +99,8 @@ public Date getReceivedTime() {
* @param receivedTime the received time
*/
@JsonProperty("receivedTime")
public void setReceivedTime(final Date receivedTime) {
@JsonDeserialize(using = Iso8601ToZonedDateTimeDeserializer.class)
public void setReceivedTime(final ZonedDateTime receivedTime) {
this.receivedTime = receivedTime;
}

Expand Down Expand Up @@ -124,7 +130,8 @@ public void setTransactionId(final String txid) {
* @return the time
*/
@JsonIgnore
public Date getTime() {
@JsonSerialize(using = ZonedDateTimeToIso8601Serializer.class)
public ZonedDateTime getTime() {
return this.time;
}

Expand All @@ -134,7 +141,8 @@ public Date getTime() {
* @param time the time
*/
@JsonProperty("time")
public void setTime(final Date time) {
@JsonDeserialize(using = Iso8601ToZonedDateTimeDeserializer.class)
public void setTime(final ZonedDateTime time) {
this.time = time;
}

Expand Down
13 changes: 6 additions & 7 deletions src/main/java/com/bitpay/sdk/model/invoice/MinerFeesItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;

/**
* The type Miner fees item.
Expand All @@ -18,8 +17,8 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class MinerFeesItem {

private BigDecimal satoshisPerByte;
private BigDecimal totalFee;
private Integer satoshisPerByte;
private Integer totalFee;
private Double fiatAmount;

/**
Expand All @@ -34,7 +33,7 @@ public MinerFeesItem() {
* @return the satoshis per byte
*/
@JsonIgnore
public BigDecimal getSatoshisPerByte() {
public Integer getSatoshisPerByte() {
return this.satoshisPerByte;
}

Expand All @@ -44,7 +43,7 @@ public BigDecimal getSatoshisPerByte() {
* @param satoshisPerByte the satoshis per byte
*/
@JsonProperty("satoshisPerByte")
public void setSatoshisPerByte(BigDecimal satoshisPerByte) {
public void setSatoshisPerByte(Integer satoshisPerByte) {
this.satoshisPerByte = satoshisPerByte;
}

Expand All @@ -54,7 +53,7 @@ public void setSatoshisPerByte(BigDecimal satoshisPerByte) {
* @return the total fee
*/
@JsonIgnore
public BigDecimal getTotalFee() {
public Integer getTotalFee() {
return this.totalFee;
}

Expand All @@ -64,7 +63,7 @@ public BigDecimal getTotalFee() {
* @param totalFee the total fee
*/
@JsonProperty("totalFee")
public void setTotalFee(BigDecimal totalFee) {
public void setTotalFee(Integer totalFee) {
this.totalFee = totalFee;
}

Expand Down
36 changes: 15 additions & 21 deletions src/main/java/com/bitpay/sdk/model/invoice/Refund.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
package com.bitpay.sdk.model.invoice;

import com.bitpay.sdk.model.ModelConfiguration;
import com.bitpay.sdk.util.serializer.Iso8601ToZonedDateTimeDeserializer;
import com.bitpay.sdk.util.serializer.ZonedDateTimeToIso8601Serializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.math.BigDecimal;
import java.util.Date;
import java.time.ZonedDateTime;

/**
* Fully paid invoices can be refunded via the merchant's authorization to issue a refund,
Expand All @@ -32,31 +36,17 @@ public class Refund {
private Boolean buyerPaysRefundFee;
private String reference = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private Double refundFee;
private Date lastRefundNotification;
private ZonedDateTime requestDate;
private ZonedDateTime lastRefundNotification;
private String notificationUrl = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private String refundAddress = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private String supportRequest = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private String txid = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private String type = ModelConfiguration.DEFAULT_NON_SENT_VALUE;

/**
* Amount to be refunded in terms of the transaction currency.
*/
private BigDecimal transactionAmount;

/**
* The refund fee expressed in terms of transaction currency.
*/
private BigDecimal transactionRefundFee;

/**
* The currency used for the invoice transaction.
*/
private String transactionCurrency = ModelConfiguration.DEFAULT_NON_SENT_VALUE;


private String id;
private Date requestDate;
private String status = ModelConfiguration.DEFAULT_NON_SENT_VALUE;


Expand Down Expand Up @@ -278,7 +268,8 @@ public void setId(final String id) {
*/
@JsonIgnore
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public Date getRequestDate() {
@JsonSerialize(using = ZonedDateTimeToIso8601Serializer.class)
public ZonedDateTime getRequestDate() {
return this.requestDate;
}

Expand All @@ -288,7 +279,8 @@ public Date getRequestDate() {
* @param requestDate the request date
*/
@JsonProperty("requestDate")
public void setRequestDate(final Date requestDate) {
@JsonDeserialize(using = Iso8601ToZonedDateTimeDeserializer.class)
public void setRequestDate(final ZonedDateTime requestDate) {
this.requestDate = requestDate;
}

Expand Down Expand Up @@ -394,7 +386,8 @@ public void setTransactionCurrency(final String transactionCurrency) {
*/
@JsonIgnore
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public Date getLastRefundNotification() {
@JsonSerialize(using = ZonedDateTimeToIso8601Serializer.class)
public ZonedDateTime getLastRefundNotification() {
return this.lastRefundNotification;
}

Expand All @@ -404,7 +397,8 @@ public Date getLastRefundNotification() {
* @param lastRefundNotification the last refund notification
*/
@JsonProperty("lastRefundNotification")
public void setLastRefundNotification(final Date lastRefundNotification) {
@JsonDeserialize(using = Iso8601ToZonedDateTimeDeserializer.class)
public void setLastRefundNotification(final ZonedDateTime lastRefundNotification) {
this.lastRefundNotification = lastRefundNotification;
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/bitpay/sdk/model/invoice/RefundStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ public class RefundStatus {
* No funds deducted, refund will not proceed automatically -
* the status must be changed via Update a Refund Request.
*/
public static final String Preview = "preview";
public static final String PREVIEW = "preview";
/**
* Funds deducted/allocated if immediate,
* will proceed when transactions are confirmed and the required data is collected.
*/
public static final String Created = "created";
public static final String CREATED = "created";
/**
* Refund is in process of being fulfilled.
*/
public static final String Pending = "pending";
public static final String PENDING = "pending";
/**
* Refund was canceled by merchant action. Immediate refunds cannot be canceled outside of preview state.
*/
public static final String Canceled = "canceled";
public static final String CANCELED = "canceled";
/**
* Refund was successfully processed.
*/
public static final String Success = "success";
public static final String SUCCESS = "success";
/**
* Refund failed during processing (this is really more of an internal state).
*/
public static final String Failure = "failure";
public static final String FAILURE = "failure";
}
22 changes: 15 additions & 7 deletions src/main/java/com/bitpay/sdk/model/invoice/RefundWebhook.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
package com.bitpay.sdk.model.invoice;

import com.bitpay.sdk.model.ModelConfiguration;
import com.bitpay.sdk.util.serializer.Iso8601ToZonedDateTimeDeserializer;
import com.bitpay.sdk.util.serializer.ZonedDateTimeToIso8601Serializer;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.time.ZonedDateTime;

/**
* The type Refund webhook.
Expand All @@ -25,11 +29,11 @@ public class RefundWebhook {
private String status = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private Double amount;
private String currency = ModelConfiguration.DEFAULT_NON_SENT_VALUE;
private Date lastRefundNotification;
private ZonedDateTime lastRefundNotification;
private Double refundFee;
private Boolean immediate;
private Boolean buyerPaysRefundFee;
private Date requestDate;
private ZonedDateTime requestDate;

/**
* Instantiates a new Refund webhook.
Expand Down Expand Up @@ -172,7 +176,8 @@ public void setCurrency(String currency) {
*/
@JsonProperty("lastRefundNotification")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public Date getLastRefundNotification() {
@JsonSerialize(using = ZonedDateTimeToIso8601Serializer.class)
public ZonedDateTime getLastRefundNotification() {
return this.lastRefundNotification;
}

Expand All @@ -182,7 +187,8 @@ public Date getLastRefundNotification() {
* @param lastRefundNotification the last refund notification
*/
@JsonProperty("lastRefundNotification")
public void setLastRefundNotification(Date lastRefundNotification) {
@JsonDeserialize(using = Iso8601ToZonedDateTimeDeserializer.class)
public void setLastRefundNotification(ZonedDateTime lastRefundNotification) {
this.lastRefundNotification = lastRefundNotification;
}

Expand Down Expand Up @@ -258,7 +264,8 @@ public void setBuyerPaysRefundFee(Boolean buyerPaysRefundFee) {
*/
@JsonProperty("requestDate")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public Date getRequestDate() {
@JsonSerialize(using = ZonedDateTimeToIso8601Serializer.class)
public ZonedDateTime getRequestDate() {
return this.requestDate;
}

Expand All @@ -268,7 +275,8 @@ public Date getRequestDate() {
* @param requestDate the request date
*/
@JsonProperty("requestDate")
public void setRequestDate(Date requestDate) {
@JsonDeserialize(using = Iso8601ToZonedDateTimeDeserializer.class)
public void setRequestDate(ZonedDateTime requestDate) {
this.requestDate = requestDate;
}

Expand Down
Loading

0 comments on commit 4ccadfb

Please sign in to comment.