Skip to content

Commit ff9521a

Browse files
authored
Merge pull request #1 from MadBrains/init_stable
Init stable
2 parents 093ba98 + bd71091 commit ff9521a

File tree

111 files changed

+5888
-1
lines changed

Some content is hidden

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

111 files changed

+5888
-1
lines changed

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.DS_Store
2+
.dart_tool/
3+
4+
.packages
5+
.pub/
6+
7+
build/
8+
9+
.fvm/
10+
.idea/
11+
.vscode/
12+
13+
# Mad Brains internal files
14+
fastlane/
15+
.gitlab-ci.yml
16+
.ruby-version
17+
Gemfile
18+
Gemfile.lock

.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 1aafb3a8b9b0c36241c5f5b34ee914770f015818
8+
channel: unknown
9+
10+
project_type: plugin

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 1.0.0
2+
3+
* Initial stable release.

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Contributing to Mad Pay
2+
## Setting up your development environment
3+
1) [Install Protobuf compiler](https://developers.google.com/protocol-buffers/docs/downloads)
4+
2) [Install Swift-plugin for Protobuf compiler](https://github.com/apple/swift-protobuf#alternatively-install-via-homebrew)
5+
3) [Install Dart-plugin for Protobuf compiler](https://pub.dev/packages/protoc_plugin#optionally-using-pub-global)
6+
4) Install Protobuf extension for IDEs (Opcional)
7+
8+
## Development
9+
You need to work with proto files in: `/protos`
10+
11+
### For Dart and Swift
12+
To compile proto, run the script in the folder: `tool/gen.sh`
13+
14+
### For Kotlin
15+
To compile proto, run the gradle build project

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Add your license here.

README.md

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,95 @@
1-
# Mad-Pay-Flutter
1+
<h1 align="center">Flutter Mad Pay</h1>
2+
3+
<a href="https://madbrains.ru/"><img src="https://firebasestorage.googleapis.com/v0/b/mad-brains-web.appspot.com/o/logo.png?alt=media" width="200" align="right" style="margin: 20px;"/></a>
4+
5+
Easy integration with Google Pay and Apple Pay for your flutter app.
6+
7+
[Apple Pay API Documentation][apple].
8+
9+
[Google Pay API Documentation][google].
10+
11+
## SDK Features
12+
* Pay with Apple Pay and Google Pay
13+
* Checking payment availability on your device
14+
* Checking the user's active cards
15+
16+
## Installing
17+
Add this to your package's pubspec.yaml file:
18+
```yaml
19+
dependencies:
20+
mad_pay: 1.0.0
21+
```
22+
23+
## Usage
24+
To start using payment you need to get Merchant Identifier:
25+
* [For Apple Pay][apple_merchant]
26+
* [For Google Pay][google_merchant]
27+
28+
```dart
29+
final MadPay pay = MadPay();
30+
31+
// To find out if payment is available on this device
32+
await pay.checkPayments();
33+
34+
// If you need to check if user has at least one active card
35+
await pay.checkActiveCard(
36+
paymentNetworks: <PaymentNetwork>[
37+
PaymentNetwork.visa,
38+
PaymentNetwork.mastercard,
39+
],
40+
);
41+
42+
// To pay with Apple Pay or Google Pay
43+
await pay.processingPayment(
44+
google: GoogleParameters(
45+
gatewayName: 'Your Gateway',
46+
gatewayMerchantId: 'Your id',
47+
),
48+
apple: AppleParameters(
49+
merchantIdentifier: 'Your id',
50+
),
51+
currencyCode: 'USD',
52+
countryCode: 'US',
53+
paymentItems: <PaymentItem>[
54+
PaymentItem(name: 'T-Shirt', price: 2.98),
55+
PaymentItem(name: 'Trousers', price: 15.24),
56+
],
57+
paymentNetworks: <PaymentNetwork>[
58+
PaymentNetwork.visa,
59+
PaymentNetwork.mastercard,
60+
],
61+
);
62+
```
63+
64+
## Example
65+
The [Example][example] is in the corresponding folder
66+
67+
## Payment Network matrix
68+
69+
| Payment Network | iOS | Android |
70+
|-------------------|-----|---------|
71+
| Visa | + | + |
72+
| MasterCard | + | + |
73+
| American Express | + | + |
74+
| Interac | + | + |
75+
| Discover | + | + |
76+
| JCB | + | + |
77+
| Maestro | + | |
78+
| Electron | + | |
79+
| Cartes Bancarries | + | |
80+
| Union Pay | + | |
81+
| EftPos | + | |
82+
| Elo | + | |
83+
| ID Credit | + | |
84+
| Mada | + | |
85+
| Private Label | + | |
86+
| Quic Pay | + | |
87+
| Suica | + | |
88+
| V Pay | + | |
89+
| Mir Pay | | |
90+
91+
[apple]: https://developer.apple.com/documentation/passkit/apple_pay/setting_up_apple_pay_requirements
92+
[google]: https://developers.google.com/pay/api/android/overview
93+
[apple_merchant]: https://help.apple.com/developer-account/#/devb2e62b839?sub=dev103e030bb
94+
[google_merchant]: https://developers.google.com/pay/api#participating-processors
95+
[example]: https://github.com/MadBrains/Mad-Pay-Flutter/tree/main/example/

analysis_options.yaml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
analyzer:
2+
exclude:
3+
- "**/*.g.dart"
4+
- "lib/src/constants.dart"
5+
- "lib/src/protos/**"
6+
strong-mode:
7+
implicit-casts: false
8+
implicit-dynamic: false
9+
errors:
10+
todo: ignore
11+
missing_return: warning
12+
missing_required_param: warning
13+
no_logic_in_create_state: warning
14+
valid_regexps: error
15+
avoid_slow_async_io: error
16+
avoid_relative_lib_imports: error
17+
avoid_types_as_parameter_names: error
18+
19+
linter:
20+
rules:
21+
- public_member_api_docs
22+
- always_declare_return_types
23+
- annotate_overrides
24+
- avoid_bool_literals_in_conditional_expressions
25+
- avoid_catching_errors
26+
- avoid_empty_else
27+
- avoid_escaping_inner_quotes
28+
- avoid_field_initializers_in_const_classes
29+
- avoid_function_literals_in_foreach_calls
30+
- avoid_implementing_value_types
31+
- avoid_init_to_null
32+
- avoid_null_checks_in_equality_operators
33+
- avoid_positional_boolean_parameters
34+
- avoid_print
35+
- avoid_private_typedef_functions
36+
- avoid_redundant_argument_values
37+
- avoid_relative_lib_imports
38+
- avoid_return_types_on_setters
39+
- avoid_returning_null_for_future
40+
- avoid_returning_null_for_void
41+
- avoid_setters_without_getters
42+
- avoid_shadowing_type_parameters
43+
- avoid_single_cascade_in_expression_statements
44+
- avoid_types_as_parameter_names
45+
- avoid_unnecessary_containers
46+
- avoid_unused_constructor_parameters
47+
- avoid_void_async
48+
- avoid_web_libraries_in_flutter
49+
- await_only_futures
50+
- camel_case_extensions
51+
- camel_case_types
52+
- cancel_subscriptions
53+
- constant_identifier_names
54+
- control_flow_in_finally
55+
- curly_braces_in_flow_control_structures
56+
- empty_catches
57+
- empty_constructor_bodies
58+
- empty_statements
59+
- file_names
60+
- hash_and_equals
61+
- implementation_imports
62+
- invariant_booleans
63+
- iterable_contains_unrelated_type
64+
- join_return_with_assignment
65+
- leading_newlines_in_multiline_strings
66+
- library_names
67+
- library_prefixes
68+
- list_remove_unrelated_type
69+
- missing_whitespace_between_adjacent_strings
70+
- no_adjacent_strings_in_list
71+
- no_duplicate_case_values
72+
- no_logic_in_create_state
73+
- no_runtimeType_toString
74+
- non_constant_identifier_names
75+
- null_closures
76+
- overridden_fields
77+
- package_names
78+
- package_prefixed_library_names
79+
- parameter_assignments
80+
- prefer_asserts_in_initializer_lists
81+
- prefer_collection_literals
82+
- prefer_conditional_assignment
83+
- prefer_const_constructors
84+
- prefer_const_constructors_in_immutables
85+
- prefer_const_declarations
86+
- prefer_const_literals_to_create_immutables
87+
- prefer_contains
88+
- prefer_equal_for_default_values
89+
- prefer_final_fields
90+
- prefer_final_in_for_each
91+
- prefer_final_locals
92+
- prefer_for_elements_to_map_fromIterable
93+
- prefer_function_declarations_over_variables
94+
- prefer_generic_function_type_aliases
95+
- prefer_if_elements_to_conditional_expressions
96+
- prefer_if_null_operators
97+
- prefer_initializing_formals
98+
- prefer_inlined_adds
99+
- prefer_interpolation_to_compose_strings
100+
- prefer_is_empty
101+
- prefer_is_not_empty
102+
- prefer_is_not_operator
103+
- prefer_iterable_whereType
104+
- prefer_null_aware_operators
105+
- prefer_spread_collections
106+
- prefer_typing_uninitialized_variables
107+
- prefer_void_to_null
108+
- provide_deprecation_message
109+
- recursive_getters
110+
- slash_for_doc_comments
111+
- sort_child_properties_last
112+
- sort_pub_dependencies
113+
- sort_unnamed_constructors_first
114+
- test_types_in_equals
115+
- throw_in_finally
116+
- type_annotate_public_apis
117+
- type_init_formals
118+
- unnecessary_await_in_return
119+
- unnecessary_brace_in_string_interps
120+
- unnecessary_const
121+
- unnecessary_getters_setters
122+
- unnecessary_new
123+
- unnecessary_null_aware_assignments
124+
- unnecessary_null_in_if_null_operators
125+
- unnecessary_overrides
126+
- unnecessary_parenthesis
127+
- unnecessary_raw_strings
128+
- unnecessary_statements
129+
- unnecessary_string_escapes
130+
- unnecessary_string_interpolations
131+
- unnecessary_this
132+
- unrelated_type_equality_checks
133+
- unsafe_html
134+
- use_full_hex_values_for_flutter_colors
135+
- use_function_type_syntax_for_parameters
136+
- use_setters_to_change_properties
137+
- use_string_buffers
138+
- valid_regexps
139+
- void_checks
140+
- sort_constructors_first
141+
- prefer_single_quotes
142+
- always_specify_types

android/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures

android/build.gradle

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
group 'ru.madbrains.mad_pay'
2+
version '1.0-SNAPSHOT'
3+
4+
buildscript {
5+
ext.kotlin_version = '1.3.50'
6+
ext.protobufVersion = '0.8.8'
7+
repositories {
8+
google()
9+
jcenter()
10+
}
11+
12+
dependencies {
13+
classpath 'com.android.tools.build:gradle:3.5.0'
14+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15+
classpath "com.google.protobuf:protobuf-gradle-plugin:$protobufVersion"
16+
classpath "com.google.protobuf:protobuf-java-util:$protobufVersion"
17+
}
18+
}
19+
20+
rootProject.allprojects {
21+
repositories {
22+
google()
23+
jcenter()
24+
}
25+
}
26+
27+
apply plugin: 'com.android.library'
28+
apply plugin: 'kotlin-android'
29+
apply plugin: 'com.google.protobuf'
30+
31+
android {
32+
compileSdkVersion 28
33+
34+
sourceSets {
35+
main.java.srcDirs += 'src/main/kotlin'
36+
main.proto.srcDirs += '../protos'
37+
}
38+
defaultConfig {
39+
minSdkVersion 16
40+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
41+
}
42+
lintOptions {
43+
disable 'InvalidPackage'
44+
}
45+
compileOptions {
46+
sourceCompatibility = "1.8"
47+
targetCompatibility = 1.8
48+
}
49+
buildToolsVersion = '28.0.3'
50+
}
51+
52+
protobuf {
53+
protoc {
54+
artifact = 'com.google.protobuf:protoc:3.6.1'
55+
}
56+
plugins {
57+
javalite {
58+
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
59+
}
60+
}
61+
generateProtoTasks {
62+
all().each { task ->
63+
task.plugins {
64+
javalite { }
65+
}
66+
}
67+
}
68+
}
69+
70+
dependencies {
71+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72+
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
73+
implementation 'com.google.android.gms:play-services-wallet:18.1.2'
74+
}

android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
org.gradle.jvmargs=-Xmx1536M
2+
android.useAndroidX=true
3+
android.enableJetifier=true

0 commit comments

Comments
 (0)