Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A new resource called Order is introduced. This can be used for integrating ChargeBee with any shipping/order management application (like ShipStation). Orders are not automatically generated or updated by ChargeBee currently. They have to be created/updated either via api or merchant web console (a.k.a admin console). An order can be created against an invoice irrespective of the status of the invoice and an invoice can have multiple orders associated with it. See https://apidocs.chargebee.com/docs/api/orders for details. **API Updates**: Ability to filter Invoices with painOnAfter. see https://apidocs.chargebee.com/docs/api/invoices#list_invoices.
- Loading branch information
Showing
10 changed files
with
329 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+50.6 KB
dist/chargebee-java-1.1.50-sources.jar → dist/chargebee-java-1.1.51-sources.jar
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
package com.chargebee.models; | ||
|
||
import com.chargebee.*; | ||
import com.chargebee.internal.*; | ||
import com.chargebee.internal.HttpUtil.Method; | ||
import com.chargebee.models.enums.*; | ||
import org.json.*; | ||
import java.io.*; | ||
import java.sql.Timestamp; | ||
import java.util.*; | ||
|
||
public class Order extends Resource<Order> { | ||
|
||
public enum Status { | ||
NEW, | ||
PROCESSING, | ||
COMPLETE, | ||
CANCELLED, | ||
VOIDED, | ||
_UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a | ||
java-client version incompatibility. We suggest you to upgrade to the latest version */ | ||
} | ||
|
||
//Constructors | ||
//============ | ||
|
||
public Order(String jsonStr) { | ||
super(jsonStr); | ||
} | ||
|
||
public Order(JSONObject jsonObj) { | ||
super(jsonObj); | ||
} | ||
|
||
// Fields | ||
//======= | ||
|
||
public String id() { | ||
return reqString("id"); | ||
} | ||
|
||
public String invoiceId() { | ||
return reqString("invoice_id"); | ||
} | ||
|
||
public Status status() { | ||
return optEnum("status", Status.class); | ||
} | ||
|
||
public String referenceId() { | ||
return optString("reference_id"); | ||
} | ||
|
||
public String fulfillmentStatus() { | ||
return optString("fulfillment_status"); | ||
} | ||
|
||
public String note() { | ||
return optString("note"); | ||
} | ||
|
||
public String trackingId() { | ||
return optString("tracking_id"); | ||
} | ||
|
||
public String batchId() { | ||
return optString("batch_id"); | ||
} | ||
|
||
public String createdBy() { | ||
return optString("created_by"); | ||
} | ||
|
||
public Timestamp createdAt() { | ||
return reqTimestamp("created_at"); | ||
} | ||
|
||
public Timestamp statusUpdateAt() { | ||
return reqTimestamp("status_update_at"); | ||
} | ||
|
||
// Operations | ||
//=========== | ||
|
||
public static CreateRequest create() throws IOException { | ||
String uri = uri("orders"); | ||
return new CreateRequest(Method.POST, uri); | ||
} | ||
|
||
public static UpdateRequest update(String id) throws IOException { | ||
String uri = uri("orders", nullCheck(id)); | ||
return new UpdateRequest(Method.POST, uri); | ||
} | ||
|
||
public static Request retrieve(String id) throws IOException { | ||
String uri = uri("orders", nullCheck(id)); | ||
return new Request(Method.GET, uri); | ||
} | ||
|
||
public static ListRequest list() throws IOException { | ||
String uri = uri("orders"); | ||
return new ListRequest(uri); | ||
} | ||
|
||
public static ListRequest ordersForInvoice(String id) throws IOException { | ||
String uri = uri("invoices", nullCheck(id), "orders"); | ||
return new ListRequest(uri); | ||
} | ||
|
||
|
||
// Operation Request Classes | ||
//========================== | ||
|
||
public static class CreateRequest extends Request<CreateRequest> { | ||
|
||
private CreateRequest(Method httpMeth, String uri) { | ||
super(httpMeth, uri); | ||
} | ||
|
||
public CreateRequest id(String id) { | ||
params.addOpt("id", id); | ||
return this; | ||
} | ||
|
||
|
||
public CreateRequest invoiceId(String invoiceId) { | ||
params.add("invoice_id", invoiceId); | ||
return this; | ||
} | ||
|
||
|
||
public CreateRequest status(Status status) { | ||
params.addOpt("status", status); | ||
return this; | ||
} | ||
|
||
|
||
public CreateRequest referenceId(String referenceId) { | ||
params.addOpt("reference_id", referenceId); | ||
return this; | ||
} | ||
|
||
|
||
public CreateRequest fulfillmentStatus(String fulfillmentStatus) { | ||
params.addOpt("fulfillment_status", fulfillmentStatus); | ||
return this; | ||
} | ||
|
||
|
||
public CreateRequest note(String note) { | ||
params.addOpt("note", note); | ||
return this; | ||
} | ||
|
||
|
||
public CreateRequest trackingId(String trackingId) { | ||
params.addOpt("tracking_id", trackingId); | ||
return this; | ||
} | ||
|
||
|
||
public CreateRequest batchId(String batchId) { | ||
params.addOpt("batch_id", batchId); | ||
return this; | ||
} | ||
|
||
|
||
@Override | ||
public Params params() { | ||
return params; | ||
} | ||
} | ||
|
||
public static class UpdateRequest extends Request<UpdateRequest> { | ||
|
||
private UpdateRequest(Method httpMeth, String uri) { | ||
super(httpMeth, uri); | ||
} | ||
|
||
public UpdateRequest status(Status status) { | ||
params.addOpt("status", status); | ||
return this; | ||
} | ||
|
||
|
||
public UpdateRequest referenceId(String referenceId) { | ||
params.addOpt("reference_id", referenceId); | ||
return this; | ||
} | ||
|
||
|
||
public UpdateRequest fulfillmentStatus(String fulfillmentStatus) { | ||
params.addOpt("fulfillment_status", fulfillmentStatus); | ||
return this; | ||
} | ||
|
||
|
||
public UpdateRequest note(String note) { | ||
params.addOpt("note", note); | ||
return this; | ||
} | ||
|
||
|
||
public UpdateRequest trackingId(String trackingId) { | ||
params.addOpt("tracking_id", trackingId); | ||
return this; | ||
} | ||
|
||
|
||
public UpdateRequest batchId(String batchId) { | ||
params.addOpt("batch_id", batchId); | ||
return this; | ||
} | ||
|
||
|
||
@Override | ||
public Params params() { | ||
return params; | ||
} | ||
} | ||
|
||
} |