Web services/POS Payment

Here is an example for performing a payment through an external channel.
To make this example work, some configurations are required in the Cyclos application:

Then, this code should run when using this member to perform the payment.

// The factory should be cached and shared between calls
CyclosWebServicesClientFactory factory = new CyclosWebServicesClientFactory();
factory.setServerRootUrl("http://localhost:8080/cyclos");
PaymentWebService paymentWebService = factory.getPaymentWebService();

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PaymentParameters params = new PaymentParameters();

// Prompt the parameters
System.out.print("Amount: ");
params.setAmount(new BigDecimal(in.readLine()));
System.out.print("Login name: "); //This user should have the channel set as enabled
params.setFromMember(in.readLine());
System.out.print("PIN: ");
params.setCredentials(in.readLine());

// Perform the payment
PaymentResult result = paymentWebService.doPayment(params);
switch (result.getStatus()) {
    case PROCESSED:
        String transactionNumber = result.getTransfer().getTransactionNumber();
        System.out.println("The payment was successful. The transaction number is " + transactionNumber);
        break;
    case PENDING_AUTHORIZATION:
        System.out.println("The payment is awaiting authorization");
        break;
    case INVALID_CHANNEL:
        System.out.println("The given user cannot access this channel");
        break;
    case INVALID_CREDENTIALS:
        System.out.println("You have entered an invalid PIN");
        break;
    case BLOCKED_CREDENTIALS:
        System.out.println("Your PIN is blocked by exceeding trials");
        break;
    case INVALID_PARAMETERS:
        System.out.println("Please, check the given parameters");
        break;
    case NOT_ENOUGH_CREDITS:
        System.out.println("You don't have enough funds for this payment");
        break;
    case MAX_DAILY_AMOUNT_EXCEEDED:
        System.out.println("You have already exceeded the maximum amount today");
        break;
    default:
        System.out.println("There was an error on the payment: " + result.getStatus());
}