Skip to content

Commit f5a790d

Browse files
committed
initial commit
0 parents  commit f5a790d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1144
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
bin/
15+
gen/
16+
out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# release/
19+
20+
# Gradle files
21+
gradle/
22+
.gradle/
23+
build/
24+
25+
# Local configuration file (sdk path, etc)
26+
local.properties
27+
28+
# Proguard folder generated by Eclipse
29+
proguard/
30+
31+
# Log Files
32+
*.log
33+
34+
# Android Studio Navigation editor temp files
35+
.navigation/
36+
37+
# Android Studio captures folder
38+
captures/
39+
40+
# IntelliJ
41+
*.iml
42+
.idea
43+
.idea/
44+
.idea/workspace.xml
45+
.idea/tasks.xml
46+
.idea/gradle.xml
47+
.idea/assetWizardSettings.xml
48+
.idea/dictionaries
49+
.idea/libraries
50+
.idea/.name
51+
.idea/vcs.xml
52+
# Android Studio 3 in .gitignore file.
53+
.idea/caches
54+
.idea/modules.xml
55+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
56+
.idea/navEditor.xml
57+
58+
# Keystore files
59+
# Uncomment the following lines if you do not want to check your keystore files in.
60+
#*.jks
61+
#*.keystore
62+
63+
# External native build folder generated in Android Studio 2.2 and later
64+
.externalNativeBuild
65+
.cxx/
66+
67+
# Google Services (e.g. APIs or Firebase)
68+
# google-services.json
69+
70+
# Freeline
71+
freeline.py
72+
freeline/
73+
freeline_project_description.json
74+
75+
# fastlane
76+
fastlane/report.xml
77+
fastlane/Preview.html
78+
fastlane/screenshots
79+
fastlane/test_output
80+
fastlane/readme.md
81+
82+
# Version control
83+
vcs.xml
84+
85+
# lint
86+
lint/intermediates/
87+
lint/generated/
88+
lint/outputs/
89+
lint/tmp/
90+
# lint/reports/
91+
92+
# Android Profiling
93+
*.hprof
94+
/.idea/

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Adyen Android Assignment
2+
3+
This repository contains the coding challenge for candidates applying for a Senior Android role at Adyen.
4+
It consists of two unrelated parts:
5+
6+
## 1. Cash Register
7+
Your first task is to implement a cash register. See the `cashregister` module.
8+
9+
Criteria:
10+
- The `CashRegister` gets initialized with some `Change`.
11+
- When performing a transaction, it either returns a `Change` object or fails with a `TransactionException`.
12+
- The `CashRegister` keeps track of the `Change` that's in it.
13+
14+
Bonus points:
15+
- The cash register returns the minimal amount of change (i.e. the minimal amount of coins / bills).
16+
17+
## 2. App
18+
Your second task is to implement a small app using the Foursquare Places API. See the `app` module.
19+
20+
The app should show a list of venues around the user’s current location.
21+
Decide yourself which venue details should be relevant to the user. You have full freedom on how to present data on screen.
22+
We've already added some code to make it a bit easier for you, but you are free to change any part of it.
23+
We are going to check your implementation for understanding Android specifics (like handling configuration changes), UX choices, and overall architecture.
24+
You are free to add any feature or code you want, but we also value quality over quantity, so whatever you decide to do, try to show us your best.
25+
26+
### Setup
27+
Add your Foursquare client ID and secret to `local.gradle`. See `local.gradle.example` for details.
28+
Tip: You can verify your credentials with `src/test/java/com/adyen/android/assignment/PlacesUnitTest.kt`# FoursquareApiCompose
29+
# FoursquareApiCompose

app/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
local.gradle

app/build.gradle

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apply plugin: "com.android.application"
2+
apply plugin: 'kotlin-android'
3+
4+
if (!file("local.gradle").exists()) {
5+
exec {
6+
commandLine "sh"
7+
args = ["-c", "cp local.gradle.example local.gradle"]
8+
}
9+
}
10+
11+
apply from: "local.gradle"
12+
13+
android {
14+
compileSdkVersion 31
15+
defaultConfig {
16+
applicationId "com.adyen.android.assignment"
17+
minSdkVersion 21
18+
targetSdkVersion 31
19+
versionCode 1
20+
versionName "1.0"
21+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
22+
23+
buildConfigField "String", "FOURSQUARE_BASE_URL", "\"https://api.foursquare.com/v3/\""
24+
}
25+
buildTypes {
26+
release {
27+
minifyEnabled false
28+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
29+
}
30+
}
31+
}
32+
33+
dependencies {
34+
androidTestImplementation "androidx.test:runner:1.4.0"
35+
androidTestImplementation "androidx.test.ext:junit:1.1.3"
36+
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
37+
38+
testImplementation "junit:junit:4.13.2"
39+
40+
implementation fileTree(dir: "libs", include: ["*.jar"])
41+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
42+
implementation "androidx.appcompat:appcompat:1.4.1"
43+
implementation "androidx.core:core-ktx:1.7.0"
44+
45+
implementation "com.squareup.retrofit2:retrofit:2.9.0"
46+
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
47+
}

app/local.gradle.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
android {
2+
defaultConfig {
3+
buildConfigField "String", "API_KEY", "\"<YOU_API_KEY_GOES_HERE>\""
4+
}
5+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.adyen.android.assignment
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.adyen.android.assignment", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
package="com.adyen.android.assignment">
4+
5+
<application
6+
android:allowBackup="false"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme"
12+
tools:ignore="GoogleAppIndexingWarning" >
13+
14+
<activity android:name=".ui.MainActivity" />
15+
16+
</application>
17+
18+
</manifest>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.adyen.android.assignment.api
2+
3+
import java.text.SimpleDateFormat
4+
import java.util.Date
5+
import java.util.Locale
6+
7+
abstract class PlacesQueryBuilder {
8+
9+
fun build(): Map<String, String> {
10+
val queryParams = hashMapOf("v" to dateFormat.format(Date()))
11+
putQueryParams(queryParams)
12+
return queryParams
13+
}
14+
15+
abstract fun putQueryParams(queryParams: MutableMap<String, String>)
16+
17+
companion object {
18+
private val dateFormat = SimpleDateFormat("yyyyMMdd", Locale.ROOT)
19+
}
20+
}

0 commit comments

Comments
 (0)