Skip to content

Commit

Permalink
v1.1.1 (#5)
Browse files Browse the repository at this point in the history
Co-authored-by: matus.choma <matus.choma@upcodee.com>
  • Loading branch information
MatusChomaGetnetEurope and chomamatus authored May 30, 2023
1 parent 2e82152 commit 4e0ceeb
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 91 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
minSdkVersion 23
targetSdkVersion 33
versionCode 2
versionName "1.1.0"
versionName "1.1.1"
flavorDimensions "default"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Binary file modified app/libs/card.aar
Binary file not shown.
Binary file modified app/libs/core.aar
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

import com.sdkpay.ecom.Client;
import com.sdkpay.ecom.card.AnimatedCardFieldFragment;
import com.sdkpay.ecom.card.model.CardBundle;
import com.sdkpay.ecom.card.model.CardFieldPayment;
import com.sdkpay.ecom.model.AccountHolder;
import com.sdkpay.ecom.model.TransactionType;
import com.sdkpay.ecom.examples.providers.OptionalFieldsProvider;
import com.sdkpay.ecom.examples.providers.PaymentObjectProvider;
import com.sdkpay.ecom.model.PaymentResponse;
import com.sdkpay.ecom.util.Observer;

Expand All @@ -30,7 +28,7 @@
public class AnimatedCardFieldActivity extends AppCompatActivity implements Observer<PaymentResponse> {
private final Context mContext = this;
AnimatedCardFieldFragment animatedCardFieldFragment;

PaymentObjectProvider mPaymentObjectProvider = new PaymentObjectProvider(new OptionalFieldsProvider());
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -57,39 +55,13 @@ protected void onCreate(Bundle savedInstanceState) {

public void onSubmitButtonClicked(View view) {
if(animatedCardFieldFragment.getCardBundle() != null) {
new Client(this, URL_EE_TEST, REQUEST_TIMEOUT).startPayment(getCardFormPayment(animatedCardFieldFragment.getCardBundle()));
new Client(this, URL_EE_TEST, REQUEST_TIMEOUT).startPayment(mPaymentObjectProvider.getCardFormPayment(animatedCardFieldFragment.getCardBundle()));
findViewById(R.id.progress).setVisibility(View.VISIBLE);
}else {
Toast.makeText(mContext, "Card bundle is null!", Toast.LENGTH_SHORT).show();
}
}

public CardFieldPayment getCardFormPayment(CardBundle cardBundle) {
String timestamp = SignatureHelper.generateTimestamp();
String merchantID = "5c4a8a42-04a8-4970-a595-262f0ba0a108";
String secretKey = "5ac555d4-e7f7-409f-8147-d82c8c10ed53";
String requestID = UUID.randomUUID().toString();
TransactionType transactionType = TransactionType.PURCHASE;
BigDecimal amount = new BigDecimal(5);
String currency = "EUR";
String signature = SignatureHelper.generateSignature(timestamp, merchantID, requestID, transactionType.getValue(), amount, currency, secretKey);

CardFieldPayment cardFieldPayment = new CardFieldPayment.Builder()
.setSignature(signature)
.setMerchantAccountId(merchantID)
.setRequestId(requestID)
.setAmount(amount)
.setTransactionType(transactionType)
.setCurrency(currency)
.setCardBundle(cardBundle)
.build();

AccountHolder accountHolder = new AccountHolder("John", "Doe");
cardFieldPayment.setAccountHolder(accountHolder);

return cardFieldPayment;
}

@Override
public void onObserve(PaymentResponse paymentResponse) {
runOnUiThread(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ class CardFieldFragmentImplFragment: Fragment(), Observer<PaymentResponse> {
activity?.findViewById<View>(R.id.progress)?.visibility = View.GONE
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ class KotlinCardFieldFragmentImplActivity : AppCompatActivity(){
.replace(R.id.container, CardFieldFragmentImplFragment())
.commit()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class KotlinTokenAnimatedCardFieldActivity : AppCompatActivity(), Observer<Payme
cardFieldPayment.accountHolder = accountHolder

val cardToken = CardToken()
cardToken.tokenId = "4304509873471003"
cardToken.tokenId = "5427317855871006"
cardToken.maskedAccountNumber = "541333******1006"
cardFieldPayment.cardToken = cardToken

return cardFieldPayment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public CardFieldPayment getCardFormPayment(CardBundle cardBundle) {
cardFieldPayment.setAccountHolder(accountHolder);

CardToken cardToken = new CardToken();
cardToken.setTokenId("5500971586101006");
cardToken.setTokenId("5427317855871006");
cardToken.setMaskedAccountNumber("541333******1006");
cardFieldPayment.setCardToken(cardToken);

return cardFieldPayment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public CardPayment getCardTokenPayment() {
cardPayment.setRequireManualCardBrandSelection(true);

CardToken cardToken = new CardToken();
cardToken.setTokenId("5500971586101006");
cardToken.setTokenId("5427317855871006");
cardToken.setMaskedAccountNumber("541333******1006");

cardPayment.setCardToken(cardToken);
Expand Down
22 changes: 0 additions & 22 deletions app/src/test/java/com/sdkpay/ecom/examples/ExampleUnitTest.java

This file was deleted.

0 comments on commit 4e0ceeb

Please sign in to comment.