diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5e69cd..5a3e7f4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ # CHANGELOG +[3.16.0] - 2023-01-23 +### Enhancement Feature: +- New Callback added to get when a charge is initiated +### Impact on existing integrations: +- The update does not impact existing integrations. +### Recommended changes for existing integrations before updating: +- None. [3.15.18] - 2022-12-29 ### Hot Fix: - Hot fix issues for cardbrand diff --git a/README.md b/README.md index 5a58eea6..4568db33 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ AndroidX compatible version of goSellSDK library that fully covers payment/autho 16. [Session Cancel Callback](#session_cancel_callback) 17. [User Enabled Save CARD](#user_enabled_save_card_option) 18. [Asynch_Payment_Callback](#asyncPaymentStarted_callback) + 18. [Payment_Initiated_Callback](#paymentInitiated_callback) 6. [Documentation](#docs) @@ -97,7 +98,7 @@ To integrate goSellSDK into your project add it in your **root** `build.gradle` Step 2. Add the dependency ```java dependencies { - implementation 'com.github.Tap-Payments:goSellSDK-AndroidX:3.15.18' + implementation 'com.github.Tap-Payments:goSellSDK-AndroidX:3.16.0' } ``` @@ -2435,6 +2436,24 @@ Notifies the receiver (Merchant Activity) that the asynchronous payment has star ```kotlin - fun asyncPaymentStarted(charge:Charge) ``` + + +### PaymentInitiated Callback + +Notifies the receiver (Merchant Activity) that the payment of charge has started. + +#### Declaration + +*Java:* + +```java +- void paymentInitiated(@Nullable Charge charge); +``` +*Java:* + +```kotlin +- fun paymentInitiated(charge:Charge) +``` ----- # Documentation diff --git a/goSellSDKSample/src/main/java/company/tap/sample/activity/MainActivity.java b/goSellSDKSample/src/main/java/company/tap/sample/activity/MainActivity.java index af1909b8..94f4abcf 100644 --- a/goSellSDKSample/src/main/java/company/tap/sample/activity/MainActivity.java +++ b/goSellSDKSample/src/main/java/company/tap/sample/activity/MainActivity.java @@ -614,6 +614,13 @@ public void asyncPaymentStarted(@NonNull Charge charge) { System.out.println("Fawry reference:"+charge.getTransaction().getOrder().getReference()); } + @Override + public void paymentInitiated(@Nullable Charge charge) { + System.out.println("paymentInitiated CallBack : "); + System.out.println("Charge id:"+ charge.getId()); + System.out.println("charge status:"+charge.getStatus()); + } + ///////////////////////////////////////////////////////// needed only for demo //////////////////// diff --git a/library/src/main/java/company/tap/gosellapi/internal/activities/GoSellPaymentActivity.java b/library/src/main/java/company/tap/gosellapi/internal/activities/GoSellPaymentActivity.java index 05c59784..f0e24dd7 100644 --- a/library/src/main/java/company/tap/gosellapi/internal/activities/GoSellPaymentActivity.java +++ b/library/src/main/java/company/tap/gosellapi/internal/activities/GoSellPaymentActivity.java @@ -930,6 +930,7 @@ public void didReceiveCharge(Charge charge) { openOTPScreen(charge); break; } + SDKSession.getListener().paymentInitiated(charge); } break; case CAPTURED: @@ -1015,6 +1016,7 @@ public void didReceiveSaveCard(SaveCard saveCard) { openOTPScreen(saveCard); break; } + // SDKSession.getListener().paymentInitiated(saveCard); } break; case CAPTURED: @@ -1214,6 +1216,7 @@ public void didReceiveAuthorize(Authorize authorize) { openOTPScreen((Authorize) authorize); break; } + // SDKSession.getListener().paymentInitiated((Authorize)authorize); } break; case CAPTURED: diff --git a/library/src/main/java/company/tap/gosellapi/internal/activities/WebPaymentActivity.java b/library/src/main/java/company/tap/gosellapi/internal/activities/WebPaymentActivity.java index 0f5a3d46..6c9a8174 100644 --- a/library/src/main/java/company/tap/gosellapi/internal/activities/WebPaymentActivity.java +++ b/library/src/main/java/company/tap/gosellapi/internal/activities/WebPaymentActivity.java @@ -31,6 +31,7 @@ import company.tap.gosellapi.internal.data_managers.payment_options.view_models.WebPaymentViewModel; import company.tap.gosellapi.internal.interfaces.IPaymentProcessListener; import company.tap.gosellapi.internal.utils.ActivityDataExchanger; +import company.tap.gosellapi.open.controllers.SDKSession; /** @@ -188,6 +189,7 @@ public void didReceiveCharge(Charge charge) { Log.d("didReceiveCharge"," web payment activity* * * " + charge.getStatus()); switch (charge.getStatus()) { case INITIATED: + SDKSession.getListener().paymentInitiated(charge); break; case CAPTURED: case AUTHORIZED: diff --git a/library/src/main/java/company/tap/gosellapi/open/delegate/SessionDelegate.java b/library/src/main/java/company/tap/gosellapi/open/delegate/SessionDelegate.java index e3a5e204..3dc10be0 100644 --- a/library/src/main/java/company/tap/gosellapi/open/delegate/SessionDelegate.java +++ b/library/src/main/java/company/tap/gosellapi/open/delegate/SessionDelegate.java @@ -45,4 +45,7 @@ public interface SessionDelegate { void cardTokenizedSuccessfully(@NonNull Token token,boolean saveCardEnabled); void asyncPaymentStarted(@NonNull Charge charge); + + void paymentInitiated(@Nullable Charge charge); + }