Skip to content

Commit

Permalink
Merge pull request #3 from VhiktorBrown/fixes/upgrade-to-sdk-34
Browse files Browse the repository at this point in the history
fixed issue with library not allowing metadata to be optional. You can now successfully exclude metadata without issues. Increased sdk to 34, added check for email, removed secret key and other irrelevant data from being sent in payload.
  • Loading branch information
VhiktorBrown authored Sep 3, 2024
2 parents b697ed1 + 81e3c90 commit be84619
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Paystack-webview-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {

groupId = 'com.github.VhiktorBrown'
artifactId = 'Paystack-webview-android'
version = '1.0.6'
version = 'v1.0.7'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,26 @@ public PayStackWebViewForAndroid setMetaData(Object metaData){
* @return - this.
*/
public PayStackInitializer getDataWithJsonMetaData(PayStackInitializer payStackInitializer){
return new PayStackInitializer(
payStackInitializer.getSecretKey(),
payStackInitializer.getEmail(),
payStackInitializer.getAmount(),
payStackInitializer.getCallback_url(),
payStackInitializer.isShow(),
Utils.convertFromStringToJson(payStackInitializer.getTemporaryMetaData())
);
//Check to see if user added the metadata. If so, we use the constructor
//that includes the metadata, if not, we use a different constructor.
if(payStackInitializer.getMetaData() != null){
return new PayStackInitializer(
payStackInitializer.getSecretKey(),
payStackInitializer.getEmail(),
payStackInitializer.getAmount(),
payStackInitializer.getCallback_url(),
payStackInitializer.isShow(),
Utils.convertFromStringToJson(payStackInitializer.getTemporaryMetaData())
);
}else {
return new PayStackInitializer(
payStackInitializer.getSecretKey(),
payStackInitializer.getEmail(),
payStackInitializer.getAmount(),
payStackInitializer.getCallback_url(),
payStackInitializer.isShow()
);
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ public PayStackInitializer(String secretKey, String email, double amount, String
this.metaData = metaData;
}

public PayStackInitializer(String secretKey, String email, double amount, String callback_url, boolean show) {
this.secretKey = secretKey;
this.email = email;
this.amount = amount;
this.callback_url = callback_url;
this.show = show;
}

protected PayStackInitializer(Parcel in) {
secretKey = in.readString();
email = in.readString();
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
The Android library that helps developers integrate Paystack's payment gateway with just few lines of code. The library automatically loads Paystack's payment gateway in a WebView, saving you the stress of dealing with Webview's complex configuration, fetches an authorization URL from Paystack, handles payment and returns a SUCCESS RESULT back to your Activity or Fragment, if transaction was successful.

## Changes/Updates(1st September 2024)
- MetaData Error Issue: Issue with library not allowing metadata to be optional has been fixed. You can now easily exclude metadata without experiencing issues.
- Upgraded Library: The library has been upgraded to support Android SDK 34. This ensures compatibility with the latest Android devices and features.
- Payload Optimization: Unnecessary details in the payload sent to Paystack have been removed. This improves efficiency and reduces data transmission size.
- Email Validation: A check for email has been added to ensure an email address is provided before sending a request to Paystack. This helps prevent errors and ensures proper communication with the user.
Expand Down Expand Up @@ -48,7 +49,7 @@ The Android library that helps developers integrate Paystack's payment gateway w

``` java
dependencies {
implementation 'com.github.VhiktorBrown:Paystack-webview-android:v1.0.6'
implementation 'com.github.VhiktorBrown:Paystack-webview-android:v1.0.7'
}
```

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies {
//Ssp and Sdp
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
// implementation 'com.github.VhiktorBrown:Paystack-webview-android:1.0.5'
//implementation 'com.github.VhiktorBrown:Paystack-webview-android:v1.0.6'

implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation project(':Paystack-webview-android')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ protected void onCreate(Bundle savedInstanceState) {
.setSecretKey("secret_key")
.setCallbackURL("https://transaction_callback_url")
.showProgressBar(true)
.setMetaData(payStackData)
.initialize());
}

Expand Down

0 comments on commit be84619

Please sign in to comment.