Skip to content
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

Deprecate SDK public API #159

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
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://github.com/PaystackHQ/paystack-sdk-android"
15 changes: 14 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 @@ -16,6 +19,7 @@
*
* @author {[email protected]} on 9/16/15.
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class Paystack extends PaystackModel {

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

}

@Deprecated(message = DEPRECATION_MESSAGE)
void chargeCard(Activity activity, Charge charge, TransactionCallback transactionCallback) {
chargeCard(activity, charge, publicKey, transactionCallback);
}
Expand All @@ -79,11 +84,19 @@ private void chargeCard(Activity activity, Charge charge, String publicKey, Tran
private interface BaseCallback {
}

@Deprecated(message = DEPRECATION_MESSAGE)
public interface TransactionCallback extends BaseCallback {
@Deprecated(message = DEPRECATION_MESSAGE)
void onSuccess(Transaction transaction);

@Deprecated(message = DEPRECATION_MESSAGE)
void beforeValidate(Transaction transaction);

@Deprecated(message = DEPRECATION_MESSAGE)
void showLoading(Boolean isProcessing);

@Deprecated(message = DEPRECATION_MESSAGE)
void onError(Throwable error, Transaction transaction);
}

}
}
9 changes: 9 additions & 0 deletions 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 @@ -72,11 +75,13 @@ private static synchronized void initialize(Context applicationContext, SdkIniti
*
* @param context - Application Context
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public static synchronized void initialize(Context context) {
initialize(context, null);
}


@Deprecated(message = DEPRECATION_MESSAGE)
public static boolean isSdkInitialized() {
return sdkInitialized;
}
Expand All @@ -87,6 +92,7 @@ public static boolean isSdkInitialized() {
* @return public key
* @throws PaystackSdkNotInitializedException if the sdk hasn't been initialized
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public static String getPublicKey() throws PaystackSdkNotInitializedException {
//validate that the sdk has been initialized
Utils.Validate.validateSdkInitialized();
Expand All @@ -99,6 +105,7 @@ public static String getPublicKey() throws PaystackSdkNotInitializedException {
*
* @param publicKey - App Developer's public key
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public static void setPublicKey(String publicKey) {
PaystackSdk.publicKey = publicKey;
}
Expand Down Expand Up @@ -137,6 +144,7 @@ private static void performChecks() {
Utils.Validate.hasPublicKey();
}

@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 +159,7 @@ public static void chargeCard(Activity activity, Charge charge, Paystack.Transac
paystack.chargeCard(activity, charge, transactionCallback);
}

@Deprecated(message = DEPRECATION_MESSAGE)
public interface SdkInitializeCallback {
void onInitialized();
}
Expand Down
4 changes: 4 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,11 @@
package co.paystack.android;

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

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

@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,9 @@
import co.paystack.android.ui.PinSingleton;
import co.paystack.android.utils.Crypto;
import co.paystack.android.utils.StringUtils;
import kotlin.Deprecated;

@Deprecated(message = DEPRECATION_MESSAGE)
class TransactionManager {

private static final String LOG_TAG = TransactionManager.class.getSimpleName();
Expand Down Expand Up @@ -468,4 +471,4 @@ protected void onPostExecute(Address address) {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
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(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,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/16/15.
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class AuthenticationException extends PaystackException {
public AuthenticationException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/13/15.
*/
@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,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/25/15.
*/
@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,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/25/15.
*/
@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,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* Created by i on 24/08/2016.
*/
@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,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* Created by i on 24/08/2016.
*/
@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,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/22/15.
*/
@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,17 @@
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(message = DEPRECATION_MESSAGE)
public class PaystackException extends RuntimeException implements Serializable {

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

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

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/22/15.
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class PaystackSdkNotInitializedException extends PaystackException {
public PaystackSdkNotInitializedException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/25/15.
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class ProcessingException extends ChargeException {
public ProcessingException() {
super("A transaction is currently processing, please wait till it concludes before attempting a new charge.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* @author {[email protected]} on 9/20/15.
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class TokenException extends PaystackException {
public TokenException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package co.paystack.android.exceptions;

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

import kotlin.Deprecated;

/**
* Created by i on 24/08/2016.
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class ValidateException extends PaystackException {
public ValidateException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package co.paystack.android.utils;

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

import java.util.Calendar;
import java.util.Locale;

import kotlin.Deprecated;

/**
* Utils used with the Card model.
*
* @author {[email protected]} on 9/13/15.
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class CardUtils {

public static boolean isWholePositiveNumber(String value) {
public static boolean isWholePositiveNumber(String value) {
if (value == null) {
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions paystack/src/main/java/co/paystack/android/utils/Crypto.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package co.paystack.android.utils;

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

import android.util.Base64;

import java.security.KeyFactory;
Expand All @@ -12,13 +14,15 @@
import javax.crypto.Cipher;

import co.paystack.android.exceptions.AuthenticationException;
import kotlin.Deprecated;


/**
* Class for encrypting the card details, for token creation.
*
* @author {[email protected]} on 8/10/15.
*/
@Deprecated(message = DEPRECATION_MESSAGE)
public class Crypto {
private static final String PAYSTACK_RSA_PUBLIC_KEY = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALhZs/7hP0g0+hrqTq0hFyGVxgco0NMxZD8nPS6ihxap0yNFjzdyUuZED6P4/aK9Ezl5ajEI9pcx5/1BrEE+F3kCAwEAAQ==";
private static String ALGORITHM = "RSA";
Expand Down
Loading
Loading