diff --git a/.gradle/7.4/executionHistory/executionHistory.bin b/.gradle/7.4/executionHistory/executionHistory.bin
index 51339b6b..10ef22a5 100644
Binary files a/.gradle/7.4/executionHistory/executionHistory.bin and b/.gradle/7.4/executionHistory/executionHistory.bin differ
diff --git a/.gradle/7.4/executionHistory/executionHistory.lock b/.gradle/7.4/executionHistory/executionHistory.lock
index 6f3388c5..7243c949 100644
Binary files a/.gradle/7.4/executionHistory/executionHistory.lock and b/.gradle/7.4/executionHistory/executionHistory.lock differ
diff --git a/.gradle/7.4/fileHashes/fileHashes.bin b/.gradle/7.4/fileHashes/fileHashes.bin
index 8d432526..4b6c7fc0 100644
Binary files a/.gradle/7.4/fileHashes/fileHashes.bin and b/.gradle/7.4/fileHashes/fileHashes.bin differ
diff --git a/.gradle/7.4/fileHashes/fileHashes.lock b/.gradle/7.4/fileHashes/fileHashes.lock
index 4f19c632..2dbb9cde 100644
Binary files a/.gradle/7.4/fileHashes/fileHashes.lock and b/.gradle/7.4/fileHashes/fileHashes.lock differ
diff --git a/.gradle/7.4/fileHashes/resourceHashesCache.bin b/.gradle/7.4/fileHashes/resourceHashesCache.bin
index 905417c9..ce1ec2e5 100644
Binary files a/.gradle/7.4/fileHashes/resourceHashesCache.bin and b/.gradle/7.4/fileHashes/resourceHashesCache.bin differ
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
index 4d2a9ebc..cc9ba5a4 100644
--- a/.idea/deploymentTargetDropDown.xml
+++ b/.idea/deploymentTargetDropDown.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/.idea/modules/goSellSDKSample/goSellSDK-AndroidX.goSellSDKSample.iml b/.idea/modules/goSellSDKSample/goSellSDK-AndroidX.goSellSDKSample.iml
new file mode 100644
index 00000000..12bc8c2d
--- /dev/null
+++ b/.idea/modules/goSellSDKSample/goSellSDK-AndroidX.goSellSDKSample.iml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/library/goSellSDK-AndroidX.library.iml b/.idea/modules/library/goSellSDK-AndroidX.library.iml
new file mode 100644
index 00000000..0d2fab84
--- /dev/null
+++ b/.idea/modules/library/goSellSDK-AndroidX.library.iml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/library/src/main/java/company/tap/gosellapi/internal/adapters/CardSystemsRecyclerViewAdapter.java b/library/src/main/java/company/tap/gosellapi/internal/adapters/CardSystemsRecyclerViewAdapter.java
index b171aaf1..accde62c 100644
--- a/library/src/main/java/company/tap/gosellapi/internal/adapters/CardSystemsRecyclerViewAdapter.java
+++ b/library/src/main/java/company/tap/gosellapi/internal/adapters/CardSystemsRecyclerViewAdapter.java
@@ -140,38 +140,40 @@ public void updateForCardBrand(CardBrand brand, CardScheme cardScheme, CardCrede
for (PaymentOption option : initialData) {
- cardBrands = option.getSupportedCardBrands();
if (cardScheme != null) {
- if(cardBrands.contains(cardScheme.getCardBrand()) || cardScheme.name().equalsIgnoreCase("MADA")){
- if (comparePaymentOptionWithCardScheme(option, cardScheme)) {
- data.add(option);
- continue;
- }
- }else{
- if (cardBrands.contains(brand)) {
- data.add(option);
-
- }
- }
- /* if (comparePaymentOptionWithCardScheme(option, cardScheme)) {
+
+ if (comparePaymentOptionWithCardScheme(option, cardScheme)) {
data.add(option);
- continue;
- }*/
- } else {
+ break;
+ }
+
+
+ }
+
+ }
+
+ if(data.size()==0) {
+
+ for (PaymentOption option : initialData) {
+
+ cardBrands = option.getSupportedCardBrands();
+
if (cardBrands.contains(brand)) {
data.add(option);
+ break;
+
}
- }
+ }
}
// &&!cardBrands.contains(brand)
- if (data.isEmpty() ) {
+ /*if (data.isEmpty() ) {
cardCredentialsViewHolder.showDialog(cardCredentialsViewHolder.itemView.getResources().getString(R.string.alert_un_supported_card_title), cardCredentialsViewHolder.itemView.getResources().getString(R.string.alert_un_supported_card_message));
- }
+ }*/
if (data.size() == 0)
data = new ArrayList<>(initialData);
@@ -179,10 +181,11 @@ public void updateForCardBrand(CardBrand brand, CardScheme cardScheme, CardCrede
notifyDataSetChanged();
}
+
private boolean comparePaymentOptionWithCardScheme(@NonNull PaymentOption paymentOption,
@NonNull CardScheme cardScheme) {
- if ((paymentOption.getName().equalsIgnoreCase(cardScheme.name()))) {
+ if ((paymentOption.getName().equalsIgnoreCase(cardScheme.name()))||cardScheme.name().equalsIgnoreCase("MADA")) {
// Log.e("payment option",paymentOption.getName().toString());
// Log.e("card scheme",cardScheme.name().toString());
@@ -191,13 +194,13 @@ private boolean comparePaymentOptionWithCardScheme(@NonNull PaymentOption paymen
}
- if (paymentOption.getName().compareTo(String.valueOf(cardScheme.getCardBrand())) == 0) {
+ if (paymentOption.getName().toLowerCase().compareTo(String.valueOf(cardScheme.getCardBrand()).toLowerCase()) == 0) {
return true;
}
// stop this check to avoid displaying mada with master in case of scheme is not mada
- if (paymentOption.getSupportedCardBrands().contains(cardScheme.getCardBrand())) {
+ /* if (paymentOption.getSupportedCardBrands().contains(cardScheme.getCardBrand())) {
return true;
- }
+ }*/
return false;
}
diff --git a/library/src/main/java/company/tap/gosellapi/internal/data_managers/payment_options/view_models/CardCredentialsViewModel.java b/library/src/main/java/company/tap/gosellapi/internal/data_managers/payment_options/view_models/CardCredentialsViewModel.java
index fbe3359f..dc636ccb 100644
--- a/library/src/main/java/company/tap/gosellapi/internal/data_managers/payment_options/view_models/CardCredentialsViewModel.java
+++ b/library/src/main/java/company/tap/gosellapi/internal/data_managers/payment_options/view_models/CardCredentialsViewModel.java
@@ -14,6 +14,7 @@
import company.tap.gosellapi.internal.data_managers.payment_options.PaymentOptionsDataManager;
import company.tap.gosellapi.internal.data_managers.payment_options.view_models.card_input_fields_text_handlers.CardNumberTextHandler;
import company.tap.gosellapi.internal.data_managers.payment_options.view_models_data.CardCredentialsViewModelData;
+import company.tap.gosellapi.internal.utils.ActivityDataExchanger;
import company.tap.gosellapi.internal.utils.Utils;
import company.tap.gosellapi.internal.viewholders.CardCredentialsViewHolder;
import company.tap.gosellapi.internal.viewholders.PaymentOptionsBaseViewHolder;
@@ -97,7 +98,7 @@ public String getCardholderNameText() {
private boolean shouldSaveCard;
@Nullable private BINLookupResponse currentBINData;
- @Nullable private BINLookupResponse getCurrentBINData() { return currentBINData; }
+ @Nullable public BINLookupResponse getCurrentBINData() { return currentBINData; }
/**
* Set current bin data.
@@ -429,7 +430,7 @@ public void setPaymentOption(CardBrand cardBrand,CardScheme cardScheme) {
if(cardBrand!=null){
for(PaymentOption paymentOption: data.getPaymentOptions()){
//Fix added for cases where cardscheme is empty (toLowecase() added)
- if(paymentOption.getName().toLowerCase().compareTo(String.valueOf(cardBrand))==0){
+ if(paymentOption.getName().toLowerCase().compareTo(String.valueOf(cardBrand).toLowerCase())==0){
this.selectedCardPaymentOption = paymentOption;
updatePayButtonWithExtraFees(paymentOption);
}
diff --git a/library/src/main/java/company/tap/gosellapi/internal/viewholders/CardCredentialsViewHolder.java b/library/src/main/java/company/tap/gosellapi/internal/viewholders/CardCredentialsViewHolder.java
index 208d6f87..8f6fe35a 100644
--- a/library/src/main/java/company/tap/gosellapi/internal/viewholders/CardCredentialsViewHolder.java
+++ b/library/src/main/java/company/tap/gosellapi/internal/viewholders/CardCredentialsViewHolder.java
@@ -301,6 +301,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
if (text.length() < BIN_NUMBER_LENGTH || text.length() == 0) {
PaymentDataManager.getInstance().setBinLookupResponse(null);
+ viewModel.setCurrentBINData(null);
}
}
@@ -312,13 +313,15 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
@Override
public void run() {
// do your work
- BINLookupResponse binLookupResponse = PaymentDataManager.getInstance().getBinLookupResponse();
+ // BINLookupResponse binLookupResponse = PaymentDataManager.getInstance().getBinLookupResponse();
+ BINLookupResponse binLookupResponse = viewModel.getCurrentBINData();
if(binLookupResponse==null){
viewModel.setPaymentOption(finalCardBrand,null);
}else
- { viewModel.setPaymentOption(finalCardBrand,binLookupResponse.getScheme());
+ {
+ viewModel.setPaymentOption(binLookupResponse.getCardBrand(),binLookupResponse.getScheme());
}
- handler.postDelayed(this, 1000);
+ // handler.postDelayed(this, 1000);
}
};
handler.postDelayed(runnable, 1000);
@@ -327,7 +330,8 @@ public void run() {
@Override
public void afterTextChanged(Editable s) {
- if(PaymentDataManager.getInstance().getBinLookupResponse()!=null) {
+ // if(PaymentDataManager.getInstance().getBinLookupResponse()!=null
+ if( viewModel.getCurrentBINData()!=null) {
viewModel.cardDetailsFilled(validateCardFields(), viewModel);
viewModel.checkShakingStatus();
}
@@ -751,6 +755,7 @@ public void updateCardSystemsRecyclerView(CardBrand brand,CardScheme cardScheme)
}
}
+
private DefinedCardBrand validateCardNumber(String cardNumber) {
cardNumber = cardNumber.replace(" ", "");
@@ -764,9 +769,17 @@ private DefinedCardBrand validateCardNumber(String cardNumber) {
// update CCVEditText CardType: to set CCV Length according to CardType
updateCCVEditTextCardType(brand.getCardBrand());
// update card types
- BINLookupResponse binLookupResponse = PaymentDataManager.getInstance().getBinLookupResponse();
+ // BINLookupResponse binLookupResponse = PaymentDataManager.getInstance().getBinLookupResponse();
+ BINLookupResponse binLookupResponse = viewModel.getCurrentBINData();
// System.out.println("brand.getCardBrand() in validation "+brand.getCardBrand());
- updateCardSystemsRecyclerView( brand.getCardBrand(), binLookupResponse == null ? null : binLookupResponse.getScheme());
+
+ if(binLookupResponse==null){
+ updateCardSystemsRecyclerView( brand.getCardBrand(), null);
+
+ }else{
+ updateCardSystemsRecyclerView(binLookupResponse.getCardBrand(), binLookupResponse.getScheme());
+
+ }
// if (binLookupResponse != null && PaymentDataSource.getInstance().getCardType() != null){
if(binLookupResponse != null && PaymentDataSource.getInstance().getCardType()!=null && PaymentDataSource.getInstance().getCardType() == ALL) {
@@ -1026,6 +1039,7 @@ public void onClick(DialogInterface dialog, int which) {
});
PaymentDataManager.getInstance().setBinLookupResponse(null);
+ viewModel.setCurrentBINData(null);
// cardNumberField.setText(null);
AlertDialog dialog = dialogBuilder.create();
@@ -1070,7 +1084,8 @@ private void handleScanbinLookupResponse(){
@Override
public void run() {
// do something after 1s = 1000 miliseconds since set response takes time
- BINLookupResponse binLookupResponse = PaymentDataManager.getInstance().getBinLookupResponse();
+ // BINLookupResponse binLookupResponse = PaymentDataManager.getInstance().getBinLookupResponse();
+ BINLookupResponse binLookupResponse = viewModel.getCurrentBINData();
if(binLookupResponse==null){
viewModel.setPaymentOption(cardBrand, null);
@@ -1097,7 +1112,7 @@ public void run() {
}
}
- }, 3000); //Time in mis
+ }, 1000); //Time in mis
}