Skip to content

Commit

Permalink
Release 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Adyen-GIT-Manager committed Jul 19, 2018
1 parent caac65a commit 5abc656
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 28 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Adyen SDK for Android
Want to add checkout to your Android app? No matter if your shopper wants to pay with a card (optionally with 3D Secure & One-click), wallet or a local payment method – all can be integrated in the same way, using the Adyen SDK. The Adyen SDK encrypts sensitive card data and sends it directly to Adyen in order to keep your PCI scope limited.

This README provides the usage manual for the SDK itself. For the full documentation, including the server side implementation guidelines, refer to the [In-app Integration Guide](https://docs.adyen.com/developers/in-app-integration-guide).
This README provides the usage manual for the SDK itself. For the full documentation, including the server side implementation guidelines, refer to the [Android SDK Guide](https://docs.adyen.com/developers/checkout/android-sdk).

To give you as much flexibility as possible, our Android SDK can be integrated in two ways:

* **Quick integration** – Benefit from a fully optimized out-of-the-box UI with the SDK.
* **Custom integration** – Design your own UI while leveraging the underlying functionality of the SDK.

## Quick integration
![Credit Card](https://user-images.githubusercontent.com/8339684/42883150-0aeec504-8a9b-11e8-9a23-426ce4771481.gif)
          
![One-Click](https://user-images.githubusercontent.com/8339684/42883151-0badfece-8a9b-11e8-94d9-41320e757b01.gif)
          

#### Installation
Import the quick integration modules by adding these lines to your build.gradle file.

Expand All @@ -35,9 +40,9 @@ CheckoutController.startPayment(/*Activity*/ this, new CheckoutSetupParametersHa
});
```

Send the `CheckoutSetupParameters` to your own server, which then needs to forward this data, among some other parameters, to the Adyen Checkout API. See the [Checkout API Reference](https://docs.adyen.com/developers/in-app-integration/checkout-api-reference#setup) for more details.
Send the `CheckoutSetupParameters` to your own server, which then needs to forward this data, among some other parameters, to the Adyen Checkout API. See the [API Explorer](https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v32/paymentSession) for more details.

##### - Generating StartCheckoutParameters
##### - Generating StartPaymentParameters
After receiving the payment session data from your own server, use the `CheckoutController` to handle the payment session response:

```java
Expand Down Expand Up @@ -111,8 +116,8 @@ You can set the screen orientation by overriding the appropriate resource:
</resources>
```
The number corresponds to `ActivityInfo.ScreenOrientation`:
- landscape: 0 (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
- portrait: 1 (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
- landscape: 0 (`ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE`)
- portrait: 1 (`ActivityInfo.SCREEN_ORIENTATION_PORTRAIT`)
- etc.

##### - Changing the font
Expand All @@ -128,7 +133,7 @@ By default, we use the font that is declared in the theme that is used for check

## Custom integration
#### Installation
Import the following modules by adding these line to your build.gradle file.
Import the following modules by adding these line to your `build.gradle` file.
```groovy
final checkoutVersion = "2.0.0"
implementation "com.adyen.checkout:core:${checkoutVersion}"
Expand All @@ -140,8 +145,6 @@ implementation "com.adyen.checkout:util:${checkoutVersion}" // Optional; Collect
#### Getting started
It is possible to have more control over the payment flow — presenting your own UI for specific payment methods, filtering a list of payment methods, or implementing your own unique checkout experience. To get started, use the `PaymentController` class to start the payment:

> The following example uses RxJava and RxAndroid to perform asynchronous tasks.
```java
PaymentController.startPayment(/*Activity*/ this, new PaymentSetupParametersHandler() {
@Override
Expand All @@ -156,7 +159,7 @@ PaymentController.startPayment(/*Activity*/ this, new PaymentSetupParametersHand
});
```

Send the `PaymentSetupParameters` to your own server, which then needs to forward this data, among some other parameters, to the Adyen Checkout API. See the [Checkout API Reference](https://docs.adyen.com/developers/in-app-integration/checkout-api-reference#setup) for more details.
Send the `PaymentSetupParameters` to your own server, which then needs to forward this data, among some other parameters, to the Adyen Checkout API. See the [API Explorer](https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v32/paymentSession) for more details.

##### - Create a PaymentSession
After receiving the Base64 encoded payment session data from your own server, use the `PaymentController` to handle the payment session response:
Expand Down Expand Up @@ -241,13 +244,10 @@ mPaymentHandler.initiatePayment(paymentMethod, paymentMethodDetails);


## Example App - Quick Start
Run `bash <(curl -s https://github.com/Adyen/adyen-android/raw/2.x/setup.sh)`
Run `bash <(curl -s https://raw.githubusercontent.com/Adyen/adyen-android/master/setup.sh)`

## See also
* [Complete Documentation](https://docs.adyen.com/developers/checkout/android-sdk)

* [SDK Reference](https://adyen.github.io/adyen-android/)

* [Android SDK Guide](https://docs.adyen.com/developers/checkout/android-sdk)

## License
This repository is open source and available under the MIT license. For more information, see the LICENSE file.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ ext {
"com.tencent.mm.opensdk:wechat-sdk-android-without-mta:aff8bb92f98aa96792b984e51982fb35a8562c7cdeec270a3f163384f37bf87b:SHA-256",
]

versionCode = 200
versionName = "2.0.0"
versionCode = 201
versionName = "2.0.1"

testCoverageEnabled = true
}
Expand Down
2 changes: 1 addition & 1 deletion checkDependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ afterEvaluate {

relevantConfigurations.each { configuration ->
configuration.resolvedConfiguration.firstLevelModuleDependencies.each { dependency ->
if (dependency.moduleGroup != "com.adyen.checkout" && dependency.moduleGroup != "adyen-checkout-android-v2") {
if (dependency.moduleGroup != "com.adyen.checkout" && dependency.moduleGroup != rootProject.name) {
dependency.moduleArtifacts.each { artifact ->
def (checksum, algorithm) = rootProject.checksums.findResult {
final parts = it.split(":")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ private NfcCardReader(@NonNull Activity activity, @NonNull NfcAdapter nfcAdapter
mListener = listener;
}

/**
* @return Whether the device has NFC enabled in the settings.
*/
public boolean isNfcEnabledOnDevice() {
return mNfcAdapter.isEnabled();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
import com.adyen.checkout.core.card.Cards;
import com.adyen.checkout.core.card.EncryptedCard;
import com.adyen.checkout.core.card.EncryptionException;
import com.adyen.checkout.core.handler.AdditionalDetailsHandler;
import com.adyen.checkout.core.internal.model.InputDetailImpl;
import com.adyen.checkout.core.internal.model.PaymentMethodImpl;
import com.adyen.checkout.core.handler.AdditionalDetailsHandler;
import com.adyen.checkout.core.model.CardDetails;
import com.adyen.checkout.core.model.CupSecurePlusDetails;
import com.adyen.checkout.core.model.InputDetail;
Expand Down Expand Up @@ -723,11 +723,28 @@ private void validateSecurityCodeEditText() {
@NonNull
private CardValidator.SecurityCodeValidationResult getSecurityCodeValidationResult() {
String securityCode = mSecurityCodeEditText.getText().toString();
PaymentMethodUtil.Requirement securityCodeRequirement = PaymentMethodUtil
.getRequirementForInputDetail(CardDetails.KEY_ENCRYPTED_SECURITY_CODE, mAllowedPaymentMethods);
CardType cardType = mAllowedPaymentMethods.size() == 1 ? CardType.forTxVariantProvider(mAllowedPaymentMethods.get(0)) : null;
boolean isRequired;
CardType cardType;

if (mAllowedPaymentMethods.size() == 1) {
PaymentMethod paymentMethod = mAllowedPaymentMethods.get(0);
isRequired = PaymentMethodUtil
.getRequirementForInputDetail(CardDetails.KEY_ENCRYPTED_SECURITY_CODE, paymentMethod) == PaymentMethodUtil.Requirement.REQUIRED;
cardType = CardType.forTxVariantProvider(paymentMethod);
} else {
List<CardType> estimatedCardTypes = getCardTypesToDisplay();

if (estimatedCardTypes.size() == 1 && estimatedCardTypes.get(0) == CardType.AMERICAN_EXPRESS) {
isRequired = true;
cardType = CardType.AMERICAN_EXPRESS;
} else {
isRequired = PaymentMethodUtil.getRequirementForInputDetail(CardDetails.KEY_ENCRYPTED_SECURITY_CODE, mAllowedPaymentMethods)
== PaymentMethodUtil.Requirement.REQUIRED;
cardType = null;
}
}

return Cards.VALIDATOR.validateSecurityCode(securityCode, securityCodeRequirement == PaymentMethodUtil.Requirement.REQUIRED, cardType);
return Cards.VALIDATOR.validateSecurityCode(securityCode, isRequired, cardType);
}

@NonNull
Expand Down
4 changes: 2 additions & 2 deletions checkout-ui/src/main/res/values-da-rDK/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<string name="checkout_card_card_number_hint">Kortnummer</string>
<string name="checkout_card_expiry_date_caption">Udløbsdato</string>
<string name="checkout_card_expiry_date_hint">MM/ÅÅ</string>
<string name="checkout_card_security_code_hint">CVC/CVV</string>
<string name="checkout_card_security_code_hint">CVC / CVV</string>
<string name="checkout_card_installments">Antal rater</string>
<string name="checkout_card_nfc_error_chip_unsupported">Indsæt et enkelt kreditkort.</string>
<string name="checkout_card_nfc_error_card_unsupported">Kortet understøttes ikke.</string>
Expand Down Expand Up @@ -51,7 +51,7 @@
<string name="checkout_giropay_error_search_no_results">Ingen søgeresultater</string>

<!-- Issuer -->
<string name="checkout_issuer_choose_issuer">Vælg bank</string>
<string name="checkout_issuer_choose_issuer">Vælg din bank</string>
<string name="checkout_issuer_open_with_app_format">Åbn med %s</string>

<!-- QiwiWallet -->
Expand Down
2 changes: 1 addition & 1 deletion checkout-ui/src/main/res/values-es-rES/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
<!-- SepaDirectDebit -->
<string name="checkout_sdd_iban">Número de cuenta (IBAN)</string>
<string name="checkout_sdd_account_holder_name">Nombre del titular de cuenta</string>
<string name="checkout_sdd_consent">Acepto que la cantidad indicada se deducirá de mi cuenta bancaria.</string>
<string name="checkout_sdd_consent">Estoy de acuerdo en que la cantidad indicada será deducida de mi cuenta bancaria.</string>
<string name="checkout_sdd_iban_suggestion">Quiso decir</string>
</resources>
68 changes: 68 additions & 0 deletions checkout-ui/src/main/res/values-nb-rNO/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="checkout_title">Kasse</string>
<string name="checkout_one_click_payment_method_section_title">Dine betalingsmetoder</string>
<string name="checkout_payment_method_section_title">Betalingsmetoder</string>
<string name="checkout_payment_method_section_with_one_click_title">Velg annen metode</string>
<string name="checkout_select_other_payment_method">Velg annen metode</string>
<string name="checkout_store_details">Lagre til min neste betaling</string>
<string name="checkout_error_message_default">En feil oppstod under operasjonen.</string>
<string name="checkout_error_message_network_unavailable">Kunne ikke koble til internett, vennligst sjekk internettilkoblingen din.</string>
<string name="checkout_error_message_network_hint">Sjekk internettilkoblingen din og prøv igjen.</string>
<string name="checkout_pay_amount_format">Betal %s</string>
<string name="checkout_one_click_delete_confirmation_message">Slette betalingsmetoden %s?</string>
<string name="checkout_one_click_delete">Slett</string>
<string name="checkout_error_dialog_title">Feil</string>
<string name="checkout_ok">Ok</string>
<string name="checkout_skip">Hopp over</string>

<!-- Card -->
<string name="checkout_card_holder_name_hint">Kortholders navn</string>
<string name="checkout_card_card_number_hint">Kortnummer</string>
<string name="checkout_card_expiry_date_caption">Utløpsdato</string>
<string name="checkout_card_expiry_date_hint">MM/ÅÅ</string>
<string name="checkout_card_security_code_hint">CVC / CVV</string>
<string name="checkout_card_installments">Antall avdrag</string>
<string name="checkout_card_nfc_error_chip_unsupported">Vennligst fremvis et enkelt kredittkort.</string>
<string name="checkout_card_nfc_error_card_unsupported">Dette kortet støttes ikke.</string>
<string name="checkout_card_nfc_error_connection_lost">Vennligst prøv igjen.</string>
<string name="checkout_card_one_click_expires_format">Utløper %s</string>
<string name="checkout_card_one_click_security_code_prompt">Vennligst oppgi CVC-koden for %s</string>
<string name="checkout_card_reader_tutorial_enable_nfc">Aktiver NFC</string>
<string name="checkout_card_reader_tutorial_action">NFC-kortleser</string>
<string name="checkout_card_reader_tutorial_title">Kredittkortleser</string>
<string name="checkout_card_reader_tutorial_explanation">Hold kredittkortet nær toppen av baksiden av mobiltelefonen din.</string>
<string name="checkout_nfc_settings_redirect_failed_toast">Videresending til NFC-innstillinger feilet</string>

<!-- Card.CupSecurePlus -->
<string name="checkout_card_cup_secure_plus_phone_number_hint">Mobilnummer</string>
<string name="checkout_card_cup_secure_plus_details_activity_title">Verifisering</string>
<string name="checkout_card_cup_secure_plus_sms_code_prompt">En tekstmelding med en verifiseringskode har blitt sendt til ditt registrerte telefonnummer.</string>
<string name="checkout_card_cup_secure_plus_sms_code_caption">SMS-kode</string>

<!-- Doku -->
<string name="checkout_doku_email_address">E-postadresse</string>
<string name="checkout_doku_first_name">Fornavn</string>
<string name="checkout_doku_last_name">Etternavn</string>

<!-- Giropay -->
<string name="checkout_giropay_search_hint">Bank navn / BIC / Bankleitzahl</string>
<string name="checkout_giropay_search_hint_loading_failed">BIC (Bank Identifier Code)</string>
<string name="checkout_giropay_error_search_no_results">Ingen søkeresultater</string>

<!-- Issuer -->
<string name="checkout_issuer_choose_issuer">Velg din bank</string>
<string name="checkout_issuer_open_with_app_format">Åpne med %s</string>

<!-- QiwiWallet -->
<string name="checkout_qiwiwallet_country_code_tooltip">Landkode</string>

<string name="checkout_qiwiwallet_phone_number_caption">Mobilnummer</string>
<string name="checkout_qiwiwallet_phone_number_hint">987 65 432</string>

<!-- SepaDirectDebit -->
<string name="checkout_sdd_iban">Kontonummer (IBAN)</string>
<string name="checkout_sdd_account_holder_name">Kortholders navn</string>
<string name="checkout_sdd_consent">Jeg godtar at beløpet nedenfor vil bli trukket fra min bankkonto.</string>
<string name="checkout_sdd_iban_suggestion">Mente du</string>
</resources>
18 changes: 15 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
#!/usr/bin/env bash

# Clone the repo
git clone https://github.com/Adyen/adyen-android.git
cd adyen-android
git checkout 2.x &&
cp example-app/local.gradle.example example-app/local.gradle &&
./gradlew :example-app:assembleDebug
git checkout master &&

# Read the API key
read -p "Please enter your Checkout Demo Server API Key (x-demo-server-api-key):`echo $'\n> '`" apiKey
apiKey=${apiKey:-<YOUR_DEMO_SERVER_API_KEY>}
sed -e "s/<YOUR_DEMO_SERVER_API_KEY>/$apiKey/g" example-app/local.gradle.example > example-app/local.gradle

# Build, install, and launch the app
./gradlew assembleDebug installDebug && adb shell am start -n com.adyen.example/.MainActivity

case "$(uname -s)" in
Darwin*) open -a "Android Studio" build.gradle;;
Linux*) echo "Open $(pwd)/build.gradle with Android Studio";;
esac

0 comments on commit 5abc656

Please sign in to comment.