Skip to content

Commit 5c39b3a

Browse files
Pass transaction reference and ID to callbacks for exception reporting
1 parent 25a2335 commit 5c39b3a

22 files changed

+118
-5
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package co.paystack.android
2+
3+
const val DEPRECATION_MESSAGE =
4+
"This SDK has been deprecated, Please refer to our new SDK: https://github.com/PaystackHQ/paystack-sdk-android"

paystack/src/main/java/co/paystack/android/Paystack.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package co.paystack.android;
22

3+
import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
4+
35
import android.app.Activity;
46

57
import co.paystack.android.exceptions.AuthenticationException;
68
import co.paystack.android.exceptions.PaystackSdkNotInitializedException;
79
import co.paystack.android.model.Charge;
810
import co.paystack.android.model.PaystackModel;
911
import co.paystack.android.utils.Utils;
12+
import kotlin.Deprecated;
1013

1114
/**
1215
* This is the Paystack model class.\n
@@ -16,6 +19,7 @@
1619
*
1720
* @author {[email protected]} on 9/16/15.
1821
*/
22+
@Deprecated(message = DEPRECATION_MESSAGE)
1923
public class Paystack extends PaystackModel {
2024

2125
private String publicKey;
@@ -53,6 +57,7 @@ private void validatePublicKey(String publicKey) throws AuthenticationException
5357

5458
}
5559

60+
@Deprecated(message = DEPRECATION_MESSAGE)
5661
void chargeCard(Activity activity, Charge charge, TransactionCallback transactionCallback) {
5762
chargeCard(activity, charge, publicKey, transactionCallback);
5863
}
@@ -79,11 +84,19 @@ private void chargeCard(Activity activity, Charge charge, String publicKey, Tran
7984
private interface BaseCallback {
8085
}
8186

87+
@Deprecated(message = DEPRECATION_MESSAGE)
8288
public interface TransactionCallback extends BaseCallback {
89+
@Deprecated(message = DEPRECATION_MESSAGE)
8390
void onSuccess(Transaction transaction);
91+
92+
@Deprecated(message = DEPRECATION_MESSAGE)
8493
void beforeValidate(Transaction transaction);
94+
95+
@Deprecated(message = DEPRECATION_MESSAGE)
8596
void showLoading(Boolean isProcessing);
97+
98+
@Deprecated(message = DEPRECATION_MESSAGE)
8699
void onError(Throwable error, Transaction transaction);
87100
}
88101

89-
}
102+
}

paystack/src/main/java/co/paystack/android/PaystackSdk.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package co.paystack.android;
22

3+
import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
4+
35
import android.app.Activity;
46
import android.content.Context;
57
import android.content.pm.ApplicationInfo;
@@ -8,6 +10,7 @@
810
import co.paystack.android.exceptions.PaystackSdkNotInitializedException;
911
import co.paystack.android.model.Charge;
1012
import co.paystack.android.utils.Utils;
13+
import kotlin.Deprecated;
1114

1215
/**
1316
* This is the overall paystack sdk manager class.
@@ -72,11 +75,13 @@ private static synchronized void initialize(Context applicationContext, SdkIniti
7275
*
7376
* @param context - Application Context
7477
*/
78+
@Deprecated(message = DEPRECATION_MESSAGE)
7579
public static synchronized void initialize(Context context) {
7680
initialize(context, null);
7781
}
7882

7983

84+
@Deprecated(message = DEPRECATION_MESSAGE)
8085
public static boolean isSdkInitialized() {
8186
return sdkInitialized;
8287
}
@@ -87,6 +92,7 @@ public static boolean isSdkInitialized() {
8792
* @return public key
8893
* @throws PaystackSdkNotInitializedException if the sdk hasn't been initialized
8994
*/
95+
@Deprecated(message = DEPRECATION_MESSAGE)
9096
public static String getPublicKey() throws PaystackSdkNotInitializedException {
9197
//validate that the sdk has been initialized
9298
Utils.Validate.validateSdkInitialized();
@@ -99,6 +105,7 @@ public static String getPublicKey() throws PaystackSdkNotInitializedException {
99105
*
100106
* @param publicKey - App Developer's public key
101107
*/
108+
@Deprecated(message = DEPRECATION_MESSAGE)
102109
public static void setPublicKey(String publicKey) {
103110
PaystackSdk.publicKey = publicKey;
104111
}
@@ -137,6 +144,7 @@ private static void performChecks() {
137144
Utils.Validate.hasPublicKey();
138145
}
139146

147+
@Deprecated(message = DEPRECATION_MESSAGE)
140148
public static void chargeCard(Activity activity, Charge charge, Paystack.TransactionCallback transactionCallback) {
141149
if (BuildConfig.DEBUG && (activity == null)) {
142150
throw new AssertionError("activity must not be null");
@@ -151,6 +159,7 @@ public static void chargeCard(Activity activity, Charge charge, Paystack.Transac
151159
paystack.chargeCard(activity, charge, transactionCallback);
152160
}
153161

162+
@Deprecated(message = DEPRECATION_MESSAGE)
154163
public interface SdkInitializeCallback {
155164
void onInitialized();
156165
}

paystack/src/main/java/co/paystack/android/Transaction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package co.paystack.android;
22

3+
import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
4+
35
import co.paystack.android.api.model.TransactionApiResponse;
6+
import kotlin.Deprecated;
47

8+
@Deprecated(message = DEPRECATION_MESSAGE)
59
public class Transaction {
610
private String id;
711
private String reference;

paystack/src/main/java/co/paystack/android/TransactionManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package co.paystack.android;
22

3+
import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
34
import static co.paystack.android.Transaction.EMPTY_TRANSACTION;
45

56
import android.app.Activity;
@@ -38,7 +39,9 @@
3839
import co.paystack.android.ui.PinSingleton;
3940
import co.paystack.android.utils.Crypto;
4041
import co.paystack.android.utils.StringUtils;
42+
import kotlin.Deprecated;
4143

44+
@Deprecated(message = DEPRECATION_MESSAGE)
4245
class TransactionManager {
4346

4447
private static final String LOG_TAG = TransactionManager.class.getSimpleName();
@@ -468,4 +471,4 @@ protected void onPostExecute(Address address) {
468471
}
469472
}
470473
}
471-
}
474+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package co.paystack.android.api
22

3+
import co.paystack.android.DEPRECATION_MESSAGE
34
import co.paystack.android.api.model.ChargeResponse
45
import co.paystack.android.api.request.ChargeParams
56

7+
@Deprecated(message = DEPRECATION_MESSAGE)
68
interface ChargeApiCallback {
79
fun onSuccess(params: ChargeParams, response: ChargeResponse)
810

911
fun onError(exception: Throwable, reference: String?)
10-
}
12+
}

paystack/src/main/java/co/paystack/android/exceptions/AuthenticationException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package co.paystack.android.exceptions;
22

3+
import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
4+
5+
import kotlin.Deprecated;
6+
37
/**
48
* @author {[email protected]} on 9/16/15.
59
*/
10+
@Deprecated(message = DEPRECATION_MESSAGE)
611
public class AuthenticationException extends PaystackException {
712
public AuthenticationException(String message) {
813
super(message);

paystack/src/main/java/co/paystack/android/exceptions/CardException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package co.paystack.android.exceptions;
22

3+
import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
4+
5+
import kotlin.Deprecated;
6+
37
/**
48
* @author {[email protected]} on 9/13/15.
59
*/
10+
@Deprecated(message = DEPRECATION_MESSAGE)
611
public class CardException extends PaystackException {
712

813
public CardException(String message) {

paystack/src/main/java/co/paystack/android/exceptions/ChargeException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package co.paystack.android.exceptions;
22

3+
import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
4+
5+
import kotlin.Deprecated;
6+
37
/**
48
* @author {[email protected]} on 9/25/15.
59
*/
10+
@Deprecated(message = DEPRECATION_MESSAGE)
611
public class ChargeException extends PaystackException {
712
public ChargeException(String message) {
813
super(message);

paystack/src/main/java/co/paystack/android/exceptions/ExpiredAccessCodeException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package co.paystack.android.exceptions;
22

3+
import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
4+
5+
import kotlin.Deprecated;
6+
37
/**
48
* @author {[email protected]} on 9/25/15.
59
*/
10+
@Deprecated(message = DEPRECATION_MESSAGE)
611
public class ExpiredAccessCodeException extends PaystackException {
712
public ExpiredAccessCodeException(String message) {
813
super(message);

0 commit comments

Comments
 (0)