Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
regisbamba authored Apr 14, 2019
1 parent e15a170 commit f377e34
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ collections.getAccountBalance().subscribe(
You can also consume error events in case of the API request failed.
```java
collections.createApiUser().subscribe(
new Consumer<AccountBalance>() {
@Override
public void accept(AccountBalance accountBalance) { // This function executes in case of success.
new Consumer<AccountBalance>() {
@Override
public void accept(AccountBalance accountBalance) { // This function executes in case of success.
System.out.println(accountBalance.getAvailableBalance()); // 900
}
},
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception { // This function executes in case of errors.
Expand All @@ -93,13 +93,13 @@ collections.getAccountBalance().subscribe(accountBalance -> { // This functi

```java
collections.getAccountBalance().subscribe(
accountBalance -> { // This function executes in case of success.
System.out.println(accountBalance.getAvailableBalance()); // 900
},
accountBalance -> { // This function executes in case of success.
System.out.println(accountBalance.getAvailableBalance()); // 900
},
throwable -> { // This function executes in case of error.
RequestException e = (RequestException) throwable; // Cast the throwable to RequestException to get the HTTP code and message returned by the MoMo API.
System.out.println(e.getCode()); // 401
System.out.println(e.getMessage()); // Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.
RequestException e = (RequestException) throwable; // Cast the throwable to RequestException to get the HTTP code and message returned by the MoMo API.
System.out.println(e.getCode()); // 401
System.out.println(e.getMessage()); // Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.
}
);
```
Expand Down Expand Up @@ -233,10 +233,10 @@ Documentation: https://momodeveloper.mtn.com/docs/services/collection/operations

```java
collections.getRequestToPay(referenceId).subscribe(
requestToPay -> {
System.out.println(requestToPay.getFinancialTransactionId()); // 521734614
System.out.println(requestToPay.getStatus()); // SUCCESSFUL
}
requestToPay -> {
System.out.println(requestToPay.getFinancialTransactionId()); // 521734614
System.out.println(requestToPay.getStatus()); // SUCCESSFUL
}
);
```

Expand All @@ -247,8 +247,8 @@ Documentation: https://momodeveloper.mtn.com/docs/services/collection/operations

```java
collections.getAccountBalance().subscribe(accountBalance -> {
System.out.println(accountBalance.getAvailableBalance()); // 900
System.out.println(accountBalance.getCurrency()); // EUR
System.out.println(accountBalance.getAvailableBalance()); // 900
System.out.println(accountBalance.getCurrency()); // EUR
});
```

Expand Down

0 comments on commit f377e34

Please sign in to comment.