Skip to content

Commit

Permalink
* * *
Browse files Browse the repository at this point in the history
** APIs added**:
A new endpoint to create Credit Note is added. See : https://apidocs.chargebee.com/docs/api/credit_notes#create_credit_note

A new endpoint to write off Invoice is added. See : https://apidocs.chargebee.com/docs/api/invoices#write_off_an_invoice

** APIs updated**:
The attribute "forward_url" is given as input for Create a Portal Session API.
See : https://apidocs.chargebee.com/docs/api/portal_sessions#create_a_portal_session
  • Loading branch information
SangeethaBaskaran committed Sep 3, 2016
1 parent 7be05a7 commit 83ebfd8
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 3 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
###v2.1.3 (2016-09-03)
* * *
** APIs added**:
A new endpoint to create Credit Note is added. See : https://apidocs.chargebee.com/docs/api/credit_notes#create_credit_note

A new endpoint to write off Invoice is added. See : https://apidocs.chargebee.com/docs/api/invoices#write_off_an_invoice

** APIs updated**:
The attribute "forward_url" is given as input for Create a Portal Session API.
See : https://apidocs.chargebee.com/docs/api/portal_sessions#create_a_portal_session


###v2.1.2 (2016-08-25)
* * *

Expand Down
2 changes: 1 addition & 1 deletion ChargeBee/Api/ApiConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public sealed class ApiConfig
{
public static string DomainSuffix = "chargebee.com";
public static string Proto = "https";
public static string Version = "2.1.2";
public static string Version = "2.1.3";
public static readonly string API_VERSION = "v2";

public string ApiKey { get; set; }
Expand Down
58 changes: 58 additions & 0 deletions ChargeBee/Models/CreditNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public class CreditNote : Resource


#region Methods
public static CreateRequest Create()
{
string url = ApiUtil.BuildUrl("credit_notes");
return new CreateRequest(url, HttpMethod.POST);
}
public static EntityRequest<Type> Retrieve(string id)
{
string url = ApiUtil.BuildUrl("credit_notes", CheckNull(id));
Expand Down Expand Up @@ -139,6 +144,59 @@ public List<CreditNoteAllocation> Allocations
#endregion

#region Requests
public class CreateRequest : EntityRequest<CreateRequest>
{
public CreateRequest(string url, HttpMethod method)
: base(url, method)
{
}

public CreateRequest ReferenceInvoiceId(string referenceInvoiceId)
{
m_params.Add("reference_invoice_id", referenceInvoiceId);
return this;
}
public CreateRequest Total(int total)
{
m_params.AddOpt("total", total);
return this;
}
public CreateRequest Type(TypeEnum type)
{
m_params.Add("type", type);
return this;
}
public CreateRequest ReasonCode(ReasonCodeEnum reasonCode)
{
m_params.Add("reason_code", reasonCode);
return this;
}
public CreateRequest CustomerNotes(string customerNotes)
{
m_params.AddOpt("customer_notes", customerNotes);
return this;
}
public CreateRequest LineItemReferenceLineItemId(int index, string lineItemReferenceLineItemId)
{
m_params.Add("line_items[reference_line_item_id][" + index + "]", lineItemReferenceLineItemId);
return this;
}
public CreateRequest LineItemUnitAmount(int index, int lineItemUnitAmount)
{
m_params.Add("line_items[unit_amount][" + index + "]", lineItemUnitAmount);
return this;
}
public CreateRequest LineItemQuantity(int index, int lineItemQuantity)
{
m_params.Add("line_items[quantity][" + index + "]", lineItemQuantity);
return this;
}
public CreateRequest LineItemDescription(int index, string lineItemDescription)
{
m_params.AddOpt("line_items[description][" + index + "]", lineItemDescription);
return this;
}
}
public class CreditNoteListRequest : ListRequestBase<CreditNoteListRequest>
{
public CreditNoteListRequest(string url)
Expand Down
18 changes: 18 additions & 0 deletions ChargeBee/Models/Invoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ public static VoidInvoiceRequest VoidInvoice(string id)
string url = ApiUtil.BuildUrl("invoices", CheckNull(id), "void");
return new VoidInvoiceRequest(url, HttpMethod.POST);
}
public static WriteOffRequest WriteOff(string id)
{
string url = ApiUtil.BuildUrl("invoices", CheckNull(id), "write_off");
return new WriteOffRequest(url, HttpMethod.POST);
}
public static DeleteRequest Delete(string id)
{
string url = ApiUtil.BuildUrl("invoices", CheckNull(id), "delete");
Expand Down Expand Up @@ -693,6 +698,19 @@ public VoidInvoiceRequest Comment(string comment)
return this;
}
}
public class WriteOffRequest : EntityRequest<WriteOffRequest>
{
public WriteOffRequest(string url, HttpMethod method)
: base(url, method)
{
}

public WriteOffRequest Comment(string comment)
{
m_params.AddOpt("comment", comment);
return this;
}
}
public class DeleteRequest : EntityRequest<DeleteRequest>
{
public DeleteRequest(string url, HttpMethod method)
Expand Down
5 changes: 5 additions & 0 deletions ChargeBee/Models/PortalSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public CreateRequest RedirectUrl(string redirectUrl)
m_params.Add("redirect_url", redirectUrl);
return this;
}
public CreateRequest ForwardUrl(string forwardUrl)
{
m_params.AddOpt("forward_url", forwardUrl);
return this;
}
public CreateRequest CustomerId(string customerId)
{
m_params.Add("customer[id]", customerId);
Expand Down
4 changes: 2 additions & 2 deletions ChargeBee/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.2")]
[assembly: AssemblyFileVersion("2.1.2")]
[assembly: AssemblyVersion("2.1.3")]
[assembly: AssemblyFileVersion("2.1.3")]
[assembly: AssemblyCompanyAttribute("ChargeBee Inc")]
[assembly: AssemblyProductAttribute("ChargeBee")]
[assembly: AssemblyCopyrightAttribute("©ChargeBee Inc. All Rights Reserved.")]
Binary file removed dist/ChargeBee-2.1.2.dll
Binary file not shown.
Binary file added dist/ChargeBee-2.1.3.dll
Binary file not shown.
Binary file modified lib/ChargeBee.dll
Binary file not shown.

0 comments on commit 83ebfd8

Please sign in to comment.