diff --git a/pom.xml b/pom.xml index cb7c248..2df19a3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.bandwidth.sdk bandwidth-java-iris-sdk - 4.0.0 + 4.1.1 jar bandwidth-java-iris-sdk Java SDK for use with the IRIS API. diff --git a/src/main/java/com/bandwidth/iris/sdk/model/CombinedSearchAndOrderType.java b/src/main/java/com/bandwidth/iris/sdk/model/CombinedSearchAndOrderType.java new file mode 100644 index 0000000..80d4958 --- /dev/null +++ b/src/main/java/com/bandwidth/iris/sdk/model/CombinedSearchAndOrderType.java @@ -0,0 +1,138 @@ +package com.bandwidth.iris.sdk.model; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "CombinedSearchAndOrderType") +@XmlAccessorType(XmlAccessType.FIELD) +public class CombinedSearchAndOrderType extends BaseOrderType { + @XmlElement(name = "AreaCode") + private String areaCode; + + public String getAreaCode() { + return areaCode; + } + + @XmlElement(name = "City") + private String city; + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @XmlElement(name = "EnableLCA") + private boolean enableLCA; + + public boolean isEnableLCA() { + return enableLCA; + } + + public void setEnableLCA(boolean enableLCA) { + this.enableLCA = enableLCA; + } + + @XmlElement(name = "EndsIn") + private boolean endsIn; + + public boolean isEndsIn() { + return endsIn; + } + + public void setEndsIn(boolean endsIn) { + this.endsIn = endsIn; + } + + @XmlElement(name = "LATA") + private String lata; + + public String getLata() { + return lata; + } + + public void setLata(String lata) { + this.lata = lata; + } + + @XmlElement(name = "LocalVanity") + private String localVanity; + + public String getLocalVanity() { + return localVanity; + } + + public void setLocalVanity(String localVanity) { + this.localVanity = localVanity; + } + + @XmlElement(name = "NpaNxx") + private String npaNxx; + + public String getNpaNxx() { + return npaNxx; + } + + public void setNpaNxx(String npaNxx) { + this.npaNxx = npaNxx; + } + + @XmlElement(name = "NpaNxxX") + private String npaNxxX; + + public String getNpaNxxX() { + return npaNxxX; + } + + public void setNpaNxxX(String npaNxxX) { + this.npaNxxX = npaNxxX; + } + + @XmlElement(name = "Quantity") + private int quantity; + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + @XmlElement(name = "RateCenter") + private String rateCenter; + + public String getRateCenter() { + return rateCenter; + } + + public void setRateCenter(String rateCenter) { + this.rateCenter = rateCenter; + } + + @XmlElement(name = "State") + private String state; + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + @XmlElement(name = "Zip") + private String zip; + + public String getZip() { + return zip; + } + + public void setZip(String zip) { + this.zip = zip; + } +} diff --git a/src/main/java/com/bandwidth/iris/sdk/model/Order.java b/src/main/java/com/bandwidth/iris/sdk/model/Order.java index fe4af24..86a8452 100644 --- a/src/main/java/com/bandwidth/iris/sdk/model/Order.java +++ b/src/main/java/com/bandwidth/iris/sdk/model/Order.java @@ -49,6 +49,9 @@ public class Order extends BaseModel { private TollFreeWildCharSearchAndOrderType tollFreeWildCharSearchAndOrderType; @XmlElement(name = "ZIPSearchAndOrderType") private ZIPSearchAndOrderType zipSearchAndOrderType; + @XmlElement(name = "CombinedSearchAndOrderType") + private CombinedSearchAndOrderType combinedSearchAndOrderType; + public static OrderResponse create(IrisClient client, Order order) throws Exception { OrderResponse orderResponse = client @@ -208,6 +211,14 @@ public void setZipSearchAndOrderType(ZIPSearchAndOrderType zipSearchAndOrderType this.zipSearchAndOrderType = zipSearchAndOrderType; } + public CombinedSearchAndOrderType getCombinedSearchAndOrderType() { + return combinedSearchAndOrderType; + } + + public void setCombinedSearchAndOrderType(CombinedSearchAndOrderType combinedSearchAndOrderType) { + this.combinedSearchAndOrderType = combinedSearchAndOrderType; + } + public void addNote(Note note) throws Exception { client.put(client.buildAccountModelUri(new String[] { IrisPath.ORDERS_URI_PATH, id, "notes" }), note); } diff --git a/src/test/java/com/bandwidth/iris/sdk/IrisClientTestUtils.java b/src/test/java/com/bandwidth/iris/sdk/IrisClientTestUtils.java index 111382d..abb91d1 100644 --- a/src/test/java/com/bandwidth/iris/sdk/IrisClientTestUtils.java +++ b/src/test/java/com/bandwidth/iris/sdk/IrisClientTestUtils.java @@ -483,6 +483,7 @@ public class IrisClientTestUtils { * Order Xmls */ public static String validOrderResponseXml = "A New Order2014-10-14T17:58:15.299Zfalsesomeid2052865046false2858"; + public static String validCombinedOrderResponseXml = "Test CombinedSearchAndOrderType Order2014-10-14T17:58:15.299Zfalsesomeidfalse1DOVERNHfalse2858"; public static String validRateCenterOrderResponseXml = "Test RateCenterSearchAndOrderType Order2014-10-14T17:58:15.299Zfalsesomeidfalse1DOVERNHfalse2858"; public static String validOrderResponseErrorXml = "0testapi5018The entire quantity of telephone numbers ordered is unavailable2022-02-17T15:28:24.152Z2022-02-17T15:28:24.152ZerroridMyTestOrderId2022-02-17T15:28:24.026Z223787falsetrue1DOVERNHtrue56984FAILED1 number requested1"; public static String validOrderNotesResponseXml = "178468userAdding a note2014-11-19T21:02:26.000Z"; diff --git a/src/test/java/com/bandwidth/iris/sdk/OrderTests.java b/src/test/java/com/bandwidth/iris/sdk/OrderTests.java index 35a3286..03d9643 100644 --- a/src/test/java/com/bandwidth/iris/sdk/OrderTests.java +++ b/src/test/java/com/bandwidth/iris/sdk/OrderTests.java @@ -152,4 +152,30 @@ public void rateCenterSearchAndOrderTypeTestCreate() throws Exception { assertEquals(createdOrder.getOrder().getRateCenterSearchAndOrderType().getRateCenter(), "DOVER"); } + @Test + public void CombinedSearchAndOrderTypeTestCreate() throws Exception { + String ordersUrl = "/v1.0/accounts/accountId/orders"; + stubFor(post(urlMatching(ordersUrl)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/xml") + .withBody(IrisClientTestUtils.validCombinedOrderResponseXml))); + + Order order = new Order(); + order.setName("Test CombinedSearchAndOrderType Order"); + + CombinedSearchAndOrderType combinedSearchAndOrderType = new CombinedSearchAndOrderType(); + combinedSearchAndOrderType.setEnableLCA(false); + combinedSearchAndOrderType.setQuantity(1); + combinedSearchAndOrderType.setRateCenter("DOVER"); // No inventory available here + combinedSearchAndOrderType.setState("NH"); + + order.setCombinedSearchAndOrderType(combinedSearchAndOrderType); + + OrderResponse createdOrder = Order.create(getDefaultClient(), order); + assertEquals(createdOrder.getOrder().getName(), "Test CombinedSearchAndOrderType Order"); + assertEquals(createdOrder.getOrder().getCombinedSearchAndOrderType().getRateCenter(), "DOVER"); + } + + }