Skip to content

Commit 46a1e43

Browse files
committed
Add Javadocs for Non-Ui payment callbacks
1 parent 9614a2c commit 46a1e43

File tree

16 files changed

+450
-8
lines changed

16 files changed

+450
-8
lines changed
Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,71 @@
11
package com.flutterwave.raveandroid.rave_presentation.account;
22

3+
import android.webkit.WebResourceRequest;
4+
import android.webkit.WebView;
5+
36
import androidx.annotation.Nullable;
47

58
import com.flutterwave.raveandroid.rave_core.models.Bank;
69

710
import java.util.List;
811

912
public interface AccountPaymentCallback {
13+
/**
14+
* Passes a list of banks available for this payment method.
15+
*
16+
* @param banks List of banks.
17+
*/
1018
void onBanksListRetrieved(List<Bank> banks);
1119

20+
/**
21+
* Called when there is an issue retrieving the list of banks.
22+
*
23+
* @param message
24+
*/
1225
void onGetBanksRequestFailed(String message);
1326

27+
/**
28+
* Called to indicate that a background task is running, e.g. a network call.
29+
* This should typically show or hide a progress bar.
30+
*
31+
* @param active If true, background task is running. If false, background task has stopped
32+
*/
1433
void showProgressIndicator(boolean active);
1534

35+
/**
36+
* Called to trigger an otp collection. The OTP should be collected from the user and passed to
37+
* the PaymentManager using {@link AccountPaymentManager#submitOtp(String)} to continue the payment.
38+
*/
1639
void collectOtp(String message);
1740

41+
/**
42+
* Called to display a {@link android.webkit.WebView} for charges that require webpage authentication.
43+
* When the payment is completed, the authentication page redirects to a {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined url}
44+
* with the payment details appended to the url.
45+
* <p>
46+
* You should override the webview client's {@link android.webkit.WebViewClient#shouldOverrideUrlLoading(WebView, WebResourceRequest)} shouldOverrideUrlLoading}
47+
* function to check if the {@link WebResourceRequest#getUrl() url being loaded} contains the
48+
* {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined redirect url}.
49+
* <p>
50+
* If it does, it means the transaction has been completed and you can now call {@link AccountPaymentManager#onWebpageAuthenticationComplete()} to check the transaction status.
51+
*
52+
* @param authenticationUrl The url to the authentication page
53+
*/
54+
void showAuthenticationWebPage(String authenticationUrl);
55+
56+
/**
57+
* Called when an error occurs with the payment. The error message can be displayed to the users.
58+
*
59+
* @param errorMessage A message describing the error
60+
* @param flwRef The Flutterwave reference to the transaction.
61+
*/
1862
void onError(String errorMessage, @Nullable String flwRef);
1963

64+
/**
65+
* Called when the transaction has been completed successfully.
66+
*
67+
* @param flwRef The Flutterwave reference to the transaction.
68+
*/
2069
void onSuccessful(String flwRef);
2170

22-
void showAuthenticationWebPage(String authenticationUrl);
2371
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
package com.flutterwave.raveandroid.rave_presentation.ach;
22

3+
import android.webkit.WebResourceRequest;
4+
import android.webkit.WebView;
5+
36
import androidx.annotation.Nullable;
47

58
public interface AchPaymentCallback {
9+
10+
/**
11+
* Called to indicate that a background task is running, e.g. a network call.
12+
* This should typically show or hide a progress bar.
13+
*
14+
* @param active If true, background task is running. If false, background task has stopped
15+
*/
616
void showProgressIndicator(boolean active);
717

18+
/**
19+
* Called when an error occurs with the payment. The error message can be displayed to the users.
20+
*
21+
* @param errorMessage A message describing the error
22+
* @param flwRef The Flutterwave reference to the transaction.
23+
*/
824
void onError(String errorMessage, @Nullable String flwRef);
925

26+
/**
27+
* Called when the transaction has been completed successfully.
28+
*
29+
* @param flwRef The Flutterwave reference to the transaction.
30+
*/
1031
void onSuccessful(String flwRef);
1132

33+
/**
34+
* Called to display a {@link android.webkit.WebView} for charges that require webpage authentication.
35+
* When the payment is completed, the authentication page redirects to a {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined url}
36+
* with the payment details appended to the url.
37+
* <p>
38+
* You should override the webview client's {@link android.webkit.WebViewClient#shouldOverrideUrlLoading(WebView, WebResourceRequest)} shouldOverrideUrlLoading}
39+
* function to check if the {@link WebResourceRequest#getUrl() url being loaded} contains the
40+
* {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined redirect url}.
41+
* <p>
42+
* If it does, it means the transaction has been completed and you can now call {@link AchPaymentManager#onWebpageAuthenticationComplete()} to check the transaction status.
43+
*
44+
* @param authenticationUrl The url to the authentication page
45+
*/
1246
void showAuthenticationWebPage(String authenticationUrl);
1347
}

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/banktransfer/BankTransferPaymentCallback.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,45 @@
33
import androidx.annotation.Nullable;
44

55
public interface BankTransferPaymentCallback {
6+
/**
7+
* Called to indicate that a background task is running, e.g. a network call.
8+
* This should typically show or hide a progress bar.
9+
*
10+
* @param active If true, background task is running. If false, background task has stopped
11+
*/
612
void showProgressIndicator(boolean active);
713

14+
/**
15+
* Called when an error occurs with the payment. The error message can be displayed to the users.
16+
*
17+
* @param errorMessage A message describing the error
18+
* @param flwRef The Flutterwave reference to the transaction.
19+
*/
820
void onError(String errorMessage, @Nullable String flwRef);
921

22+
/**
23+
* Called when the transaction has been completed successfully.
24+
*
25+
* @param flwRef The Flutterwave reference to the transaction.
26+
*/
1027
void onSuccessful(String flwRef);
1128

29+
/**
30+
* Passes the details of the bank account to be transferred to. These details should be displayed
31+
* to the user for them to make the transfer and complete the transaction. {@link BankTransferPaymentManager#checkTransactionStatus(int)}
32+
* should be called after this, or when the user has completed the transfer, to confirm the transaction status.
33+
*
34+
* @param amount The amount to be transferred
35+
* @param accountNumber The account number to be transferred to
36+
* @param bankName The name of the bank to be transferred to
37+
* @param beneficiaryName The name of the account to be transferred to
38+
*/
1239
void onTransferDetailsReceived(String amount, String accountNumber, String bankName, String beneficiaryName);
1340

41+
/**
42+
* Called when the bank transfer has not been confirmed in the timeout when calling {@link BankTransferPaymentManager#checkTransactionStatus(int)}.
43+
*
44+
* @param flwRef
45+
*/
1446
void onPollingTimeout(String flwRef);
1547
}

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/barter/BarterPaymentCallback.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,34 @@
33
import androidx.annotation.Nullable;
44

55
public interface BarterPaymentCallback {
6+
/**
7+
* Called to indicate that a background task is running, e.g. a network call.
8+
* This should typically show or hide a progress bar.
9+
*
10+
* @param active If true, background task is running. If false, background task has stopped
11+
*/
612
void showProgressIndicator(boolean active);
713

14+
/**
15+
* Called when an error occurs with the payment. The error message can be displayed to the users.
16+
*
17+
* @param errorMessage A message describing the error
18+
* @param flwRef The Flutterwave reference to the transaction.
19+
*/
820
void onError(String errorMessage, @Nullable String flwRef);
921

22+
/**
23+
* Called when the transaction has been completed successfully.
24+
*
25+
* @param flwRef The Flutterwave reference to the transaction.
26+
*/
1027
void onSuccessful(String flwRef);
1128

12-
void loadBarterCheckout(String authUrlCrude, String flwRef);
29+
/**
30+
* Called to display a {@link android.webkit.WebView} for webpage authentication.
31+
*
32+
* @param authenticationUrl The url to the authentication page
33+
* @param flwRef The Flutterwave transaction reference
34+
*/
35+
void loadBarterCheckout(String authenticationUrl, String flwRef);
1336
}

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/barter/NullBarterPaymentCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void onSuccessful(String flwRef) {
2020
}
2121

2222
@Override
23-
public void loadBarterCheckout(String authUrlCrude, String flwRef) {
23+
public void loadBarterCheckout(String authenticationUrl, String flwRef) {
2424

2525
}
2626
}

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/card/CardContract.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ interface CardInteractor {
105105
void collectCardAddressDetails(Payload payload, String authModel);
106106

107107
/**
108-
* Called to display a {@link android.webkit.WebView} for cards that require 3D-Secure authentication.
108+
* Called to display a {@link android.webkit.WebView} for charges that require webpage authentication.
109109
* When the payment is completed, the authentication page redirects to a {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined url}
110110
* with the payment details appended to the url.
111111
* <p>
Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,66 @@
11
package com.flutterwave.raveandroid.rave_presentation.card;
22

3+
import android.webkit.WebResourceRequest;
4+
import android.webkit.WebView;
5+
36
import androidx.annotation.Nullable;
47

8+
import com.flutterwave.raveandroid.rave_presentation.data.AddressDetails;
9+
510
public interface CardPaymentCallback {
11+
/**
12+
* Called to indicate that a background task is running, e.g. a network call.
13+
* This should typically show or hide a progress bar.
14+
*
15+
* @param active If true, background task is running. If false, background task has stopped
16+
*/
617
void showProgressIndicator(boolean active);
718

19+
/**
20+
* Called to trigger a pin collection. The pin should be collected from the user and passed to
21+
* the CardPaymentManager using {@link CardPaymentManager#submitPin(String)} to continue the payment.
22+
*/
823
void collectCardPin();
924

25+
/**
26+
* Called to trigger an otp collection. The OTP should be collected from the user and passed to
27+
* the CardPaymentManager using {@link CardPaymentManager#submitOtp(String)} to continue the payment.
28+
*/
1029
void collectOtp(String message);
1130

12-
void onError(String errorMessage, @Nullable String flwRef);
13-
14-
void onSuccessful(String flwRef);
15-
31+
/**
32+
* Called to trigger address details collection. The address should be collected from the user and passed to
33+
* the CardPaymentManager using {@link CardPaymentManager#submitAddress(AddressDetails)} to continue the payment.
34+
*/
1635
void collectAddress();
1736

37+
/**
38+
* Called to display a {@link android.webkit.WebView} for charges that require webpage authentication.
39+
* When the payment is completed, the authentication page redirects to a {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined url}
40+
* with the payment details appended to the url.
41+
* <p>
42+
* You should override the webview client's {@link android.webkit.WebViewClient#shouldOverrideUrlLoading(WebView, WebResourceRequest)} shouldOverrideUrlLoading}
43+
* function to check if the {@link WebResourceRequest#getUrl() url being loaded} contains the
44+
* {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined redirect url}.
45+
* <p>
46+
* If it does, it means the transaction has been completed and you can now call {@link CardPaymentManager#onWebpageAuthenticationComplete()} to check the transaction status.
47+
*
48+
* @param authenticationUrl The url to the authentication page
49+
*/
1850
void showAuthenticationWebPage(String authenticationUrl);
51+
52+
/**
53+
* Called when an error occurs with the payment. The error message can be displayed to the users.
54+
*
55+
* @param errorMessage A message describing the error
56+
* @param flwRef The Flutterwave reference to the transaction.
57+
*/
58+
void onError(String errorMessage, @Nullable String flwRef);
59+
60+
/**
61+
* Called when the transaction has been completed successfully.
62+
*
63+
* @param flwRef The Flutterwave reference to the transaction.
64+
*/
65+
void onSuccessful(String flwRef);
1966
}

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/francmobilemoney/FrancophoneMobileMoneyPaymentCallback.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,27 @@
33
import androidx.annotation.Nullable;
44

55
public interface FrancophoneMobileMoneyPaymentCallback {
6+
7+
/**
8+
* Called to indicate that a background task is running, e.g. a network call.
9+
* This should typically show or hide a progress bar.
10+
*
11+
* @param active If true, background task is running. If false, background task has stopped
12+
*/
613
void showProgressIndicator(boolean active);
714

15+
/**
16+
* Called when an error occurs with the payment. The error message can be displayed to the users.
17+
*
18+
* @param errorMessage A message describing the error
19+
* @param flwRef The Flutterwave reference to the transaction.
20+
*/
821
void onError(String errorMessage, @Nullable String flwRef);
922

23+
/**
24+
* Called when the transaction has been completed successfully.
25+
*
26+
* @param flwRef The Flutterwave reference to the transaction.
27+
*/
1028
void onSuccessful(String flwRef);
1129
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,46 @@
11
package com.flutterwave.raveandroid.rave_presentation.ghmobilemoney;
22

3+
import android.webkit.WebResourceRequest;
4+
import android.webkit.WebView;
5+
36
import androidx.annotation.Nullable;
47

58
public interface GhanaMobileMoneyPaymentCallback {
9+
/**
10+
* Called to indicate that a background task is running, e.g. a network call.
11+
* This should typically show or hide a progress bar.
12+
*
13+
* @param active If true, background task is running. If false, background task has stopped
14+
*/
615
void showProgressIndicator(boolean active);
716

17+
/**
18+
* Called when an error occurs with the payment. The error message can be displayed to the users.
19+
*
20+
* @param errorMessage A message describing the error
21+
* @param flwRef The Flutterwave reference to the transaction.
22+
*/
823
void onError(String errorMessage, @Nullable String flwRef);
924

25+
/**
26+
* Called when the transaction has been completed successfully.
27+
*
28+
* @param flwRef The Flutterwave reference to the transaction.
29+
*/
1030
void onSuccessful(String flwRef);
1131

32+
/**
33+
* Called to display a {@link android.webkit.WebView} for charges that require webpage authentication.
34+
* When the payment is completed, the authentication page redirects to a {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined url}
35+
* with the payment details appended to the url.
36+
* <p>
37+
* You should override the webview client's {@link android.webkit.WebViewClient#shouldOverrideUrlLoading(WebView, WebResourceRequest)} shouldOverrideUrlLoading}
38+
* function to check if the {@link WebResourceRequest#getUrl() url being loaded} contains the
39+
* {@link com.flutterwave.raveandroid.rave_java_commons.RaveConstants#RAVE_3DS_CALLBACK predefined redirect url}.
40+
* <p>
41+
* If it does, it means the transaction has been completed and you can now call {@link GhanaMobileMoneyPaymentManager#onWebpageAuthenticationComplete()} to check the transaction status.
42+
*
43+
* @param url The url to the authentication page
44+
*/
1245
void showAuthenticationWebPage(String url);
1346
}

rave_presentation/src/main/java/com/flutterwave/raveandroid/rave_presentation/mpesa/MpesaPaymentCallback.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,26 @@
33
import androidx.annotation.Nullable;
44

55
public interface MpesaPaymentCallback {
6+
/**
7+
* Called to indicate that a background task is running, e.g. a network call.
8+
* This should typically show or hide a progress bar.
9+
*
10+
* @param active If true, background task is running. If false, background task has stopped
11+
*/
612
void showProgressIndicator(boolean active);
713

14+
/**
15+
* Called when an error occurs with the payment. The error message can be displayed to the users.
16+
*
17+
* @param errorMessage A message describing the error
18+
* @param flwRef The Flutterwave reference to the transaction.
19+
*/
820
void onError(String errorMessage, @Nullable String flwRef);
921

22+
/**
23+
* Called when the transaction has been completed successfully.
24+
*
25+
* @param flwRef The Flutterwave reference to the transaction.
26+
*/
1027
void onSuccessful(String flwRef);
1128
}

0 commit comments

Comments
 (0)