Skip to content

Deprecate SDK public API #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/SonarCloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand Down
4 changes: 4 additions & 0 deletions paystack/src/main/java/co/paystack/android/Constants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package co.paystack.android

const val DEPRECATION_MESSAGE =
"This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/"
34 changes: 33 additions & 1 deletion paystack/src/main/java/co/paystack/android/Paystack.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package co.paystack.android;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import android.app.Activity;

import co.paystack.android.exceptions.AuthenticationException;
import co.paystack.android.exceptions.PaystackSdkNotInitializedException;
import co.paystack.android.model.Charge;
import co.paystack.android.model.PaystackModel;
import co.paystack.android.utils.Utils;
import kotlin.Deprecated;

/**
* This is the Paystack model class.\n
Expand All @@ -15,7 +18,9 @@
* Instead, access the functionalities of this class via the {@link PaystackSdk}
*
* @author {[email protected]} on 9/16/15.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class Paystack extends PaystackModel {

private String publicKey;
Expand Down Expand Up @@ -53,6 +58,10 @@ private void validatePublicKey(String publicKey) throws AuthenticationException

}

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
void chargeCard(Activity activity, Charge charge, TransactionCallback transactionCallback) {
chargeCard(activity, charge, publicKey, transactionCallback);
}
Expand All @@ -79,11 +88,34 @@ private void chargeCard(Activity activity, Charge charge, String publicKey, Tran
private interface BaseCallback {
}

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public interface TransactionCallback extends BaseCallback {
/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
void onSuccess(Transaction transaction);

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
void beforeValidate(Transaction transaction);

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
void showLoading(Boolean isProcessing);

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
void onError(Throwable error, Transaction transaction);
}

}
}
23 changes: 22 additions & 1 deletion paystack/src/main/java/co/paystack/android/PaystackSdk.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package co.paystack.android;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import android.app.Activity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
Expand All @@ -8,6 +10,7 @@
import co.paystack.android.exceptions.PaystackSdkNotInitializedException;
import co.paystack.android.model.Charge;
import co.paystack.android.utils.Utils;
import kotlin.Deprecated;

/**
* This is the overall paystack sdk manager class.
Expand Down Expand Up @@ -71,12 +74,18 @@ private static synchronized void initialize(Context applicationContext, SdkIniti
* Initialize an sdk without a callback
*
* @param context - Application Context
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public static synchronized void initialize(Context context) {
initialize(context, null);
}


/**
* @return Boolean - if the SDK has been initialised
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public static boolean isSdkInitialized() {
return sdkInitialized;
}
Expand All @@ -86,7 +95,9 @@ public static boolean isSdkInitialized() {
*
* @return public key
* @throws PaystackSdkNotInitializedException if the sdk hasn't been initialized
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public static String getPublicKey() throws PaystackSdkNotInitializedException {
//validate that the sdk has been initialized
Utils.Validate.validateSdkInitialized();
Expand All @@ -98,7 +109,9 @@ public static String getPublicKey() throws PaystackSdkNotInitializedException {
* Sets the public key
*
* @param publicKey - App Developer's public key
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public static void setPublicKey(String publicKey) {
PaystackSdk.publicKey = publicKey;
}
Expand Down Expand Up @@ -137,6 +150,10 @@ private static void performChecks() {
Utils.Validate.hasPublicKey();
}

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public static void chargeCard(Activity activity, Charge charge, Paystack.TransactionCallback transactionCallback) {
if (BuildConfig.DEBUG && (activity == null)) {
throw new AssertionError("activity must not be null");
Expand All @@ -151,6 +168,10 @@ public static void chargeCard(Activity activity, Charge charge, Paystack.Transac
paystack.chargeCard(activity, charge, transactionCallback);
}

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public interface SdkInitializeCallback {
void onInitialized();
}
Expand Down
7 changes: 7 additions & 0 deletions paystack/src/main/java/co/paystack/android/Transaction.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package co.paystack.android;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import co.paystack.android.api.model.TransactionApiResponse;
import kotlin.Deprecated;

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class Transaction {
private String id;
private String reference;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package co.paystack.android;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;
import static co.paystack.android.Transaction.EMPTY_TRANSACTION;

import android.app.Activity;
Expand Down Expand Up @@ -38,7 +39,12 @@
import co.paystack.android.ui.PinSingleton;
import co.paystack.android.utils.Crypto;
import co.paystack.android.utils.StringUtils;
import kotlin.Deprecated;

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
class TransactionManager {

private static final String LOG_TAG = TransactionManager.class.getSimpleName();
Expand Down Expand Up @@ -95,7 +101,7 @@ void chargeCard(Activity activity, String publicKey, Charge charge, Paystack.Tra
validateCardThenInitTransaction(publicKey, charge);
}

private void validateCardThenInitTransaction(String publicKey, Charge charge) {
private void validateCardThenInitTransaction(String publicKey, Charge charge){
try {
if (charge.getCard() == null || !charge.getCard().isValid()) {
final CardSingleton si = CardSingleton.getInstance();
Expand Down Expand Up @@ -468,4 +474,4 @@ protected void onPostExecute(Address address) {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package co.paystack.android.api

import co.paystack.android.DEPRECATION_MESSAGE
import co.paystack.android.api.model.ChargeResponse
import co.paystack.android.api.request.ChargeParams

/**
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
interface ChargeApiCallback {
fun onSuccess(params: ChargeParams, response: ChargeResponse)

fun onError(exception: Throwable, reference: String?)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package co.paystack.android.exceptions;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/16/15.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class AuthenticationException extends PaystackException {
public AuthenticationException(String message) {
super(message);
Expand All @@ -11,4 +17,4 @@ public AuthenticationException(String message) {
public AuthenticationException(String message, Throwable e) {
super(message, e);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package co.paystack.android.exceptions;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/13/15.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class CardException extends PaystackException {

public CardException(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package co.paystack.android.exceptions;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/25/15.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class ChargeException extends PaystackException {
public ChargeException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package co.paystack.android.exceptions;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/25/15.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class ExpiredAccessCodeException extends PaystackException {
public ExpiredAccessCodeException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package co.paystack.android.exceptions;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import kotlin.Deprecated;

/**
* Created by i on 24/08/2016.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class InvalidAmountException extends PaystackException {

private int amount;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package co.paystack.android.exceptions;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import kotlin.Deprecated;

/**
* Created by i on 24/08/2016.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class InvalidEmailException extends PaystackException {

private String email;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package co.paystack.android.exceptions;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/22/15.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class PaystackActivityNotFoundException extends PaystackException {
public PaystackActivityNotFoundException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package co.paystack.android.exceptions;

import static co.paystack.android.ConstantsKt.DEPRECATION_MESSAGE;

import java.io.Serializable;

import kotlin.Deprecated;

/**
* Base class for exceptions
*
* @author {[email protected]} on 9/13/15.
* @deprecated This SDK has been deprecated, Please refer to our new SDK: https://paystack.com/docs/developer-tools/android-sdk/
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class PaystackException extends RuntimeException implements Serializable {

public PaystackException(String message) {
Expand Down
Loading
Loading