fidor_schema 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d20bce8312da6521a63aa2702dbe8422a20d2ce1
4
+ data.tar.gz: 3b140e2370a078335051e76edf9bdd947d96df4b
5
+ SHA512:
6
+ metadata.gz: 34011c7dc15704691350254dcff74eb7a9f9d15ad2a26c15b86aceba812a4f28468116d093aefa1ddd3eaad5907f5fc262526fb4b3ca33bed283c37cedcea662
7
+ data.tar.gz: c66566de7bd062112314300b4b4c51ddbbea51cacd95797523bd02543fb8f5873bcfb0bb4a71662660c51c31c53243b059225bd0ded7846f53c90c283154231b
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ coverage/*
2
+ rdoc/*
3
+ pkg/*
4
+ Gemfile.lock
5
+ .ruby-version
6
+ .ruby-gemset
7
+ *.swp
8
+ .idea
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ = Changelog Fidor API Schema
2
+
3
+ A more detailed view of the changes can be found in the [commit messages](https://github.com/fidor/fidor_schema/commits/)
4
+
5
+ 2014-10
6
+
7
+ * initial public release - ALPHA
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Fidor API Schema
2
+
3
+ The Fidor API is described with [JSON Schema](http://json-schema.org), which serves
4
+ as a public contract about available API resources and object internals.
5
+
6
+ This gem(besides the schema) provides a single utility method: the path to the
7
+ json files.
8
+
9
+ gem install fidor_schema
10
+
11
+ require 'fidor_schema'
12
+ Fidor::Schema.path
13
+
14
+ Other languages can take advantage of the raw json files.
15
+
16
+ ## Test
17
+
18
+ Install required gems with bundler and go for it:
19
+
20
+ bundle install
21
+ rake spec
22
+
23
+ ## Field types & formats
24
+
25
+ All strings MUST be UTF-8 encoded. Date & date-time values are ISO8601
26
+
27
+ Copyright (c) 2014 Fidor AG
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec'
4
+ require 'rspec/core/rake_task'
5
+
6
+ desc 'Run specs'
7
+ RSpec::Core::RakeTask.new
8
+ task :default => :spec
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fidor_schema_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'fidor_schema'
8
+ spec.version = Fidor::Schema::VERSION
9
+ spec.authors = ['Georg Leciejewski']
10
+ spec.email = 'dev@fidor.de'
11
+ spec.summary = 'Fidor API - JSON Schema'
12
+ spec.description = %q{Fidor API description. Using JSON Schema to describe the available objects, their fields and resource links.}
13
+ spec.homepage = 'https://www.fidor.de'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject{|i| i[/^docs\//] }
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.5'
22
+ spec.add_development_dependency 'rspec'
23
+ spec.add_development_dependency 'activesupport'
24
+ spec.add_development_dependency 'json_schema_tools', '>=0.2.6'
25
+ spec.add_development_dependency 'activemodel' # required by above
26
+ spec.add_development_dependency 'rake'
27
+
28
+ end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+ module Fidor
3
+ class Schema
4
+ # Get the path to schema files delivered by this gem.
5
+ # @example
6
+ # Fidor::Schema.path # => /home/me/gems/.../fidor_schema/schema
7
+ #
8
+ # @param [String] version folder name to use
9
+ def self.path(version='v1.0')
10
+ File.expand_path( File.join('../../schema', version), File.dirname(__FILE__))
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,2 @@
1
+ require 'fidor/schema'
2
+ require 'fidor_schema_version'
@@ -0,0 +1,5 @@
1
+ module Fidor
2
+ class Schema
3
+ VERSION='0.1.18'
4
+ end
5
+ end
@@ -0,0 +1,118 @@
1
+ {
2
+ "type" : "object",
3
+ "title" : "Account",
4
+ "name" : "account",
5
+ "description" : "A fidor bank account.",
6
+ "properties" : {
7
+ "id" : {
8
+ "$ref" : "./base_types/base_types.json#definitions/id"
9
+ },
10
+ "account_number" : {
11
+ "description" : "The bank account number.",
12
+ "type" : "string",
13
+ "maxLength" : 10,
14
+ "readonly" : true
15
+ },
16
+ "iban" : {
17
+ "$ref" : "./base_types/base_types.json#definitions/iban",
18
+ "readonly" : true
19
+ },
20
+ "balance" : {
21
+ "description" : "Account balance",
22
+ "type" : "number",
23
+ "readonly" : true
24
+ },
25
+ "balance_available" : {
26
+ "description" : "Available account balance.",
27
+ "type" : "number",
28
+ "readonly" : true
29
+ },
30
+ "overdraft" : {
31
+ "description" : "Available account overdraft",
32
+ "type" : "number",
33
+ "readonly" : true
34
+ },
35
+ "preauth_amount" : {
36
+ "description" : "Amount available for pre-authorization.",
37
+ "type" : "number",
38
+ "readonly" : true
39
+ },
40
+ "cash_flow_per_year" : {
41
+ "description" : "Amount available for yearly cash flow. This is the limit of funds an account holder has at their disposal without fulfilling Germany KYC requirements.",
42
+ "type" : "number",
43
+ "readonly" : true
44
+ },
45
+ "is_debit_note_enabled" : {
46
+ "description" : "Whether this account is authorized to initiate direct debit transactions.",
47
+ "type" : "boolean",
48
+ "default" : false,
49
+ "readonly" : true
50
+ },
51
+ "is_trusted" : {
52
+ "description" : "Indicates if this is an escrow account",
53
+ "type" : "boolean",
54
+ "default" : false,
55
+ "readonly" : true
56
+ },
57
+ "is_locked" : {
58
+ "description" : "Indicates whether the account is locked",
59
+ "type" : "boolean",
60
+ "readonly" : true
61
+ },
62
+ "currency" : {
63
+ "$ref" : "./base_types/base_types.json#definitions/currency",
64
+ "readonly" : true
65
+ },
66
+ "customers" : {
67
+ "description" : "The owners of the account",
68
+ "type" : "array",
69
+ "items" : {
70
+ "type" : "object",
71
+ "properties" : {
72
+ "$ref" : "./customer.json#properties"
73
+ }
74
+ },
75
+ "readonly" : true
76
+ },
77
+ "created_at" : {
78
+ "$ref" : "./base_types/base_types.json#definitions/created_at"
79
+ },
80
+ "updated_at" : {
81
+ "$ref" : "./base_types/base_types.json#definitions/updated_at"
82
+ }
83
+ },
84
+ "links" : [
85
+ {
86
+ "rel" : "self",
87
+ "href" : "accounts/{id}"
88
+ },
89
+ {
90
+ "rel" : "instances",
91
+ "href" : "accounts"
92
+ },
93
+ {
94
+ "rel" : "transactions",
95
+ "href" : "accounts/{id}/transactions"
96
+ },
97
+ {
98
+ "rel" : "internal_transfers",
99
+ "href" : "accounts/{id}/internal_transfers"
100
+ },
101
+ {
102
+ "rel" : "sepa_credit_transfers",
103
+ "href" : "accounts/{id}/sepa_credit_transfers"
104
+ },
105
+ {
106
+ "rel" : "sepa_direct_debits",
107
+ "href" : "accounts/{id}/sepa_direct_debits"
108
+ },
109
+ {
110
+ "rel" : "batch_transfers",
111
+ "href" : "accounts/{id}/batch_transfers"
112
+ },
113
+ {
114
+ "rel" : "batch_direct_debit",
115
+ "href" : "accounts/{id}/batch_direct_debits"
116
+ }
117
+ ]
118
+ }
@@ -0,0 +1,124 @@
1
+ {
2
+ "definitions" : {
3
+ "id" : {
4
+ "description" : "Unique identifier of the object",
5
+ "identity" : true,
6
+ "readonly" : true,
7
+ "type" : "integer"
8
+ },
9
+ "account_id" : {
10
+ "description" : "Fidor account the transaction belongs to.",
11
+ "type" : "string",
12
+ "pattern" : "\\d{8}"
13
+ },
14
+ "user_id" : {
15
+ "description" : "Identifies the user who created this object",
16
+ "readonly" : true,
17
+ "type" : "string",
18
+ "pattern" : "\\d{8}"
19
+ },
20
+ "transaction_id" : {
21
+ "description" : "Identifies a reference to a corresponding transaction",
22
+ "readonly" : true,
23
+ "type" : "integer"
24
+ },
25
+ "phone" : {
26
+ "description" : "A phone or fax number, formatted with country code: +49 123 1233213",
27
+ "type" : "string",
28
+ "pattern" : "\\+[ 0-9]*"
29
+ },
30
+ "email" : {
31
+ "description" : "Email address",
32
+ "type" : "string",
33
+ "format" : "email",
34
+ "maxLength" : 100
35
+ },
36
+ "twitter" : {
37
+ "description" : "Twitter username",
38
+ "type" : "string",
39
+ "pattern" : "^@(\\w){1,15}$"
40
+ },
41
+ "created_at" : {
42
+ "description" : "Creation date-time, never changes.",
43
+ "format" : "date-time",
44
+ "type" : "string",
45
+ "readonly" : true
46
+ },
47
+ "updated_at" : {
48
+ "description" : "Last update date-time.",
49
+ "format" : "date-time",
50
+ "type" : "string",
51
+ "readonly" : true
52
+ },
53
+ "external_uid" : {
54
+ "description" : "Unique ID of the creator of the transaction. In case a uid is reused for a transaction, it is not executed, this mechanism can be used to prevent double bookings in case of network failure or similar event where transaction status is unknown",
55
+ "type" : "string",
56
+ "required" : true
57
+ },
58
+ "iban" : {
59
+ "description" : "IBAN",
60
+ "checksum" : "Checksum is calculated as described in ISO 13616-1, 2 digits MOD97 inserted after the country code",
61
+ "type" : "string",
62
+ "maxLength" : 34,
63
+ "pattern" : "^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$"
64
+ },
65
+ "bic" : {
66
+ "description" : "BIC / Swift code of bank",
67
+ "type" : "string",
68
+ "pattern" : "^([A-Z0-9]{8}|[A-Z0-9]{8})$",
69
+ "maxLength" : 11
70
+ },
71
+ "eref" : {
72
+ "description" : "End-to-end reference.",
73
+ "type" : "string",
74
+ "maxLength" : 255
75
+ },
76
+ "country" : {
77
+ "description" : "Country code as defined in ISO3166 alpha2. e.g DE, GB",
78
+ "type" : "string",
79
+ "minLength" : 2,
80
+ "maxLength" : 2
81
+ },
82
+ "currency" : {
83
+ "description" : "Account currency. ISO 4217 alpha-3 - 3 letter upcase e.g EUR",
84
+ "type" : "string",
85
+ "maxLength" : 3,
86
+ "minLength" : 3,
87
+ "default" : "EUR"
88
+ },
89
+ "subject" : {
90
+ "description" : "Transfer subject (reference)",
91
+ "type" : "string",
92
+ "pattern" : "^[A-Za-z0-9_\\.\\, &\\-\\/\\+\\*\\$\\%@üöäÜÖÄ߀]*$"
93
+ },
94
+ "amount" : {
95
+ "description" : "The transferred amount in account currency, two decimal places. Must be greater than 0 e.g. > 0",
96
+ "type" : "number",
97
+ "exclusiveMinimum" : true,
98
+ "minimum" : 0
99
+ },
100
+ "transaction_type" : {
101
+ "description" : "Type of the transaction",
102
+ "enum" : [
103
+ "payin_giropay",
104
+ "payin_paymentnetwork",
105
+ "payin_credit_note",
106
+ "payin_debit_note_eze",
107
+ "payin_debit_note_aba",
108
+ "payin_credit_note_sepa",
109
+ "payin_debit_note_sepa_core",
110
+ "payin_debit_note_sepa_b2b",
111
+ "payin_fidorpay",
112
+ "payout_ogone",
113
+ "payout_paymentnetwork",
114
+ "payout_credit_note",
115
+ "payout_debit_note_eze",
116
+ "payout_credit_note_sepa",
117
+ "payout_fidorpay",
118
+ "payout_creditcard",
119
+ "payout_fee"
120
+ ],
121
+ "type" : "string"
122
+ }
123
+ }
124
+ }
@@ -0,0 +1,140 @@
1
+ {
2
+ "type" : "object",
3
+ "title" : "Batch Direct Debit",
4
+ "name" : "batch_direct_debit",
5
+ "description" : "A direct debit batch contains multiple direct debits which are processed asynchronously.",
6
+ "properties" : {
7
+ "id" : {
8
+ "$ref" : "./base_types/base_types.json#definitions/id"
9
+ },
10
+ "external_uid" : {
11
+ "$ref" : "./base_types/base_types.json#definitions/external_uid"
12
+ },
13
+ "account_id" : {
14
+ "$ref" : "./base_types/base_types.json#definitions/account_id",
15
+ "required" : true
16
+ },
17
+ "user_id" : {
18
+ "$ref" : "./base_types/base_types.json#definitions/user_id"
19
+ },
20
+ "sepa_direct_debits" : {
21
+ "description" : "The direct_debits to process.",
22
+ "type" : "array",
23
+ "required" : false,
24
+ "items" : {
25
+ "type" : "object",
26
+ "properties" : {
27
+ "$ref" : "./sepa_direct_debit.json#properties"
28
+ }
29
+ }
30
+ },
31
+ "sepa_direct_debit_ids" : {
32
+ "description" : "ids of successfully executed direct debit transactions",
33
+ "type" : "array",
34
+ "items" : {
35
+ "$ref" : "./base_types/base_types.json#definitions/id"
36
+ }
37
+ },
38
+ "sepa_direct_debit_errors" : {
39
+ "description" : "contains a list of errors encountered in nested debits contained in this batch. Debits are identified by external_uid",
40
+ "type" : "array",
41
+ "items" : {
42
+ "type" : "object",
43
+ "properties" : {
44
+ "external_uid" : {
45
+ "type" : "string"
46
+ },
47
+ "error" : {
48
+ "type" : "object",
49
+ "properties" : {
50
+ "$ref" : "./error.json#properties"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "number_of_debits" : {
57
+ "description" : "count of debits transactions received in this batch",
58
+ "readonly" : true,
59
+ "type" : "integer"
60
+ },
61
+ "state" : {
62
+ "description" : "State of the batch operation. received: We received the batch | processing: Batch is currently being processed | failure: An error occurred during execution in at least one of the transfers. In this case you should check the transfers. | success: batch successfully processed",
63
+ "enum" : [
64
+ "received",
65
+ "processing",
66
+ "success",
67
+ "failure"
68
+ ],
69
+ "readonly" : true,
70
+ "type" : "string"
71
+ },
72
+ "success_url" : {
73
+ "description" : "Url receiving a POST with the batch object after processing is finished.",
74
+ "type" : "string",
75
+ "format" : "uri"
76
+ },
77
+ "created_at" : {
78
+ "$ref" : "./base_types/base_types.json#definitions/created_at"
79
+ },
80
+ "updated_at" : {
81
+ "$ref" : "./base_types/base_types.json#definitions/updated_at"
82
+ }
83
+ },
84
+ "links" : [
85
+ {
86
+ "rel" : "self",
87
+ "href" : "batch_direct_debits/{id}"
88
+ },
89
+ {
90
+ "rel" : "instances",
91
+ "href" : "batch_direct_debits",
92
+ "properties" : {
93
+ "filter[created_at_from]" : {
94
+ "title" : "Creation date filter from >= date",
95
+ "format" : "date",
96
+ "type" : "string"
97
+ },
98
+ "filter[created_at_to]" : {
99
+ "title" : "Creation date filter to <= date",
100
+ "format" : "date",
101
+ "type" : "string"
102
+ },
103
+ "filter[states]" : {
104
+ "title" : "Filter by single or multiple csv delimited states",
105
+ "enum" : [
106
+ "received",
107
+ "processing",
108
+ "success",
109
+ "failure"
110
+ ],
111
+ "type" : "string"
112
+ },
113
+ "page" : {
114
+ "title" : "Page",
115
+ "description" : "In paginated results set the page to look for",
116
+ "type" : "number"
117
+ },
118
+ "per_page" : {
119
+ "title" : "Per page",
120
+ "description" : "Results per page. Default is 10, max is 100",
121
+ "type" : "number"
122
+ },
123
+ "sort" : {
124
+ "title" : "Sort",
125
+ "enum" : [
126
+ "ASC",
127
+ "DESC"
128
+ ],
129
+ "description" : "Sort the results in ASC or DESC",
130
+ "type" : "string"
131
+ }
132
+ }
133
+ },
134
+ {
135
+ "rel" : "create",
136
+ "href" : "batch_direct_debits",
137
+ "method" : "POST"
138
+ }
139
+ ]
140
+ }
@@ -0,0 +1,179 @@
1
+ {
2
+ "type" : "object",
3
+ "title" : "Batch Transfer",
4
+ "name" : "batch_transfer",
5
+ "description" : "A transfer batch contains multiple transfers which are processed asynchronously.",
6
+ "properties" : {
7
+ "id" : {
8
+ "$ref" : "./base_types/base_types.json#definitions/id"
9
+ },
10
+ "external_uid" : {
11
+ "$ref" : "./base_types/base_types.json#definitions/external_uid"
12
+ },
13
+ "account_id" : {
14
+ "$ref" : "./base_types/base_types.json#definitions/account_id",
15
+ "required" : true
16
+ },
17
+ "user_id" : {
18
+ "$ref" : "./base_types/base_types.json#definitions/user_id"
19
+ },
20
+ "sepa_credit_transfers" : {
21
+ "description" : "SEPA credit transfers to process",
22
+ "type" : "array",
23
+ "items" : {
24
+ "type" : "object",
25
+ "properties" : {
26
+ "$ref" : "./sepa_credit_transfer.json#properties"
27
+ }
28
+ }
29
+ },
30
+ "internal_transfers" : {
31
+ "description" : "Interal transfers to process",
32
+ "type" : "array",
33
+ "items" : {
34
+ "type" : "object",
35
+ "properties" : {
36
+ "$ref" : "./internal_transfer.json#properties"
37
+ }
38
+ }
39
+ },
40
+ "sepa_credit_transfer_ids" : {
41
+ "description" : "ids of successfully executed SEPA credit transfers",
42
+ "type" : "array",
43
+ "items" : {
44
+ "$ref" : "./base_types/base_types.json#definitions/id"
45
+ }
46
+ },
47
+ "internal_transfer_ids" : {
48
+ "description" : "ids of successfully executed internal transfers",
49
+ "type" : "array",
50
+ "items" : {
51
+ "$ref" : "./base_types/base_types.json#definitions/id"
52
+ }
53
+ },
54
+ "sepa_credit_transfer_errors" : {
55
+ "description" : "contains a list of errors encountered in nested debits contained in this batch. Transfers are identified by external_uid contained in the original transfer json",
56
+ "type" : "array",
57
+ "items" : {
58
+ "type" : "object",
59
+ "properties" : {
60
+ "external_uid" : {
61
+ "type" : "string"
62
+ },
63
+ "error" : {
64
+ "type" : "object",
65
+ "properties" : {
66
+ "$ref" : "./error.json#properties"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ },
72
+ "internal_transfer_errors" : {
73
+ "description" : "contains a list of errors encountered in nested debits contained in this batch. Transfers are identified by external_uid contained in the original transfer json",
74
+ "type" : "array",
75
+ "items" : {
76
+ "type" : "object",
77
+ "properties" : {
78
+ "external_uid" : {
79
+ "type" : "string"
80
+ },
81
+ "error" : {
82
+ "type" : "object",
83
+ "properties" : {
84
+ "$ref" : "./error.json#properties"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ },
90
+ "number_of_transfers" : {
91
+ "description" : "count of transfers (internal and sepa) transactions received in this batch",
92
+ "readonly" : true,
93
+ "type" : "integer"
94
+ },
95
+ "state" : {
96
+ "description" : "State of the batch operation. received: We received the batch | processing: Batch is currently being processed | failure: An error occurred during execution of the batch. In this case you should check the transfers. | success: Batch execution has been completed.",
97
+ "enum" : [
98
+ "received",
99
+ "processing",
100
+ "success",
101
+ "failure"
102
+ ],
103
+ "readonly" : true,
104
+ "type" : "string"
105
+ },
106
+ "success_url" : {
107
+ "description" : "Url receiving a POST with the batch object after processing is finished.",
108
+ "type" : "string",
109
+ "format" : "uri"
110
+ },
111
+ "created_at" : {
112
+ "$ref" : "./base_types/base_types.json#definitions/created_at"
113
+ },
114
+ "updated_at" : {
115
+ "$ref" : "./base_types/base_types.json#definitions/updated_at"
116
+ }
117
+ },
118
+ "links" : [
119
+ {
120
+ "rel" : "self",
121
+ "href" : "batch_transfers/{id}"
122
+ },
123
+ {
124
+ "rel" : "instances",
125
+ "href" : "batch_transfers",
126
+ "properties" : {
127
+ "filter[account_ids]" : {
128
+ "title" : "Find transfers belonging to the given account ids. Single id or multiple ids comma-separated.",
129
+ "format" : "date",
130
+ "type" : "string"
131
+ },
132
+ "filter[created_at_from]" : {
133
+ "title" : "Creation date filter from >= date",
134
+ "format" : "date",
135
+ "type" : "string"
136
+ },
137
+ "filter[created_at_to]" : {
138
+ "title" : "Creation date filter to <= date",
139
+ "format" : "date",
140
+ "type" : "string"
141
+ },
142
+ "filter[states]" : {
143
+ "title" : "Filter by single or multiple csv delimited states",
144
+ "enum" : [
145
+ "received",
146
+ "processing",
147
+ "success",
148
+ "failure"
149
+ ],
150
+ "type" : "string"
151
+ },
152
+ "page" : {
153
+ "title" : "Page",
154
+ "description" : "In paginated results set the page to look for",
155
+ "type" : "number"
156
+ },
157
+ "per_page" : {
158
+ "title" : "Per page",
159
+ "description" : "Results per page. Default is 10, max is 100",
160
+ "type" : "number"
161
+ },
162
+ "sort" : {
163
+ "title" : "Sort",
164
+ "enum" : [
165
+ "ASC",
166
+ "DESC"
167
+ ],
168
+ "description" : "Sort the results in ASC or DESC",
169
+ "type" : "string"
170
+ }
171
+ }
172
+ },
173
+ {
174
+ "rel" : "create",
175
+ "href" : "batch_transfers",
176
+ "method" : "POST"
177
+ }
178
+ ]
179
+ }