dvla-application_helper 5.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.drone.yml +481 -0
- data/.env.template +4 -0
- data/.rspec +3 -0
- data/.rubocop.yml +21 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/README.md +674 -0
- data/Rakefile +31 -0
- data/config/settings/drone-dev.yml +41 -0
- data/config/settings/drone-ext.yml +35 -0
- data/config/settings/drone-link.yml +35 -0
- data/config/settings/drone-perf.yml +35 -0
- data/config/settings/local-dev.yml +40 -0
- data/config/settings/local-ext.yml +35 -0
- data/config/settings/local-link.yml +35 -0
- data/config/settings/local-perf.yml +35 -0
- data/config/settings.yml +29 -0
- data/config/yarp.yml +6 -0
- data/functional-tests/Rakefile +74 -0
- data/functional-tests/chutney.yml +110 -0
- data/functional-tests/features/codl.feature +170 -0
- data/functional-tests/features/codl_image_review_states.feature +140 -0
- data/functional-tests/features/csudl.feature +54 -0
- data/functional-tests/features/csudl_image_review_states.feature +20 -0
- data/functional-tests/features/step_definitions/app_domain_steps.rb +213 -0
- data/functional-tests/features/step_definitions/application_creation_steps.rb +115 -0
- data/functional-tests/features/step_definitions/image_steps.rb +144 -0
- data/functional-tests/features/step_definitions/state_machine_steps.rb +43 -0
- data/functional-tests/features/support/data/artefacts.rb +27 -0
- data/functional-tests/features/support/data/image_helpers.rb +20 -0
- data/functional-tests/features/support/data/schema_helpers.rb +3 -0
- data/functional-tests/features/support/data/string_manipulation.rb +9 -0
- data/functional-tests/features/support/env.rb +25 -0
- data/functional-tests/features/support/hooks.rb +56 -0
- data/functional-tests/features/support/yarp_integration/yarp_helpers.rb +23 -0
- data/functional-tests/features/uodl_image_review_states.feature +244 -0
- data/functional-tests/features/uodl_non_processable.feature +441 -0
- data/functional-tests/features/uodl_processable.feature +416 -0
- data/lib/dvla/application_helper/builders/V1/application_builder.rb +298 -0
- data/lib/dvla/application_helper/builders/V1/codl_application_builder.rb +205 -0
- data/lib/dvla/application_helper/builders/V1/csudl_application_builder.rb +329 -0
- data/lib/dvla/application_helper/builders/V2/base_uodl_v2_application_builder.rb +357 -0
- data/lib/dvla/application_helper/builders/V2/cop_v2_application_builder.rb +59 -0
- data/lib/dvla/application_helper/builders/V2/dup_v2_application_builder.rb +84 -0
- data/lib/dvla/application_helper/builders/V2/exc_v2_application_builder.rb +55 -0
- data/lib/dvla/application_helper/builders/V2/rep_v2_application_builder.rb +84 -0
- data/lib/dvla/application_helper/builders/V2/tyr_v2_application_builder.rb +62 -0
- data/lib/dvla/application_helper/builders/V2/uodl_v2_application_builder.rb +278 -0
- data/lib/dvla/application_helper/builders/V3/base_uodl_v3_application_builder.rb +342 -0
- data/lib/dvla/application_helper/builders/V3/cop_v3_application_builder.rb +56 -0
- data/lib/dvla/application_helper/builders/V3/dup_v3_application_builder.rb +78 -0
- data/lib/dvla/application_helper/builders/V3/exc_v3_application_builder.rb +56 -0
- data/lib/dvla/application_helper/builders/V3/rep_v3_application_builder.rb +81 -0
- data/lib/dvla/application_helper/builders/V3/tyr_v3_application_builder.rb +59 -0
- data/lib/dvla/application_helper/builders/dup_rep_builder_mixin.rb +71 -0
- data/lib/dvla/application_helper/builders/photo_builder_mixin.rb +49 -0
- data/lib/dvla/application_helper/builders/photo_signature_builder_mixin.rb +68 -0
- data/lib/dvla/application_helper/configuration.rb +37 -0
- data/lib/dvla/application_helper/constants.rb +21 -0
- data/lib/dvla/application_helper/enums/review_state.rb +30 -0
- data/lib/dvla/application_helper/enums/unable_to_prove_licence_possession_reasons.rb +8 -0
- data/lib/dvla/application_helper/factories/address.rb +21 -0
- data/lib/dvla/application_helper/factories/application_details.rb +353 -0
- data/lib/dvla/application_helper/factories/casework.rb +7 -0
- data/lib/dvla/application_helper/factories/csudl_photo_signature_image.rb +156 -0
- data/lib/dvla/application_helper/factories/csudl_photo_signature_images.rb +85 -0
- data/lib/dvla/application_helper/factories/organ_donor.rb +32 -0
- data/lib/dvla/application_helper/factories/person.rb +73 -0
- data/lib/dvla/application_helper/factories/photo_image.rb +147 -0
- data/lib/dvla/application_helper/factories/photo_images.rb +183 -0
- data/lib/dvla/application_helper/factories/photo_signature_image.rb +158 -0
- data/lib/dvla/application_helper/factories/photo_signature_images.rb +64 -0
- data/lib/dvla/application_helper/fixtures/photo/comparison_image.jpeg +0 -0
- data/lib/dvla/application_helper/fixtures/photo/passport_image.jpg +0 -0
- data/lib/dvla/application_helper/fixtures/photo/photocard_back.jpg +0 -0
- data/lib/dvla/application_helper/fixtures/photo/photocard_front.jpg +0 -0
- data/lib/dvla/application_helper/fixtures/photo/rejected_user_uploaded_image.jpeg +0 -0
- data/lib/dvla/application_helper/fixtures/photo/user_uploaded_image.jpg +0 -0
- data/lib/dvla/application_helper/fixtures/signature/csudl_signature_image.tiff +0 -0
- data/lib/dvla/application_helper/fixtures/signature/passport_image.jpg +0 -0
- data/lib/dvla/application_helper/fixtures/signature/rejected_user_uploaded_image.jpg +0 -0
- data/lib/dvla/application_helper/fixtures/signature/user_uploaded_image.jpg +0 -0
- data/lib/dvla/application_helper/processors/application_status.rb +45 -0
- data/lib/dvla/application_helper/processors/application_task.rb +301 -0
- data/lib/dvla/application_helper/services/application_diary.rb +123 -0
- data/lib/dvla/application_helper/services/application_domain.rb +239 -0
- data/lib/dvla/application_helper/services/application_process_engine.rb +120 -0
- data/lib/dvla/application_helper/services/check_aws_credentials.rb +24 -0
- data/lib/dvla/application_helper/services/driving_licence_channel_api.rb +67 -0
- data/lib/dvla/application_helper/services/image_service.rb +116 -0
- data/lib/dvla/application_helper/services/image_utility.rb +82 -0
- data/lib/dvla/application_helper/services/state_machine_helpers.rb +146 -0
- data/lib/dvla/application_helper/version.rb +5 -0
- data/lib/dvla/application_helper.rb +92 -0
- data/renovate.json +4 -0
- data/scripts/application-login.sh +56 -0
- data/scripts/drone-aws-login.sh +18 -0
- data/scripts/seed_application.rb +268 -0
- data/sonar-project.properties +4 -0
- metadata +343 -0
data/README.md
ADDED
@@ -0,0 +1,674 @@
|
|
1
|
+
# DVLA::Application::Helper
|
2
|
+
|
3
|
+
This gem allows you to submit test data and create new applications in the application-domain. It uploads images to the driving licence channel api and image service (where necessary) to ensure that applications have the required data. This should be used to aid automated testing for DVLA projects.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'dvla-application_helper', '~> 3.9'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install dvla-application_helper
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
This Gem allows you to create applications within application domain. The goal is for these applications to be used within QE testing, but these can also be used during local development and debugging to quickly create an application in the required format.
|
24
|
+
|
25
|
+
### Required environment variables
|
26
|
+
|
27
|
+
- You will need AWS access to the account which you are running this gem within, these can obtained either via an aws-login.sh script from another repository, or via the aws management console.
|
28
|
+
- Access is required to an instance of each, the driving-licence-channel-api, application-domain, image-service, and image-utility
|
29
|
+
|
30
|
+
### Configuration
|
31
|
+
|
32
|
+
You will need to add some configuration to your `settings.yml` files to point at the various services. Some of the common configurations are provided in the `config/settings/` directory:
|
33
|
+
|
34
|
+
- Dev environment from a local machine (`local-dev.yml`)
|
35
|
+
- Dev environment from drone (`drone-dev.yml`)
|
36
|
+
- Link environment from a local machine (`local-link.yml`)
|
37
|
+
- Link environment from drone (`drone-link.yml`)
|
38
|
+
- Ext environment from a local machine (`local-ext.yml`)
|
39
|
+
- Ext environment from drone (`drone-ext.yml`)
|
40
|
+
- Perf environment from a local machine (`local-perf.yml`)
|
41
|
+
- Perf environment from drone (`drone-perf.yml`)
|
42
|
+
|
43
|
+
### Example of the required config for local-dev:
|
44
|
+
```
|
45
|
+
services:
|
46
|
+
driving_licence_channel_api:
|
47
|
+
stage_name: dev
|
48
|
+
host: v5xx72m7z5-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com
|
49
|
+
application_domain:
|
50
|
+
stage_name: dev
|
51
|
+
host: pc4j6sohv8-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com
|
52
|
+
image_service:
|
53
|
+
base_url: https://flvh6n0yx6-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/link/
|
54
|
+
image_utility:
|
55
|
+
base_url: https://r8t8c9sl7g-vpce-0c9077c8fe760fea6.execute-api.eu-west-2.amazonaws.com/link/
|
56
|
+
```
|
57
|
+
|
58
|
+
### Settings config in functional tests
|
59
|
+
In your env.rb, you will need to add this in order to allow the gem to prepend your config settings into its own:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
DVLA::Application.config do |config|
|
63
|
+
config.environment = environment
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
### Logger
|
68
|
+
|
69
|
+
By default the gem will use `DVLA::Herotodus` as a logger with a system name of `application-helper`.
|
70
|
+
You can override this with your own logger in the configuration e.g.
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
DVLA::Application.config do |config|
|
74
|
+
config.logger = Logger.new($stdout)
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
### Email addresses
|
79
|
+
This gem currently uses the Poirot gem that generates an email address with the `@mailsac.com` domain. This is slowly being phased out in favour of `@dvla.msdc.co`.
|
80
|
+
The standard for email addresses now also requires that you prefix your email address with the project name. As you can't control that directly in the builder via Poirot, you can achieve it with env vars.
|
81
|
+
|
82
|
+
NOTE: Do not include the @ in your domain!
|
83
|
+
|
84
|
+
In your .env, you can add the following to format the email address correctly:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
EMAIL_PREFIX='my-project-name-'
|
88
|
+
EMAIL_DOMAIN='emaildomain.com'
|
89
|
+
```
|
90
|
+
|
91
|
+
These values will also need to be added to your CI/CD pipeline.
|
92
|
+
|
93
|
+
Alternatively, you can add these two settings to your own settings.yml to overwrite the values:
|
94
|
+
|
95
|
+
```yaml
|
96
|
+
application_helper:
|
97
|
+
applicant_email:
|
98
|
+
email_prefix: test-app-
|
99
|
+
email_domain: test-domain
|
100
|
+
```
|
101
|
+
|
102
|
+
## Deployed Stages
|
103
|
+
By default the app helper always points towards dev / link stage.
|
104
|
+
This however can be overrided and you can point towards a specific stage if you wish. You will need pass a few variable to your env to overide the default ones.
|
105
|
+
|
106
|
+
APE:
|
107
|
+
|
108
|
+
APPLICATION_PROCESS_ENGINE_STAGE_NAME
|
109
|
+
|
110
|
+
APPLICATION_PROCESS_ENGINE_API_ID
|
111
|
+
|
112
|
+
APPLICATION_PROCESS_ENGINE_VPCE_ID
|
113
|
+
|
114
|
+
Domain:
|
115
|
+
|
116
|
+
APPLICATION_DOMAIN_STAGE_NAME
|
117
|
+
|
118
|
+
APPLICATION_DOMAIN_API_ID
|
119
|
+
|
120
|
+
APPLICATION_DOMAIN_VPCE_ID
|
121
|
+
|
122
|
+
Channel Api:
|
123
|
+
|
124
|
+
CHANNEL_API_STAGE_NAME
|
125
|
+
|
126
|
+
CHANNEL_API_API_ID
|
127
|
+
|
128
|
+
CHANNEL_API_VPCE_ID
|
129
|
+
|
130
|
+
|
131
|
+
## Functional Test Set up
|
132
|
+
|
133
|
+
### Setup:
|
134
|
+
|
135
|
+
#### .env
|
136
|
+
In root directory, make a copy of the .env.template file, rename it to .env
|
137
|
+
|
138
|
+
If using rubymine, edit the cucumber run configuration and add in the .env file
|
139
|
+
|
140
|
+
#### AWS Login
|
141
|
+
From root directory, run the following command to log the terminal into AWS, this will also update your credentials into your .env file
|
142
|
+
|
143
|
+
```bash
|
144
|
+
. scripts/application-login.sh
|
145
|
+
```
|
146
|
+
|
147
|
+
#### Bundle Gems
|
148
|
+
Run the following command from within the root directory
|
149
|
+
```bash
|
150
|
+
bundle install
|
151
|
+
```
|
152
|
+
|
153
|
+
#### Running the functional tests
|
154
|
+
Tests can be run either through the IDE UI (eg rubymine)
|
155
|
+
|
156
|
+
or,
|
157
|
+
|
158
|
+
tests can be run through the terminal and use the following command:
|
159
|
+
````
|
160
|
+
bundle exec cucumber
|
161
|
+
````
|
162
|
+
|
163
|
+
If you want to run a single test, easiest way is to add a tag above the scenario name eg: @Test
|
164
|
+
|
165
|
+
Then run the following command to run that single test (NOTE, if you tag multiple tests with the same tag, they will all be run)
|
166
|
+
```
|
167
|
+
bundle exec cucumber -t@Test
|
168
|
+
```
|
169
|
+
## Running Functional tests locally in parallel
|
170
|
+
You can utilise the rake command to run the tests locally, this will speed them up substantially, however, if you use too many threads it can and will cause issues.
|
171
|
+
I have found using up to 16 threads is relatively stable and gives quick feedback
|
172
|
+
It is also possible to specify the exact feature file you wish to run. Output can take a while to appear if running the whole pack
|
173
|
+
#### You must run this command while in the functional test directory
|
174
|
+
e.g.
|
175
|
+
```
|
176
|
+
bundle exec rake test:functional\["features/","12"\]
|
177
|
+
```
|
178
|
+
```
|
179
|
+
bundle exec rake test:functional\["features/uodl.feature","12"\]
|
180
|
+
```
|
181
|
+
|
182
|
+
|
183
|
+
## Creating a new application
|
184
|
+
|
185
|
+
#### Using the application builder
|
186
|
+
|
187
|
+
This gem has been built following the builder pattern to make creating applications easier. To build an application you will need to use the application_builder class.
|
188
|
+
|
189
|
+
To create a new Application Builder you would execute one of the following, depending on the required schema and application type:
|
190
|
+
|
191
|
+
```
|
192
|
+
V1 schema:
|
193
|
+
DVLA::Application::CODLApplicationBuilder.new
|
194
|
+
DVLA::Application::ApplicationBuilder.new - Marked as Deprecated in 4.7.3
|
195
|
+
DVLA::Application::CSUDLApplicationBuilder.new
|
196
|
+
|
197
|
+
V2 Schema:
|
198
|
+
DVLA::Application::UODLV2ApplicationBuilder.new - Marked as Deprecated in 4.7.3
|
199
|
+
DVLA::Application::TYRV2ApplicationBuilder.new
|
200
|
+
DVLA::Application::COPV2ApplicationBuilder.new
|
201
|
+
DVLA::Application::EXCV2ApplicationBuilder.new
|
202
|
+
DVLA::Application::REPV2ApplicationBuilder.new
|
203
|
+
DVLA::Application::DUPV2ApplicationBuilder.new
|
204
|
+
|
205
|
+
V3 Schema:
|
206
|
+
DVLA::Application::TYRV3ApplicationBuilder.new
|
207
|
+
DVLA::Application::COPV3ApplicationBuilder.new
|
208
|
+
DVLA::Application::EXCV3ApplicationBuilder.new
|
209
|
+
DVLA::Application::REPV3ApplicationBuilder.new
|
210
|
+
DVLA::Application::DUPV3ApplicationBuilder.new
|
211
|
+
```
|
212
|
+
|
213
|
+
**NOTE**
|
214
|
+
All the application builder classes follow the same pattern, they specify the same methods where applicable and then have specific ones for their application schema or type.
|
215
|
+
|
216
|
+
You can then use the `build` method to create a new application.
|
217
|
+
|
218
|
+
As of 4.7.3 the UODL V2 and ApplicationBuilder builders have been marked as deprecated in favour of the transaction specific builders. Please attempt to migrate to specific builders and if any issues occur contact Ben Bonsor or David Sambucci.
|
219
|
+
|
220
|
+
*Examples*
|
221
|
+
```
|
222
|
+
# Will return a UODL V1 application in the default state
|
223
|
+
builder = DVLA::Application::ApplicationBuilder.new
|
224
|
+
builder.build
|
225
|
+
```
|
226
|
+
|
227
|
+
#### Build Options
|
228
|
+
|
229
|
+
As we follow the builder pattern, we have multiple build commands available. It is suggested that these are 'chained' together to create an application e.g. `DVLA::Application::ApplicationBuilder.new.processable.with_change_of_address.build `. You could store the builder in an intermediate state in a variable if you wish as each step will return an instance of builder so far. Only the build method will result in the application being created.
|
230
|
+
|
231
|
+
The options available can be found below:
|
232
|
+
|
233
|
+
##### processable
|
234
|
+
Marks the application as processable, doing this will ensure that real services are used to create the application. More information on this can be found in the [Processable vs non-processable applications section](#processable-vs-non-processable-applications)
|
235
|
+
|
236
|
+
*Examples*
|
237
|
+
|
238
|
+
```
|
239
|
+
DVLA::Application::ApplicationBuilder.new.processable.build
|
240
|
+
```
|
241
|
+
|
242
|
+
##### eligible_paper_to_plastic
|
243
|
+
For a REP or DUP application you can use the `eligible_paper_to_plastic` option to mark the application as eligible for the conversion paper to plastic, this is one of the fields used to mark a driver holding a paper application and is automatically set for an EXC application.
|
244
|
+
|
245
|
+
*Examples*
|
246
|
+
|
247
|
+
```
|
248
|
+
DVLA::Application::DUPApplicationBuilder.new.eligible_paper_to_plastic.build
|
249
|
+
DVLA::Application::REPApplicationBuilder.new.eligible_paper_to_plastic.build
|
250
|
+
```
|
251
|
+
|
252
|
+
##### with_passport_image / with_passport_images
|
253
|
+
For a UODL application you can use the `with_passport_image` option to contain a passport photo of the applicant to be submitted, disabling user photo.
|
254
|
+
For a CODL, EXC or a Paper REP/DUP application the option is `with_passport_images` and will use a passport photo and a passport signature of the applicant, disabling the submission of user images.
|
255
|
+
The application contains a passport image to the applicant to be submitted. Disables user photo.
|
256
|
+
|
257
|
+
*Examples*
|
258
|
+
|
259
|
+
```
|
260
|
+
DVLA::Application::ApplicationBuilder.new.with_passport_image.build
|
261
|
+
|
262
|
+
DVLA::Application::CODLApplicationBuilder.new.with_passport_images.build
|
263
|
+
|
264
|
+
DVLA::Application::REPApplicationBuilder.new.eligible_paper_to_plastic.with_passport_images.build
|
265
|
+
```
|
266
|
+
|
267
|
+
|
268
|
+
##### with_user_image
|
269
|
+
The UODL application will contain a user image. If a boolean value of true is passed in a fallback passport option will also be provided.
|
270
|
+
|
271
|
+
*Examples*
|
272
|
+
|
273
|
+
```
|
274
|
+
DVLA::Application::ApplicationBuilder.new.with_user_image(false).build
|
275
|
+
DVLA::Application::ApplicationBuilder.new.with_user_image(true).build
|
276
|
+
|
277
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.with_user_image(false).build
|
278
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.with_user_image(true).build
|
279
|
+
```
|
280
|
+
|
281
|
+
##### with_review_state / with_photo_review_state / with_signature_review_state
|
282
|
+
For a UODL application there is the `with_review_state` option that will progress the application in the provided review state. In this context we mean that the expected images will contain the correct reviews.
|
283
|
+
|
284
|
+
For a CODL, EXC or a Paper REP/DUP application there are 2 options for this, `with_photo_review_state` and `with_signature_review_state` which control the review state of the 2 type of images of the application.
|
285
|
+
|
286
|
+
How this state is reached will depend on if the application has been marked as processable or not. If the application is non-processable, the application will simply be created in the given state. Otherwise we will use the channel-api to move into this state.
|
287
|
+
|
288
|
+
While calling `with_review_state` or `with_photo_review_state` the input should be a constant from the DVLA::Application::ReviewState class of this repository.
|
289
|
+
When calling `with_signature_review_state` the input will be a constant from the DVLA::Application::SignatureReviewState class.
|
290
|
+
|
291
|
+
*Examples*
|
292
|
+
```
|
293
|
+
DVLA::Application::ApplicationBuilder.new.with_review_state(DVLA::Application::ReviewState::CLERK_REJECTED).build
|
294
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.with_review_state(DVLA::Application::ReviewState::CLERK_REJECTED).build
|
295
|
+
|
296
|
+
DVLA::Application::CODLApplicationBuilder.new.with_photo_review_state(DVLA::Application::ReviewState::CLERK_REJECTED).build
|
297
|
+
DVLA::Application::CODLApplicationBuilder.new.with_signature_review_state(DVLA::Application::SignatureReviewState::CLERK_REJECTED).build
|
298
|
+
|
299
|
+
DVLA::Application::REPApplicationBuilder.new.eligible_paper_to_plastic.with_photo_review_state(DVLA::Application::ReviewState::CLERK_REJECTED).build
|
300
|
+
```
|
301
|
+
|
302
|
+
|
303
|
+
##### with_application_status
|
304
|
+
|
305
|
+
The application will be progressed to contain the given application status.
|
306
|
+
|
307
|
+
How this state is reached will depend on if the application has been marked as processable or not.
|
308
|
+
|
309
|
+
If the application is processable this value is ignored. This is because, when calling real services, the application should naturally reach a desired state.
|
310
|
+
|
311
|
+
If the application is not processable, then this value it used to place the application in the given state. This is achieved by calling the update-application status endpoint of application domain, so actions should be present.
|
312
|
+
|
313
|
+
The input status can currently be any of the following:
|
314
|
+
|
315
|
+
- Preparing
|
316
|
+
- Submitted
|
317
|
+
- Approved
|
318
|
+
- Returned
|
319
|
+
- Unapproved
|
320
|
+
- Rejected
|
321
|
+
- Completed
|
322
|
+
- Deleted
|
323
|
+
- Cancelled
|
324
|
+
|
325
|
+
The update reason is optional and currently only used with Cancelled status. If supplied it can currently be any of the following:
|
326
|
+
|
327
|
+
- Timed out
|
328
|
+
- Fraud outcome with refund
|
329
|
+
- Fraud outcome without refund
|
330
|
+
- Casework outcome
|
331
|
+
- Manual cancel
|
332
|
+
- Returned
|
333
|
+
|
334
|
+
It is worth noting, we currently do not support any status before preparing.
|
335
|
+
Additionally, a 'Cancelled' status will give the update reason of 'Timed Out' unless another is supplied.
|
336
|
+
|
337
|
+
*Examples*
|
338
|
+
```
|
339
|
+
DVLA::Application::ApplicationBuilder.new.with_application_status('Completed', 'Returned').build
|
340
|
+
|
341
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.with_application_status('Completed', 'Returned').build
|
342
|
+
|
343
|
+
DVLA::Application::CODLApplicationBuilder.new.with_application_status('Completed', 'Returned').build
|
344
|
+
```
|
345
|
+
|
346
|
+
|
347
|
+
##### with_change_of_address
|
348
|
+
The UODL application will contain a change of address.
|
349
|
+
|
350
|
+
*Examples*
|
351
|
+
|
352
|
+
```
|
353
|
+
DVLA::Application::ApplicationBuilder.new.with_change_of_address.build
|
354
|
+
|
355
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.with_change_of_address.build
|
356
|
+
```
|
357
|
+
|
358
|
+
|
359
|
+
##### has_phone_number
|
360
|
+
The application will contain a phone number.
|
361
|
+
|
362
|
+
*Examples*
|
363
|
+
|
364
|
+
```
|
365
|
+
DVLA::Application::ApplicationBuilder.new.has_phone_number.build
|
366
|
+
|
367
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.has_phone_number.build
|
368
|
+
|
369
|
+
DVLA::Application::CODLApplicationBuilder.new.has_phone_number.build
|
370
|
+
```
|
371
|
+
|
372
|
+
|
373
|
+
##### is_organ_donor
|
374
|
+
Sets the organ donor status of the application.
|
375
|
+
By default the application will have no organ donation.
|
376
|
+
Passing true will cause all_organs to be selected.
|
377
|
+
Passing false will ensure no organs are selected.
|
378
|
+
|
379
|
+
*Examples*
|
380
|
+
|
381
|
+
```
|
382
|
+
DVLA::Application::ApplicationBuilder.new.is_organ_donor(true).build
|
383
|
+
DVLA::Application::ApplicationBuilder.new.is_organ_donor(false).build
|
384
|
+
|
385
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.is_organ_donor(true).build
|
386
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.is_organ_donor(false).build
|
387
|
+
|
388
|
+
DVLA::Application::CODLApplicationBuilder.new.is_organ_donor(true).build
|
389
|
+
DVLA::Application::CODLApplicationBuilder.new.is_organ_donor(false).build
|
390
|
+
```
|
391
|
+
|
392
|
+
|
393
|
+
##### with_payments
|
394
|
+
The application will contain the provided payment option. This is ignored for processable applications.
|
395
|
+
|
396
|
+
|
397
|
+
##### with_applicant
|
398
|
+
Override the provided applicant in applicant.data with the provided applicant object.
|
399
|
+
|
400
|
+
##### with_customer_id
|
401
|
+
Override the random customer ID with the provided UUID. Useful if you want to tie an application to a specific customer record.
|
402
|
+
|
403
|
+
##### with_driver_id
|
404
|
+
Override the random driver ID with the provided UUID. Useful if you want to tie an application to a specific driver record.
|
405
|
+
This is available just for a UODL application.
|
406
|
+
|
407
|
+
##### with_home_office_comparison_photo
|
408
|
+
Use a comparison photo coming from Home Office instead of Passport.
|
409
|
+
This parameter is available just on a CODL, EXC or a Paper REP/DUP application.
|
410
|
+
|
411
|
+
##### with_unable_to_prove_licence_possession_reason
|
412
|
+
For a UODL-V2 application this sets the reason why the customer was unable to prove the possession of the licence.
|
413
|
+
This field can exist on a UODL-V2 application for any optional transaction, like a REP application.
|
414
|
+
|
415
|
+
##### unique_images
|
416
|
+
Use unique image ids when creating the application, this will ensure that the images are freshly uploaded to image_service and are not shared with other applications.
|
417
|
+
By default the gem will use the same image IDs for all applications when uploading to image-service and utility. This helps to speed up the creation of the applications.
|
418
|
+
This flag is useful when changing / interacting with the images (such as deleting the image).
|
419
|
+
|
420
|
+
*Examples*
|
421
|
+
|
422
|
+
```
|
423
|
+
DVLA::Application::ApplicationBuilder.new.unique_images.build
|
424
|
+
|
425
|
+
DVLA::Application::UODLV2ApplicationBuilder.new.unique_images.build
|
426
|
+
```
|
427
|
+
|
428
|
+
#### CSUDL specific options
|
429
|
+
|
430
|
+
##### with_update_address
|
431
|
+
The CSUDL application will contain a new address to be updated. If an address isn't passed in, it will generate a random address.
|
432
|
+
|
433
|
+
|
434
|
+
*Examples*
|
435
|
+
|
436
|
+
```
|
437
|
+
DVLA::Application::CSUDLApplicationBuilder.new.with_update_address.build
|
438
|
+
```
|
439
|
+
|
440
|
+
##### with_photo_compliance_checks
|
441
|
+
The application wil have Photo Compliance Checks Present
|
442
|
+
|
443
|
+
##### with_investigation_required
|
444
|
+
Flags the application as requiring an investigation by a counter service clerk.
|
445
|
+
|
446
|
+
##### with_no_applicant - **In Development**
|
447
|
+
Driver reminder service may not bew able to find a customer, which could cause this case.
|
448
|
+
|
449
|
+
_NOTE: At the moment, this will not function, as the happy path expects an applicant to be present._
|
450
|
+
|
451
|
+
#### with_reminder_barcode_contents
|
452
|
+
Sets the contents of the scanned bartcode from the reminder letter sent to the applicant.
|
453
|
+
|
454
|
+
#### with_licence_data
|
455
|
+
Sets the data captured from the driver's licence. if licence_data is not provided, it will default to a set of values.
|
456
|
+
|
457
|
+
#### with_counter_service_metadata
|
458
|
+
Override the counter service metadata for the application.
|
459
|
+
|
460
|
+
#### Processable vs non-processable applications
|
461
|
+
|
462
|
+
We have two methods to create an application, these are processable and non-processable.
|
463
|
+
|
464
|
+
This concept covers how we create the application. A non-processable application is very much a test application. It does not interact with the task service to create its state, it is quick and cheap to make, but may not be completely accurate.
|
465
|
+
|
466
|
+
This is most likely to be used in QA testing as this allows a temporary application to be made in the given state quickly.
|
467
|
+
|
468
|
+
A processable application is an application which can be acted on. This is generated by using the channel-api to call task service and process engine to get the application into its current state. This results in an application which is very representative of a real application in this state; however, this is expensive and time consuming to create. These should not be used lightly within QA testing.
|
469
|
+
|
470
|
+
#### The default build state
|
471
|
+
Not providing any options will result in the default state being used.
|
472
|
+
|
473
|
+
The application will:
|
474
|
+
- Be non-processable
|
475
|
+
- Have a user uploaded photo
|
476
|
+
- Have a user uploaded signature if applicable
|
477
|
+
- Have a fallback photo available if applicable
|
478
|
+
- Have the photo in a CLERK_IN_PROGRESS review state
|
479
|
+
- Have the signature in a CLERK_IN_PROGRESS review state if applicable
|
480
|
+
- Have a preparing application status
|
481
|
+
- Don't have any organ selected for dontaion
|
482
|
+
- Not have a phone number
|
483
|
+
- Not have a change of address
|
484
|
+
- Reuse existsing image ids
|
485
|
+
|
486
|
+
### Configuration
|
487
|
+
|
488
|
+
You can use standard YAML config files to configure required environment variables.
|
489
|
+
|
490
|
+
## Development
|
491
|
+
|
492
|
+
After cloning the repo, install the gem's dependencies:
|
493
|
+
|
494
|
+
$ bundle install
|
495
|
+
|
496
|
+
To run tests, execute:
|
497
|
+
|
498
|
+
$ bundle exec rake spec
|
499
|
+
|
500
|
+
To install this gem onto your local machine, execute:
|
501
|
+
|
502
|
+
$ bundle exec rake install
|
503
|
+
|
504
|
+
To interact with the helper and create Applications from the terminal, ensure you are authenticated with the appropriate AWS account, then execute:
|
505
|
+
|
506
|
+
$ bundle exec irb -r dvla/application_helper
|
507
|
+
|
508
|
+
Set an appropriate [environment configuration](#configuration) in irb:
|
509
|
+
|
510
|
+
```ruby
|
511
|
+
DVLA::Application.config { |config| config.environment = 'local-dev' }
|
512
|
+
```
|
513
|
+
|
514
|
+
To release a new version, update the version number in `version.rb`, and perform one of the following tasks:
|
515
|
+
- Run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
516
|
+
- Or alternatively once your changes are merged into main, simply tag the commit with the updated version number.
|
517
|
+
|
518
|
+
## Seed new application
|
519
|
+
|
520
|
+
If you need to seed a new application in the dev or link environment there are some easy to use commands to do so.
|
521
|
+
It's possible to seed a new application either by checking out this repo or by using drone.
|
522
|
+
|
523
|
+
You can decide to seed the data in the `dev` or `link` environment.
|
524
|
+
|
525
|
+
In the `dev` environment you can create any type of application, processable or non-processable and with any build option available.
|
526
|
+
In the `link` environment however it's not possible to create non-processable applications, it's also not possible to use the parameters: `build_with_customer_id`, `build_with_driver_id` and `build_with_applicant`.
|
527
|
+
|
528
|
+
### Seed from local
|
529
|
+
|
530
|
+
To seed an application from the repo you'll need to login in AWS and export the AWS credentials for the correct environment in the terminal.
|
531
|
+
|
532
|
+
After logging in AWS, if you are creating an application in the `link` environment you'll also need to export the `DRIVER_DATA_LOADER_LINK__API_KEY` environment variable. This is needed to create a correct driver record.
|
533
|
+
|
534
|
+
Once all the environment variables are defined, you can create a simple UODL application by running one of the following commands depending the environment you want to use:
|
535
|
+
|
536
|
+
```bash
|
537
|
+
bundle exec rake seed_app:dev
|
538
|
+
bundle exec rake seed_app:link
|
539
|
+
```
|
540
|
+
|
541
|
+
You can also specify additional build options by passing parameters, for example you can create a processable UODL-V2 application with a change of address and an image rejected by a supervisor:
|
542
|
+
|
543
|
+
```bash
|
544
|
+
bundle exec rake seed_app:dev build_type=uodl-v2 build_processable= build_with_change_of_address= build_with_review_state=:supervisor_rejected
|
545
|
+
|
546
|
+
bundle exec rake seed_app:link build_type=uodl-v2 build_processable= build_with_change_of_address= build_with_review_state=:supervisor_rejected
|
547
|
+
```
|
548
|
+
|
549
|
+
All the parameters are explained in the section below.
|
550
|
+
|
551
|
+
### Seed from Drone
|
552
|
+
|
553
|
+
To seed a new application using Drone, you'll need first to find the latest build for the main branch and then promote it.
|
554
|
+
When promoting the build you'll need to set the **Target** value to `seed`.
|
555
|
+
|
556
|
+
This will start a new execution in the pipeline, and in the last step "seed application" a new customer and a new application will be created. By default this will point to the `dev` environment and create a normal non-processable UODL application.
|
557
|
+
|
558
|
+
You can personalise the application by setting different **Parameters**.
|
559
|
+
To do that you'll need to type the key and the value of the parameter and then click on the **+Add** button. If the **+Add** button is not clicked the parameter will not be used.
|
560
|
+
|
561
|
+
In the **Parameters** you can specify the environment where to create the application and any build options.
|
562
|
+
|
563
|
+
For example to create a processable UODL-V2 application in the link environment you'll need to set the following parameters:
|
564
|
+
* **ENVIRONMENT**: `drone-link`
|
565
|
+
* **build_type**: `uodl-v2`
|
566
|
+
* **build_processable**: `-`
|
567
|
+
|
568
|
+
### Parameters and Build options
|
569
|
+
|
570
|
+
There are many parameters that can be passed, and they depend on what application type you are creating.
|
571
|
+
|
572
|
+
#### Environment
|
573
|
+
|
574
|
+
The `ENVIRONMENT` parameter is used in drone to specify where the application will be seeded.
|
575
|
+
The possible values for this parameter are:
|
576
|
+
* `drone-dev` - this is also the default value
|
577
|
+
* `drone-link`
|
578
|
+
|
579
|
+
This parameter is set automatically when creating an application locally.
|
580
|
+
|
581
|
+
#### Build type
|
582
|
+
|
583
|
+
To specify the type of the application to create you can set the `build_type` parameter.
|
584
|
+
The possible values are:
|
585
|
+
* `uodl` - This will create a UODL application. This is also the default option.
|
586
|
+
* `uodl-v2` - This will create a UODL-V2 application.
|
587
|
+
* `cop` - This will create a UODL-V2 COP application.
|
588
|
+
* `rep` - This will create a UODL-V2 REP application.
|
589
|
+
* `dup` - This will create a UODL-V2 DUP application.
|
590
|
+
* `exc` - This will create a UODL-V2 EXC application.
|
591
|
+
* `codl` - This will create a CODL application.
|
592
|
+
* `csudl` - This will create a CSUDL application.
|
593
|
+
|
594
|
+
#### Dynamic build options
|
595
|
+
|
596
|
+
Using the parameters is also possible to specify any existing build option available on the builder classes.
|
597
|
+
All you need to do is to prefix the build option with the `build_` prefix.
|
598
|
+
|
599
|
+
For example to set the `has_phone_number` build option, and create the application's customer with a phone number, we can pass the `build_has_phone_number` parameter with an empty value.
|
600
|
+
|
601
|
+
##### No data
|
602
|
+
|
603
|
+
Any build option that doesn't require additional data can be specified by setting the parameter with an empty value (`build_processable=`) or with a dash (`build_processable=-`)
|
604
|
+
|
605
|
+
##### Null
|
606
|
+
|
607
|
+
To set a build option with the value of `nil`, you can set the value in the command to `null`
|
608
|
+
e.g `build_with_customer_id=null`
|
609
|
+
|
610
|
+
##### Boolean
|
611
|
+
|
612
|
+
To set build options that require a boolean flag, we can set the values `true` or `false` to the parameter.
|
613
|
+
e.g. `build_is_organ_donor=true`
|
614
|
+
|
615
|
+
##### String data
|
616
|
+
|
617
|
+
The build options that require a string can be specified just by setting the value directly to the parameter.
|
618
|
+
e.g. `build_with_customer_id=62814c62-8170-46f2-9ec1-093b3df5d42f`
|
619
|
+
|
620
|
+
##### Symbols
|
621
|
+
|
622
|
+
Some build options require to set ruby symbols, you can do this by using the normal ruby syntax using the `:` char.
|
623
|
+
e.g. `build_with_review_state=:supervisor_approved`
|
624
|
+
|
625
|
+
##### Objects or Arrays
|
626
|
+
|
627
|
+
Any other type of data required by build options can be passed by setting the parameter to a valid json string.
|
628
|
+
e.g. `build_with_payments=[{"paymentId":"7117422","paymentStatus":"SETTLEMENT_REQUESTED","timeInitiated":"2024-08-13T07:45:34.343Z","redirectType":"IFRAME","paymentAmount":"14.00","paymentReference":"pay-ref-7117422"}]`
|
629
|
+
|
630
|
+
If working in the terminal some of these characters might need to be escaped or enclosed in double quotes.
|
631
|
+
|
632
|
+
#### Examples
|
633
|
+
|
634
|
+
Seed a processable UODL V2 application in DEV with a change of address and the review state of SUPERVISOR_REJECTED
|
635
|
+
|
636
|
+
```bash
|
637
|
+
bundle exec rake seed_app:dev build_type=uodl-v2 build_processable= build_with_change_of_address= build_with_review_state=:supervisor_rejected
|
638
|
+
```
|
639
|
+
|
640
|
+
Seed a DUP application in LINK that is eligible to go from a paper to plastic licence
|
641
|
+
|
642
|
+
```bash
|
643
|
+
bundle exec rake seed_app:link build_type=dup-v3 build_processable= build_eligible_paper_to_plastic=
|
644
|
+
```
|
645
|
+
|
646
|
+
Seed a REP application in LINK that is eligible to go from a paper to plastic licence
|
647
|
+
|
648
|
+
```bash
|
649
|
+
bundle exec rake seed_app:link build_type=rep-v3 build_processable= build_eligible_paper_to_plastic=
|
650
|
+
```
|
651
|
+
|
652
|
+
Seed a EXC application in LINK that is eligible to go from a paper to plastic licence
|
653
|
+
|
654
|
+
```bash
|
655
|
+
bundle exec rake seed_app:link build_type=exc-v3 build_processable=
|
656
|
+
```
|
657
|
+
|
658
|
+
Send a CSUDL application in DEV with CSUDL specific fields
|
659
|
+
|
660
|
+
```bash
|
661
|
+
bundle exec rake seed_app:dev build_type=csudl build_with_unable_to_prove_licence_possession_reason=LOST_OR_STOLEN build_with_investigation_required= build_with_reminder_barcode_contents='9826943224281001848986045116301GAIR GERARD SWAN 34 SAXON CLOSE SA1 1SD' build_with_licence_data= build_with_photo_compliance_checks='{"photoOverride":true,"icaoCompliant":true,"eyesOpen":true,"exposure":true,"frontalView":true,"greyscaleDensity":true,"uniformLighting":true,"headWidth":true,"headLength":true,"widthHeightRatio":true,"resolution":true,"verticalPosition":true,"horizontallyCentered":true}' build_is_organ_donor=true build_with_update_address=
|
662
|
+
```
|
663
|
+
|
664
|
+
## Contributing
|
665
|
+
|
666
|
+
|
667
|
+
## Known Issues/Future improvements
|
668
|
+
- Currently we are unable to call image utility using the link development role. Due to this we are unable to use this gem in the link environment from a local machine.
|
669
|
+
|
670
|
+
- To create an external task, it is suggested that we create a processable task that is either rejected for comparison at the clerk or supervisor level.
|
671
|
+
|
672
|
+
- A non processable task will be in the 'Cancelled' state and will include a updateReason of 'Timed out'.
|
673
|
+
|
674
|
+
- The user submitting tasks is currently a fixed value. These will always claim to be carried out by `tom.collins@dvla.gov.uk`.
|