Skip to content

Commit 8d1052e

Browse files
committed
Removed boolean field complete in payInvoice method
1 parent 85df92b commit 8d1052e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/main/java/com/bitpay/sdk/Client.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,16 +468,12 @@ public Invoice updateInvoice(String invoiceId, String buyerSms, String smsCode,
468468
* @throws BitPayException BitPayException class
469469
* @throws InvoiceUpdateException InvoiceUpdateException class
470470
*/
471-
public Invoice payInvoice(String invoiceId, String status, Boolean complete) throws BitPayException, InvoiceUpdateException {
471+
public Invoice payInvoice(String invoiceId, String status) throws BitPayException, InvoiceUpdateException {
472472
final Map<String, Object> params = new HashMap<>();
473473
params.put("token", this.getAccessToken(Facade.Merchant));
474-
params.put("status", status);
475-
if (complete == null) {
476-
throw new InvoiceUpdateException(null, "It is required to define the whether the invoice will be set to \"complete\" or \"confirmed\".");
474+
if (status != null) {
475+
params.put("status", status);
477476
}
478-
479-
params.put("complete", complete);
480-
481477
ObjectMapper mapper = new ObjectMapper();
482478
String json;
483479
Invoice invoice;

src/test/java/test/BitPayTestMerchant.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,14 @@ public void testShouldCreateAndPayInvoice() {
311311
Invoice invoice = new Invoice(1.0, "USD");
312312
try {
313313
basicInvoice = bitpay.createInvoice(invoice);
314-
paidInvoice = bitpay.payInvoice(basicInvoice.getId(), "confirmed", true);
314+
paidInvoice = bitpay.payInvoice(basicInvoice.getId(), "confirmed");
315315
} catch (Exception e) {
316316
e.printStackTrace();
317317
fail(e.getMessage());
318318
}
319319
assertNotNull(basicInvoice.getId());
320320
assertNotNull(paidInvoice.getId());
321-
assertEquals(paidInvoice.getStatus(), InvoiceStatus.Complete);
321+
assertEquals(paidInvoice.getStatus(), InvoiceStatus.Confirmed);
322322
}
323323

324324
@Test

0 commit comments

Comments
 (0)