public PaymentWS createPaymentWS(Integer userId, Date date, String note) throws Exception { JbillingAPI api = JbillingAPIFactory.getAPI(); PaymentWS payment = new PaymentWS(); payment.setAmount(new BigDecimal("15.00")); payment.setIsRefund(new Integer(0)); payment.setMethodId(Constants.PAYMENT_METHOD_CHEQUE); payment.setPaymentDate(date); payment.setCreateDatetime(date); payment.setResultId(Constants.RESULT_ENTERED); payment.setCurrencyId(new Integer(1)); payment.setUserId(userId); payment.setPaymentNotes(note); payment.setPaymentPeriod(new Integer(1)); PaymentInformationWS cheque = com.sapienter.jbilling.server.user.WSTest.createCheque("ws bank", "2232-2323-2323", date); payment.getPaymentInstruments().add(cheque); System.out.println("Applying payment"); Integer ret = api.applyPayment(payment, new Integer(35)); System.out.println("Created payemnt " + ret); assertNotNull("Didn't get the payment id", ret); payment.setId(ret); return payment; }