Skip to content

Commit

Permalink
Sdk enhancements for charge callback
Browse files Browse the repository at this point in the history
Get status of charge when initiated callback
  • Loading branch information
AhlaamK-tap committed Jan 23, 2023
1 parent 85c6eb0 commit ee44ca2
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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'
}
```

Expand Down Expand Up @@ -2435,6 +2436,24 @@ Notifies the receiver (Merchant Activity) that the asynchronous payment has star
```kotlin
- fun asyncPaymentStarted(charge:Charge)
```

<a name="paymentInitiated_callback"></a>
### 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)
```
-----
<a name="docs"></a>
# Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ////////////////////

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ public void didReceiveCharge(Charge charge) {
openOTPScreen(charge);
break;
}
SDKSession.getListener().paymentInitiated(charge);
}
break;
case CAPTURED:
Expand Down Expand Up @@ -1015,6 +1016,7 @@ public void didReceiveSaveCard(SaveCard saveCard) {
openOTPScreen(saveCard);
break;
}
// SDKSession.getListener().paymentInitiated(saveCard);
}
break;
case CAPTURED:
Expand Down Expand Up @@ -1214,6 +1216,7 @@ public void didReceiveAuthorize(Authorize authorize) {
openOTPScreen((Authorize) authorize);
break;
}
// SDKSession.getListener().paymentInitiated((Authorize)authorize);
}
break;
case CAPTURED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


/**
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ public interface SessionDelegate {
void cardTokenizedSuccessfully(@NonNull Token token,boolean saveCardEnabled);

void asyncPaymentStarted(@NonNull Charge charge);

void paymentInitiated(@Nullable Charge charge);

}

0 comments on commit ee44ca2

Please sign in to comment.