Skip to content

Commit 15d2a44

Browse files
committed
added invoice-pdf endpoint in version 2
1 parent 40f6571 commit 15d2a44

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

client/src/main/java/io/apistax/client/APIstaxClient.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ public interface APIstaxClient {
135135
*/
136136
byte[] generateInvoicePdf(InvoicePayload payload) throws APIstaxException;
137137

138+
/**
139+
* Create a invoice PDF
140+
*
141+
* @param payload The invoice object to create a PDF from. (required)
142+
* @return byte[]
143+
* @throws APIstaxException if fails to make API call
144+
*/
145+
@Deprecated
146+
byte[] generateInvoicePdfV1(InvoicePayloadV1 payload) throws APIstaxException;
147+
138148
class Builder {
139149

140150
private String apiKey;

client/src/main/java/io/apistax/client/APIstaxClientImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ public byte[] generateSwissQrInvoice(SwissQrInvoicePayload payload, SwissQrInvoi
121121

122122
@Override
123123
public byte[] generateInvoicePdf(InvoicePayload payload) throws APIstaxException {
124+
return requestBinary("/v2/invoice-pdf", payload, "application/pdf");
125+
}
126+
127+
@Override
128+
@Deprecated
129+
public byte[] generateInvoicePdfV1(InvoicePayloadV1 payload) throws APIstaxException {
124130
return requestBinary("/v1/invoice-pdf", payload, "application/pdf");
125131
}
126132

client/src/main/java/io/apistax/client/APIstaxClientMock.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,9 @@ public byte[] generateSwissQrInvoice(SwissQrInvoicePayload swissQrInvoicePayload
156156
public byte[] generateInvoicePdf(InvoicePayload payload) throws APIstaxException {
157157
return "INVOICE_PDF".getBytes(StandardCharsets.UTF_8);
158158
}
159+
160+
@Override
161+
public byte[] generateInvoicePdfV1(InvoicePayloadV1 payload) throws APIstaxException {
162+
return "INVOICE_PDF_V1".getBytes(StandardCharsets.UTF_8);
163+
}
159164
}

0 commit comments

Comments
 (0)