Skip to content

Commit 85df92b

Browse files
committed
Fixed pay invoice method and updated testcase
1 parent 3abac5d commit 85df92b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,10 @@ 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, Boolean complete) throws BitPayException, InvoiceUpdateException {
471+
public Invoice payInvoice(String invoiceId, String status, Boolean complete) throws BitPayException, InvoiceUpdateException {
472472
final Map<String, Object> params = new HashMap<>();
473473
params.put("token", this.getAccessToken(Facade.Merchant));
474+
params.put("status", status);
474475
if (complete == null) {
475476
throw new InvoiceUpdateException(null, "It is required to define the whether the invoice will be set to \"complete\" or \"confirmed\".");
476477
}

src/test/java/test/BitPayTestMerchant.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public void testShouldCreateAndPayInvoice() {
311311
Invoice invoice = new Invoice(1.0, "USD");
312312
try {
313313
basicInvoice = bitpay.createInvoice(invoice);
314-
paidInvoice = bitpay.payInvoice(basicInvoice.getId(), true);
314+
paidInvoice = bitpay.payInvoice(basicInvoice.getId(), "confirmed", true);
315315
} catch (Exception e) {
316316
e.printStackTrace();
317317
fail(e.getMessage());

0 commit comments

Comments
 (0)