Skip to content

Commit

Permalink
Merge pull request #37 from TinkoffCreditSystems/ASDK-451-fix
Browse files Browse the repository at this point in the history
Asdk 451 fix
  • Loading branch information
al-dr authored Aug 15, 2018
2 parents 87cf4d7 + 0c931f8 commit 1d8fbcb
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import android.preference.PreferenceManager;
import android.support.annotation.StyleRes;

import java.util.HashMap;
import java.util.Map;

import ru.tinkoff.acquiring.sample.camera.DemoCameraScanner;
import ru.tinkoff.acquiring.sdk.ICameraCardScanner;
import ru.tinkoff.acquiring.sdk.card.io.CameraCardIOScanner;
Expand All @@ -21,15 +18,9 @@ public class SettingsSdkManager {
private final Context context;
private final SharedPreferences preferences;

private final Map<String, String> keys = new HashMap<>();

public SettingsSdkManager(Context context) {
this.context = context;
this.preferences = PreferenceManager.getDefaultSharedPreferences(context);

keys.put(context.getString(R.string.acq_sp_default_value_terminal_id), "BHpsDK6YMP9Ps1drHv5yiTunqgCNTZM5rPIxToLDWKgLvCFHVSuqccxN/aHxeAXDbb61B8s3plQadugtL2Ln9pc=");
keys.put(context.getString(R.string.acq_sp_test_sdk_terminal_id), "BGbkgMjU6/bQyKzDkO4Vz5Qs9Qw5tHWZq3puUwMcqKCDUNMYcrxOgaHjFWdB3khRzQhe8mgxaQoEKxnUDmxsKD8=");
keys.put(context.getString(R.string.acq_sp_sdk_non_3ds_terminal_id), null);
}

public boolean isCustomKeyboardEnabled() {
Expand Down Expand Up @@ -107,8 +98,4 @@ public ICameraCardScanner getCameraScanner() {
}
return new DemoCameraScanner();
}

public String getAndroidPayPublicKey(String terminal) {
return keys.get(terminal);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ protected void initPayment(final Money amount,
String terminalId = settings.getTerminalId();
AndroidPayParams androidPayParams = new AndroidPayParams.Builder()
.setEnvironment(WalletConstants.ENVIRONMENT_TEST)
.setPublicKey(settings.getAndroidPayPublicKey(terminalId))
.build();
PayFormActivity
.init(terminalId, MerchantParams.PASSWORD, MerchantParams.PUBLIC_KEY)
Expand Down
16 changes: 0 additions & 16 deletions ui/src/main/java/ru/tinkoff/acquiring/sdk/AndroidPayParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public AndroidPayParams[] newArray(int size) {
public static class Builder {

private String merchantName = "";
private String publicKey;
private String countryCode = "RU";
private boolean isPhoneRequired = false;
private boolean isAddressRequired = false;
Expand Down Expand Up @@ -95,15 +94,9 @@ public Builder setMerchantName(String merchantName) {
return this;
}

public Builder setPublicKey(String publicKey) {
this.publicKey = publicKey;
return this;
}

public AndroidPayParams build() {
AndroidPayParams params = new AndroidPayParams();
params.merchantName = this.merchantName;
params.publicKey = this.publicKey;
params.countryCode = this.countryCode;
params.isPhoneRequired = this.isPhoneRequired;
params.isAddressRequired = this.isAddressRequired;
Expand All @@ -118,7 +111,6 @@ public AndroidPayParams build() {
public static final String CURRENCY_CODE = "RUB";

private String merchantName;
private String publicKey;
private String countryCode;
private boolean isPhoneRequired;
private boolean isAddressRequired;
Expand All @@ -133,7 +125,6 @@ private AndroidPayParams() {

private AndroidPayParams(Parcel in) {
merchantName = in.readString();
publicKey = in.readString();
countryCode = in.readString();
isPhoneRequired = in.readByte() != 0;
isAddressRequired = in.readByte() != 0;
Expand All @@ -146,7 +137,6 @@ private AndroidPayParams(Parcel in) {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(merchantName);
dest.writeString(publicKey);
dest.writeString(countryCode);
dest.writeByte((byte) (isPhoneRequired ? 1 : 0));
dest.writeByte((byte) (isAddressRequired ? 1 : 0));
Expand All @@ -165,10 +155,6 @@ public String getMerchantName() {
return merchantName;
}

public String getPublicKey() {
return publicKey;
}

public String getCountryCode() {
return countryCode;
}
Expand Down Expand Up @@ -196,6 +182,4 @@ public int getBuyButtonAppearance() {
public int getTheme() {
return theme;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public void onStart() {
onCardReady();
}

if (androidPayParams != null && androidPayParams.getPublicKey() != null) {
if (androidPayParams != null) {
initGoogleApiClient();
initAndroidPay();
} else {
Expand Down Expand Up @@ -433,6 +433,7 @@ private PaymentDataRequest createPaymentDataRequest() {
PaymentMethodTokenizationParameters params =
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY)
.addParameter("gatewayMerchantId", sdk.getTerminalKey())
.addParameter("gateway", "tinkoff")
.build();

Expand Down

0 comments on commit 1d8fbcb

Please sign in to comment.