Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bin/controller/BitPay.class
Binary file not shown.
Binary file modified bin/model/Invoice.class
Binary file not shown.
Binary file modified bin/test/BitPayTest.class
Binary file not shown.
122 changes: 13 additions & 109 deletions src/model/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,7 @@ public class Invoice {
private String _itemDesc = "";
private String _itemCode = "";
private boolean _physical = false;

private String _buyerName = "";
private String _buyerAddress1 = "";
private String _buyerAddress2 = "";
private String _buyerCity = "";
private String _buyerState = "";
private String _buyerZip = "";
private String _buyerCountry = "";
private String _buyerEmail = "";
private String _buyerPhone = "";
private InvoiceBuyer _buyer;

private String _id;
private String _url;
Expand Down Expand Up @@ -244,104 +235,17 @@ public void setPhysical(boolean _physical) {
this._physical = _physical;
}

@JsonProperty("buyerName")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerName() {
return _buyerName;
}

@JsonProperty("buyerName")
public void setBuyerName(String _buyerName) {
this._buyerName = _buyerName;
}

@JsonProperty("buyerAddress1")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerAddress1() {
return _buyerAddress1;
}

@JsonProperty("buyerAddress1")
public void setBuyerAddress1(String _buyerAddress1) {
this._buyerAddress1 = _buyerAddress1;
}

@JsonProperty("buyerAddress2")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerAddress2() {
return _buyerAddress2;
}

@JsonProperty("buyerAddress2")
public void setBuyerAddress2(String _buyerAddress2) {
this._buyerAddress2 = _buyerAddress2;
}

@JsonProperty("buyerCity")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerCity() {
return _buyerCity;
}

@JsonProperty("buyerCity")
public void setBuyerCity(String _buyerCity) {
this._buyerCity = _buyerCity;
}

@JsonProperty("buyerState")
@JsonProperty("buyer")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerState() {
return _buyerState;
}

@JsonProperty("buyerState")
public void setBuyerState(String _buyerState) {
this._buyerState = _buyerState;
}

@JsonProperty("buyerZip")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerZip() {
return _buyerZip;
}

@JsonProperty("buyerZip")
public void setBuyerZip(String _buyerZip) {
this._buyerZip = _buyerZip;
}

@JsonProperty("buyerCountry")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerCountry() {
return _buyerCountry;
}

@JsonProperty("buyerCountry")
public void setBuyerCountry(String _buyerCountry) {
this._buyerCountry = _buyerCountry;
}

@JsonProperty("buyerEmail")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerEmail() {
return _buyerEmail;
}

@JsonProperty("buyerEmail")
public void setBuyerEmail(String _buyerEmail) {
this._buyerEmail = _buyerEmail;
}
public InvoiceBuyer getBuyer() {
return _buyer;
}

@JsonProperty("buyer")
public void setBuyer(InvoiceBuyer _buyer) {
this._buyer = _buyer;
}

@JsonProperty("buyerPhone")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getBuyerPhone() {
return _buyerPhone;
}

@JsonProperty("buyerPhone")
public void setBuyerPhone(String _buyerPhone) {
this._buyerPhone = _buyerPhone;
}

// Response fields
//
Expand Down Expand Up @@ -471,17 +375,17 @@ public String getExceptionStatus() {
return _exceptionStatus;
}

@JsonProperty("exceptionStatus")
@JsonProperty("exceptionStatus")
public void setExceptionStatus(String _exceptionStatus) {
this._exceptionStatus = _exceptionStatus;
}

@JsonIgnore
@JsonIgnore
public InvoicePaymentUrls getPaymentUrls() {
return _paymentUrls;
}

@JsonProperty("paymentUrls")
@JsonProperty("paymentUrls")
public void setPaymentUrls(InvoicePaymentUrls _paymentUrls) {
this._paymentUrls = _paymentUrls;
}
Expand Down
119 changes: 119 additions & 0 deletions src/model/InvoiceBuyer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

public class InvoiceBuyer {

private String _name = "";
private String _address1 = "";
private String _address2 = "";
private String _locality = "";
private String _region = "";
private String _postalCode = "";
private String _country = "";
private String _email = "";
private String _phone = "";

public InvoiceBuyer() {}

@JsonProperty("name")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getName() {
return _name;
}

@JsonProperty("name")
public void setName(String _name) {
this._name = _name;
}

@JsonProperty("address1")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getAddress1() {
return _address1;
}

@JsonProperty("address1")
public void setAddress1(String _address1) {
this._address1 = _address1;
}

@JsonProperty("address2")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getAddress2() {
return _address2;
}

@JsonProperty("address2")
public void setaddress2(String _address2) {
this._address2 = _address2;
}

@JsonProperty("locality")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getLocality() {
return _locality;
}

@JsonProperty("locality")
public void setLocality(String _locality) {
this._locality = _locality;
}

@JsonProperty("region")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getRegion() {
return _region;
}

@JsonProperty("region")
public void setRegion(String _region) {
this._region = _region;
}

@JsonProperty("postalCode")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getPostalCode() {
return _postalCode;
}

@JsonProperty("postalCode")
public void setPostalCode(String _postalCode) {
this._postalCode = _postalCode;
}

@JsonProperty("country")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getCountry() {
return _country;
}

@JsonProperty("country")
public void setCountry(String _country) {
this._country = _country;
}

@JsonProperty("email")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getEmail() {
return _email;
}

@JsonProperty("email")
public void setEmail(String _email) {
this._email = _email;
}

@JsonProperty("phone")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public String getPhone() {
return _phone;
}

@JsonProperty("phone")
public void setPhone(String _phone) {
this._phone = _phone;
}

}
14 changes: 9 additions & 5 deletions src/test/BitPayTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;

import model.Invoice;
import model.InvoiceBuyer;
import model.Rate;
import model.Rates;

Expand All @@ -22,7 +23,7 @@ public class BitPayTest {
private static double BTC_EPSILON = .000000001;
private static double EPSILON = .001;

private static String pairingCode = "0u4pyWN";
private static String pairingCode = "FbaJTGU";
private static String clientName = "BitPay Java Library Tester";

@Before
Expand Down Expand Up @@ -149,9 +150,12 @@ public void testShouldGetInvoice()
@Test
public void testShouldCreateInvoiceWithAdditionalParams()
{
InvoiceBuyer buyer = new InvoiceBuyer();
buyer.setName("Satoshi");
buyer.setEmail("satoshi@bitpay.com");

Invoice invoice = new Invoice(100.0, "USD");
invoice.setBuyerName("Satoshi");
invoice.setBuyerEmail("satoshi@bitpay.com");
invoice.setBuyer(buyer);
invoice.setFullNotifications(true);
invoice.setNotificationEmail("satoshi@bitpay.com");
invoice.setPosData("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
Expand All @@ -163,8 +167,8 @@ public void testShouldCreateInvoiceWithAdditionalParams()
assertEquals(Invoice.STATUS_NEW, invoice.getStatus());
assertEquals(100.0, invoice.getPrice(), EPSILON);
assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", invoice.getPosData());
assertEquals("Satoshi", invoice.getBuyerName());
assertEquals("satoshi@bitpay.com", invoice.getBuyerEmail());
assertEquals("Satoshi", invoice.getBuyer().getName());
assertEquals("satoshi@bitpay.com", invoice.getBuyer().getEmail());
assertEquals(true, invoice.getFullNotifications());
assertEquals("satoshi@bitpay.com", invoice.getNotificationEmail());
}
Expand Down