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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.cloudesire.platform.apiclient.dto.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel( description = "Perform an operation on an invoice" )
public class InvoicePatchDTO extends DTO
{
@ApiModelProperty( "Update operation" )
private InvoicePatchAction action;

public InvoicePatchDTO( InvoicePatchAction action )
{
this.action = action;
}

public InvoicePatchDTO()
{
}

public InvoicePatchAction getAction()
{
return action;
}

public enum InvoicePatchAction
{
@ApiModelProperty( "Reissue the first invoice of a subscription" )
REISSUE
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package com.cloudesire.platform.apiclient.dto.model.enums;

import io.swagger.annotations.ApiModelProperty;

public enum InvoiceOperationType
{
PAID, // Set the Invoice paid
PAY, // Customer can then pay the invoice!
@ApiModelProperty( "Set the invoice to paid" )
PAID,

@ApiModelProperty( "Pay the invoice" )
PAY,

/**
* Download invoice PDF
*/
@ApiModelProperty( "Download invoice PDF" )
PDF,

/**
* (re)generate invoice PDF
*/
MAKE_PDF
@ApiModelProperty( "(re)generate invoice PDF" )
MAKE_PDF,

@ApiModelProperty( "Reissue the invoice" )
REISSUE
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public enum InvoiceStatus
@ApiModelProperty( "Payment expired" ) EXPIRED,
@ApiModelProperty( "Payment received" ) PAID;

public static InvoiceStatus[] paid()
{
return new InvoiceStatus[] { DELAYED, PAID };
}

public static InvoiceStatus[] unpaid()
{
return new InvoiceStatus[] { PENDING, REQUIRES_ACTION, REQUIRES_CAPTURE, UNPAID, EXPIRED };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.cloudesire.platform.apiclient.dto.model.dto.CardDataDTO;
import com.cloudesire.platform.apiclient.dto.model.dto.InvoiceDTO;
import com.cloudesire.platform.apiclient.dto.model.dto.InvoicePatchDTO;
import com.cloudesire.platform.apiclient.dto.model.patch.InvoicePaymentReferenceDTO;
import com.cloudesire.platform.apiclient.query.InvoiceQuery;
import okhttp3.ResponseBody;
Expand Down Expand Up @@ -51,6 +52,9 @@ public interface InvoiceApi
@GET( "invoice/{id}/refresh" )
Call<String> refreshPayment( @Path( "id" ) int id );

@PATCH( "invoice/{id}" )
Call<Void> patch( @Path( "id" ) int id, @Body InvoicePatchDTO patch );

@PATCH( "invoice/{id}/pay" )
Call<Void> setPaid( @Path( "id" ) int id, @Body InvoicePaymentReferenceDTO input );

Expand Down