defra_ruby_mocks 2.3.2 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -75
- data/app/controllers/defra_ruby_mocks/govpay_controller.rb +28 -3
- data/app/jobs/defra_ruby_mocks/application_job.rb +6 -0
- data/app/jobs/defra_ruby_mocks/govpay_payment_callback_job.rb +17 -0
- data/app/services/defra_ruby_mocks/govpay_create_payment_service.rb +41 -13
- data/app/services/defra_ruby_mocks/govpay_get_payment_service.rb +74 -16
- data/app/services/defra_ruby_mocks/govpay_refund_details_service.rb +43 -0
- data/app/services/defra_ruby_mocks/govpay_request_refund_service.rb +27 -0
- data/config/routes.rb +10 -10
- data/lib/defra_ruby_mocks/configuration.rb +1 -1
- data/lib/defra_ruby_mocks/engine.rb +0 -1
- data/lib/defra_ruby_mocks/version.rb +1 -1
- data/spec/dummy/log/test.log +1279 -972
- data/spec/examples.txt +68 -121
- data/spec/fixtures/files/govpay/create_payment_created_response.json +24 -0
- data/spec/fixtures/files/govpay/create_payment_error_response.json +5 -0
- data/spec/fixtures/files/govpay/get_payment_response_cancelled.json +61 -0
- data/spec/fixtures/files/govpay/get_payment_response_created.json +73 -0
- data/spec/fixtures/files/govpay/get_payment_response_error.json +5 -0
- data/spec/fixtures/files/govpay/get_payment_response_failure.json +9 -0
- data/spec/fixtures/files/govpay/get_payment_response_not_found.json +4 -0
- data/spec/fixtures/files/govpay/get_payment_response_submitted.json +75 -0
- data/spec/fixtures/files/govpay/get_payment_response_success.json +62 -0
- data/spec/requests/govpay_spec.rb +64 -1
- data/spec/services/govpay_create_payment_service_spec.rb +44 -0
- data/spec/services/govpay_get_payment_service_spec.rb +30 -0
- data/spec/services/govpay_refund_details_service_spec.rb +58 -0
- data/spec/services/govpay_request_refund_service_spec.rb +31 -0
- metadata +32 -48
- data/app/controllers/defra_ruby_mocks/worldpay_controller.rb +0 -57
- data/app/services/defra_ruby_mocks/worldpay_payment_service.rb +0 -47
- data/app/services/defra_ruby_mocks/worldpay_refund_service.rb +0 -37
- data/app/services/defra_ruby_mocks/worldpay_request_handler_service.rb +0 -40
- data/app/services/defra_ruby_mocks/worldpay_resource_service.rb +0 -55
- data/app/services/defra_ruby_mocks/worldpay_response_service.rb +0 -119
- data/app/views/defra_ruby_mocks/worldpay/payment_request.xml.erb +0 -4
- data/app/views/defra_ruby_mocks/worldpay/refund_request.xml.erb +0 -4
- data/app/views/defra_ruby_mocks/worldpay/stuck.html.erb +0 -37
- data/lib/defra_ruby_mocks/unrecognised_worldpay_request_error.rb +0 -5
- data/spec/fixtures/payment_request_invalid.xml +0 -6
- data/spec/fixtures/payment_request_valid.xml +0 -30
- data/spec/fixtures/refund_request_invalid.xml +0 -6
- data/spec/fixtures/refund_request_valid.xml +0 -11
- data/spec/fixtures/unrecognised_request.xml +0 -6
- data/spec/requests/worldpay_spec.rb +0 -163
- data/spec/services/worldpay_payment_service_spec.rb +0 -95
- data/spec/services/worldpay_refund_service_spec.rb +0 -68
- data/spec/services/worldpay_request_handler_service_spec.rb +0 -79
- data/spec/services/worldpay_resource_service_spec.rb +0 -120
- data/spec/services/worldpay_response_service_spec.rb +0 -280
data/spec/examples.txt
CHANGED
@@ -1,121 +1,68 @@
|
|
1
|
-
example_id
|
2
|
-
|
3
|
-
./spec/defra_ruby_mocks_spec.rb[1:1:1]
|
4
|
-
./spec/defra_ruby_mocks_spec.rb[1:2:1:1]
|
5
|
-
./spec/defra_ruby_mocks_spec.rb[1:2:2:1]
|
6
|
-
./spec/lib/configuration_spec.rb[1:1:1:1]
|
7
|
-
./spec/lib/configuration_spec.rb[1:1:2:1]
|
8
|
-
./spec/lib/configuration_spec.rb[1:1:3:1]
|
9
|
-
./spec/lib/configuration_spec.rb[1:1:4:1]
|
10
|
-
./spec/lib/configuration_spec.rb[1:2:1:1]
|
11
|
-
./spec/lib/configuration_spec.rb[1:2:2:1]
|
12
|
-
./spec/lib/configuration_spec.rb[1:2:3:1]
|
13
|
-
./spec/lib/configuration_spec.rb[1:2:4:1]
|
14
|
-
./spec/requests/company_spec.rb[1:1:1:1]
|
15
|
-
./spec/requests/company_spec.rb[1:1:2:1]
|
16
|
-
./spec/requests/company_spec.rb[1:1:3:1:1]
|
17
|
-
./spec/requests/company_spec.rb[1:1:3:2:1]
|
18
|
-
./spec/requests/company_spec.rb[1:2:1]
|
19
|
-
./spec/requests/govpay_spec.rb[1:1:1:1:1]
|
20
|
-
./spec/requests/govpay_spec.rb[1:1:1:2
|
21
|
-
./spec/requests/govpay_spec.rb[1:1:2:1
|
22
|
-
./spec/requests/govpay_spec.rb[1:1:2:
|
23
|
-
./spec/requests/govpay_spec.rb[1:2:
|
24
|
-
./spec/requests/govpay_spec.rb[1:
|
25
|
-
./spec/requests/govpay_spec.rb[1:
|
26
|
-
./spec/requests/
|
27
|
-
./spec/requests/
|
28
|
-
./spec/requests/
|
29
|
-
./spec/requests/
|
30
|
-
./spec/requests/
|
31
|
-
./spec/requests/
|
32
|
-
./spec/
|
33
|
-
./spec/
|
34
|
-
./spec/
|
35
|
-
./spec/
|
36
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
37
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
38
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
39
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
40
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
41
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
42
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
43
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
44
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
45
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
46
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
47
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
48
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
49
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
50
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
51
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
52
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
53
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
54
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
55
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
56
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
57
|
-
./spec/services/
|
58
|
-
./spec/services/
|
59
|
-
./spec/services/
|
60
|
-
./spec/services/
|
61
|
-
./spec/services/
|
62
|
-
./spec/services/
|
63
|
-
./spec/services/
|
64
|
-
./spec/services/
|
65
|
-
./spec/services/
|
66
|
-
./spec/services/
|
67
|
-
./spec/services/
|
68
|
-
./spec/services/
|
69
|
-
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:6:1] | passed | 0.00033 seconds |
|
70
|
-
./spec/services/worldpay_payment_service_spec.rb[1:1:3:1] | passed | 0.00032 seconds |
|
71
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:1] | passed | 0.00121 seconds |
|
72
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:2] | passed | 0.0003 seconds |
|
73
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:3] | passed | 0.00126 seconds |
|
74
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:4] | passed | 0.00045 seconds |
|
75
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:5] | passed | 0.00039 seconds |
|
76
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:6] | passed | 0.00038 seconds |
|
77
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:7] | passed | 0.00031 seconds |
|
78
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:2:1] | passed | 0.11633 seconds |
|
79
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:1:1] | passed | 0.00098 seconds |
|
80
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:1:2] | passed | 0.00079 seconds |
|
81
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:2:1] | passed | 0.00057 seconds |
|
82
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:2:2] | passed | 0.00049 seconds |
|
83
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:3:1] | passed | 0.00051 seconds |
|
84
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:1:1] | passed | 0.00069 seconds |
|
85
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:1:2] | passed | 0.00065 seconds |
|
86
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:1:3] | passed | 0.00046 seconds |
|
87
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:1:4] | passed | 0.00047 seconds |
|
88
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:2:1] | passed | 0.00063 seconds |
|
89
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:2:2] | passed | 0.00055 seconds |
|
90
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:2:3] | passed | 0.00054 seconds |
|
91
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:2:4] | passed | 0.00051 seconds |
|
92
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:3:1] | passed | 0.00176 seconds |
|
93
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:4:1] | passed | 0.00921 seconds |
|
94
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:1] | passed | 0.00048 seconds |
|
95
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:2] | passed | 0.00064 seconds |
|
96
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:3:1] | passed | 0.00046 seconds |
|
97
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:3:2] | passed | 0.00047 seconds |
|
98
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:4:1] | passed | 0.00044 seconds |
|
99
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:4:2] | passed | 0.0005 seconds |
|
100
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:5:1] | passed | 0.00047 seconds |
|
101
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:5:2] | passed | 0.00041 seconds |
|
102
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:6:1] | passed | 0.00044 seconds |
|
103
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:6:2] | passed | 0.00047 seconds |
|
104
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:7:1] | passed | 0.00046 seconds |
|
105
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:7:2] | passed | 0.00047 seconds |
|
106
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:8:1] | passed | 0.00046 seconds |
|
107
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:8:2] | passed | 0.00048 seconds |
|
108
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:1] | passed | 0.00048 seconds |
|
109
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:2] | passed | 0.00048 seconds |
|
110
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:3:1] | passed | 0.00047 seconds |
|
111
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:3:2] | passed | 0.00048 seconds |
|
112
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:4:1] | passed | 0.00047 seconds |
|
113
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:4:2] | passed | 0.00045 seconds |
|
114
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:5:1] | passed | 0.00048 seconds |
|
115
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:5:2] | passed | 0.00042 seconds |
|
116
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:6:1] | passed | 0.00045 seconds |
|
117
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:6:2] | passed | 0.00045 seconds |
|
118
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:7:1] | passed | 0.00044 seconds |
|
119
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:7:2] | passed | 0.00047 seconds |
|
120
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:8:1] | passed | 0.00049 seconds |
|
121
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:8:2] | passed | 0.00048 seconds |
|
1
|
+
example_id | status | run_time |
|
2
|
+
---------------------------------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/defra_ruby_mocks_spec.rb[1:1:1] | passed | 0.00285 seconds |
|
4
|
+
./spec/defra_ruby_mocks_spec.rb[1:2:1:1] | passed | 0.00139 seconds |
|
5
|
+
./spec/defra_ruby_mocks_spec.rb[1:2:2:1] | passed | 0.00014 seconds |
|
6
|
+
./spec/lib/configuration_spec.rb[1:1:1:1] | passed | 0.0001 seconds |
|
7
|
+
./spec/lib/configuration_spec.rb[1:1:2:1] | passed | 0.00011 seconds |
|
8
|
+
./spec/lib/configuration_spec.rb[1:1:3:1] | passed | 0.00542 seconds |
|
9
|
+
./spec/lib/configuration_spec.rb[1:1:4:1] | passed | 0.0001 seconds |
|
10
|
+
./spec/lib/configuration_spec.rb[1:2:1:1] | passed | 0.00013 seconds |
|
11
|
+
./spec/lib/configuration_spec.rb[1:2:2:1] | passed | 0.0001 seconds |
|
12
|
+
./spec/lib/configuration_spec.rb[1:2:3:1] | passed | 0.0001 seconds |
|
13
|
+
./spec/lib/configuration_spec.rb[1:2:4:1] | passed | 0.0001 seconds |
|
14
|
+
./spec/requests/company_spec.rb[1:1:1:1] | passed | 0.03183 seconds |
|
15
|
+
./spec/requests/company_spec.rb[1:1:2:1] | passed | 0.00373 seconds |
|
16
|
+
./spec/requests/company_spec.rb[1:1:3:1:1] | passed | 0.00642 seconds |
|
17
|
+
./spec/requests/company_spec.rb[1:1:3:2:1] | passed | 0.00371 seconds |
|
18
|
+
./spec/requests/company_spec.rb[1:2:1] | passed | 0.1818 seconds |
|
19
|
+
./spec/requests/govpay_spec.rb[1:1:1:1:1] | passed | 0.00531 seconds |
|
20
|
+
./spec/requests/govpay_spec.rb[1:1:1:1:2] | passed | 0.0086 seconds |
|
21
|
+
./spec/requests/govpay_spec.rb[1:1:1:2:1] | passed | 0.00328 seconds |
|
22
|
+
./spec/requests/govpay_spec.rb[1:1:2:1:1] | passed | 0.00809 seconds |
|
23
|
+
./spec/requests/govpay_spec.rb[1:1:2:2:1] | passed | 0.00472 seconds |
|
24
|
+
./spec/requests/govpay_spec.rb[1:1:3:1:1] | passed | 0.00308 seconds |
|
25
|
+
./spec/requests/govpay_spec.rb[1:1:3:2:1] | passed | 0.00362 seconds |
|
26
|
+
./spec/requests/govpay_spec.rb[1:1:4:1:1] | passed | 0.00454 seconds |
|
27
|
+
./spec/requests/govpay_spec.rb[1:2:1:1] | passed | 0.00158 seconds |
|
28
|
+
./spec/requests/govpay_spec.rb[1:2:2:1] | passed | 0.00622 seconds |
|
29
|
+
./spec/requests/govpay_spec.rb[1:2:3:1] | passed | 0.01293 seconds |
|
30
|
+
./spec/requests/officers_spec.rb[1:1:1] | passed | 0.00639 seconds |
|
31
|
+
./spec/requests/officers_spec.rb[1:2:1] | passed | 0.00178 seconds |
|
32
|
+
./spec/services/companies_house_service_spec.rb[1:1:1:1] | passed | 0.00012 seconds |
|
33
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:1:1] | passed | 0.0001 seconds |
|
34
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:1:2] | passed | 0.00013 seconds |
|
35
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:2:1] | passed | 0.00011 seconds |
|
36
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:2:2] | passed | 0.0001 seconds |
|
37
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:3:1] | passed | 0.0001 seconds |
|
38
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:3:2] | passed | 0.00014 seconds |
|
39
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:4:1] | passed | 0.00011 seconds |
|
40
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:4:2] | passed | 0.00012 seconds |
|
41
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:5:1] | passed | 0.00012 seconds |
|
42
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:5:2] | passed | 0.00015 seconds |
|
43
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:6:1] | passed | 0.00012 seconds |
|
44
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:6:2] | passed | 0.00011 seconds |
|
45
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:7:1] | passed | 0.00011 seconds |
|
46
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:7:2] | passed | 0.00013 seconds |
|
47
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:8:1] | passed | 0.00012 seconds |
|
48
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:8:2] | passed | 0.00013 seconds |
|
49
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:9:1] | passed | 0.00011 seconds |
|
50
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:9:2] | passed | 0.00015 seconds |
|
51
|
+
./spec/services/companies_house_service_spec.rb[1:1:3:1] | passed | 0.00009 seconds |
|
52
|
+
./spec/services/companies_house_service_spec.rb[1:1:3:2] | passed | 0.00016 seconds |
|
53
|
+
./spec/services/companies_house_service_spec.rb[1:1:3:3] | passed | 0.0001 seconds |
|
54
|
+
./spec/services/companies_house_service_spec.rb[1:1:3:4] | passed | 0.00011 seconds |
|
55
|
+
./spec/services/companies_house_service_spec.rb[1:1:4:1:1] | passed | 0.00017 seconds |
|
56
|
+
./spec/services/companies_house_service_spec.rb[1:1:4:2:1] | passed | 0.00016 seconds |
|
57
|
+
./spec/services/govpay_create_payment_service_spec.rb[1:1:1:1] | passed | 0.00452 seconds |
|
58
|
+
./spec/services/govpay_create_payment_service_spec.rb[1:1:1:2] | passed | 0.00528 seconds |
|
59
|
+
./spec/services/govpay_create_payment_service_spec.rb[1:1:1:3] | passed | 0.00464 seconds |
|
60
|
+
./spec/services/govpay_create_payment_service_spec.rb[1:1:1:4] | passed | 2.48 seconds |
|
61
|
+
./spec/services/govpay_get_payment_service_spec.rb[1:1:1:1] | passed | 0.00168 seconds |
|
62
|
+
./spec/services/govpay_get_payment_service_spec.rb[1:1:1:2] | passed | 0.00151 seconds |
|
63
|
+
./spec/services/govpay_refund_details_service_spec.rb[1:1:1:1] | passed | 0.03042 seconds |
|
64
|
+
./spec/services/govpay_refund_details_service_spec.rb[1:1:2:1:1] | passed | 0.00249 seconds |
|
65
|
+
./spec/services/govpay_refund_details_service_spec.rb[1:1:2:2:1] | passed | 0.00236 seconds |
|
66
|
+
./spec/services/govpay_refund_details_service_spec.rb[1:1:2:3:1] | passed | 0.0041 seconds |
|
67
|
+
./spec/services/govpay_request_refund_service_spec.rb[1:1:1:1] | passed | 0.00074 seconds |
|
68
|
+
./spec/services/govpay_request_refund_service_spec.rb[1:1:1:2] | passed | 0.0006 seconds |
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"created_date": "2020-03-03T16:17:19.554Z",
|
3
|
+
"state": {
|
4
|
+
"status": "created",
|
5
|
+
"finished": false
|
6
|
+
},
|
7
|
+
"_links": {
|
8
|
+
"self": {
|
9
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/hu20sqlact5260q2nanm0q8u93",
|
10
|
+
"method": "GET"
|
11
|
+
},
|
12
|
+
"next_url": {
|
13
|
+
"href": "https://www.payments.service.gov.uk/secure/bb0a272c-8eaf-468d-b3xf-ae5e000d2231",
|
14
|
+
"method": "GET"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"amount": 14500,
|
18
|
+
"reference" : "12345",
|
19
|
+
"description": "Pay your council tax",
|
20
|
+
"return_url": "https://your.service.gov.uk/completed",
|
21
|
+
"payment_id": "hu20sqlact5260q2nanm0q8u93",
|
22
|
+
"payment_provider": "worldpay",
|
23
|
+
"provider_id": "10987654321"
|
24
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
{
|
2
|
+
"amount": 10501,
|
3
|
+
"description": "Waste carrier registration upper tier",
|
4
|
+
"reference": "12345",
|
5
|
+
"language": "en",
|
6
|
+
"metadata": {
|
7
|
+
"ledger_code": "AB100",
|
8
|
+
"an_internal_reference_number": 200
|
9
|
+
},
|
10
|
+
"email": "sherlock.holmes@example.com",
|
11
|
+
"state": {
|
12
|
+
"status": "failed",
|
13
|
+
"finished": true,
|
14
|
+
"message": "Payment was cancelled by the user",
|
15
|
+
"code": "P0030"
|
16
|
+
},
|
17
|
+
"payment_id": "cjgt8i57kavb8jfufhjlh129fm",
|
18
|
+
"payment_provider": "sandbox",
|
19
|
+
"created_date": "2022-05-18T11:46:54.697Z",
|
20
|
+
"refund_summary": {
|
21
|
+
"status": "unavailable",
|
22
|
+
"amount_available": 10501,
|
23
|
+
"amount_submitted": 0
|
24
|
+
},
|
25
|
+
"settlement_summary": {},
|
26
|
+
"card_details": {
|
27
|
+
"last_digits_card_number": "5100",
|
28
|
+
"first_digits_card_number": "510510",
|
29
|
+
"cardholder_name": "Sherlock Holmes",
|
30
|
+
"expiry_date": "01/24",
|
31
|
+
"billing_address": {
|
32
|
+
"line1": "221 Baker Street",
|
33
|
+
"line2": "Flat b",
|
34
|
+
"postcode": "NW1 6XE",
|
35
|
+
"city": "London",
|
36
|
+
"country": "GB"
|
37
|
+
},
|
38
|
+
"card_brand": "Mastercard",
|
39
|
+
"card_type": "debit"
|
40
|
+
},
|
41
|
+
"delayed_capture": false,
|
42
|
+
"moto": false,
|
43
|
+
"provider_id": "9fda0405-dc56-4d18-bf53-26167a91a1ac",
|
44
|
+
"return_url": "https://some-wcr-env.defra.gov.uk/completed",
|
45
|
+
"authorisation_mode": "web",
|
46
|
+
"card_brand": "Mastercard",
|
47
|
+
"_links": {
|
48
|
+
"self": {
|
49
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm",
|
50
|
+
"method": "GET"
|
51
|
+
},
|
52
|
+
"events": {
|
53
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm/events",
|
54
|
+
"method": "GET"
|
55
|
+
},
|
56
|
+
"refunds": {
|
57
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm/refunds",
|
58
|
+
"method": "GET"
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
{
|
2
|
+
"amount": 10501,
|
3
|
+
"description": "Waste carrier registration upper tier",
|
4
|
+
"reference": "12345",
|
5
|
+
"language": "en",
|
6
|
+
"metadata": {
|
7
|
+
"ledger_code": "AB100",
|
8
|
+
"an_internal_reference_number": 200
|
9
|
+
},
|
10
|
+
"email": "sherlock.holmes@example.com",
|
11
|
+
"state": {
|
12
|
+
"status": "created",
|
13
|
+
"finished": false
|
14
|
+
},
|
15
|
+
"payment_id": "cjgt8i57kavb8jfufhjlh129fm",
|
16
|
+
"payment_provider": "sandbox",
|
17
|
+
"created_date": "2022-05-18T11:46:54.697Z",
|
18
|
+
"refund_summary": {
|
19
|
+
"status": "pending",
|
20
|
+
"amount_available": 10501,
|
21
|
+
"amount_submitted": 0
|
22
|
+
},
|
23
|
+
"settlement_summary": {},
|
24
|
+
"card_details": {
|
25
|
+
"last_digits_card_number": null,
|
26
|
+
"first_digits_card_number": null,
|
27
|
+
"cardholder_name": "Sherlock Holmes",
|
28
|
+
"expiry_date": null,
|
29
|
+
"billing_address": {
|
30
|
+
"line1": "221 Baker Street",
|
31
|
+
"line2": "Flat b",
|
32
|
+
"postcode": "NW1 6XE",
|
33
|
+
"city": "London",
|
34
|
+
"country": "GB"
|
35
|
+
},
|
36
|
+
"card_brand": "",
|
37
|
+
"card_type": null
|
38
|
+
},
|
39
|
+
"delayed_capture": false,
|
40
|
+
"moto": false,
|
41
|
+
"return_url": "https://some-wcr-env.defra.gov.uk/completed",
|
42
|
+
"authorisation_mode": "web",
|
43
|
+
"_links": {
|
44
|
+
"self": {
|
45
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm",
|
46
|
+
"method": "GET"
|
47
|
+
},
|
48
|
+
"next_url": {
|
49
|
+
"href": "https://www.payments.service.gov.uk/secure/c3b8908b-68df-478a-ad94-6a724e614e46",
|
50
|
+
"method": "GET"
|
51
|
+
},
|
52
|
+
"next_url_post": {
|
53
|
+
"type": "application/x-www-form-urlencoded",
|
54
|
+
"params": {
|
55
|
+
"chargeTokenId": "c3b8908b-68df-478a-ad94-6a724e614e46"
|
56
|
+
},
|
57
|
+
"href": "https://www.payments.service.gov.uk/secure",
|
58
|
+
"method": "POST"
|
59
|
+
},
|
60
|
+
"events": {
|
61
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm/events",
|
62
|
+
"method": "GET"
|
63
|
+
},
|
64
|
+
"refunds": {
|
65
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm/refunds",
|
66
|
+
"method": "GET"
|
67
|
+
},
|
68
|
+
"cancel": {
|
69
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm/cancel",
|
70
|
+
"method": "POST"
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
{
|
2
|
+
"amount": 10501,
|
3
|
+
"description": "Waste carrier registration upper tier",
|
4
|
+
"reference": "12345",
|
5
|
+
"language": "en",
|
6
|
+
"metadata": {
|
7
|
+
"ledger_code": "AB100",
|
8
|
+
"an_internal_reference_number": 200
|
9
|
+
},
|
10
|
+
"email": "sherlock.holmes@example.com",
|
11
|
+
"state": {
|
12
|
+
"status": "submitted",
|
13
|
+
"finished": false
|
14
|
+
},
|
15
|
+
"payment_id": "cjgt8i57kavb8jfufhjlh129fm",
|
16
|
+
"payment_provider": "sandbox",
|
17
|
+
"created_date": "2022-05-18T11:46:54.697Z",
|
18
|
+
"refund_summary": {
|
19
|
+
"status": "pending",
|
20
|
+
"amount_available": 10501,
|
21
|
+
"amount_submitted": 0
|
22
|
+
},
|
23
|
+
"settlement_summary": {},
|
24
|
+
"card_details": {
|
25
|
+
"last_digits_card_number": "5100",
|
26
|
+
"first_digits_card_number": "510510",
|
27
|
+
"cardholder_name": "Sherlock Holmes",
|
28
|
+
"expiry_date": "01/24",
|
29
|
+
"billing_address": {
|
30
|
+
"line1": "221 Baker Street",
|
31
|
+
"line2": "Flat b",
|
32
|
+
"postcode": "NW1 6XE",
|
33
|
+
"city": "London",
|
34
|
+
"country": "GB"
|
35
|
+
},
|
36
|
+
"card_brand": "Mastercard",
|
37
|
+
"card_type": "debit"
|
38
|
+
},
|
39
|
+
"delayed_capture": false,
|
40
|
+
"moto": false,
|
41
|
+
"provider_id": "9fda0405-dc56-4d18-bf53-26167a91a1ac",
|
42
|
+
"return_url": "https://some-wcr-env.defra.gov.uk/completed",
|
43
|
+
"authorisation_mode": "web",
|
44
|
+
"card_brand": "Mastercard",
|
45
|
+
"_links": {
|
46
|
+
"self": {
|
47
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm",
|
48
|
+
"method": "GET"
|
49
|
+
},
|
50
|
+
"next_url": {
|
51
|
+
"href": "https://www.payments.service.gov.uk/secure/18a144e1-f6d8-4d73-a11a-a45187da9138",
|
52
|
+
"method": "GET"
|
53
|
+
},
|
54
|
+
"next_url_post": {
|
55
|
+
"type": "application/x-www-form-urlencoded",
|
56
|
+
"params": {
|
57
|
+
"chargeTokenId": "18a144e1-f6d8-4d73-a11a-a45187da9138"
|
58
|
+
},
|
59
|
+
"href": "https://www.payments.service.gov.uk/secure",
|
60
|
+
"method": "POST"
|
61
|
+
},
|
62
|
+
"events": {
|
63
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm/events",
|
64
|
+
"method": "GET"
|
65
|
+
},
|
66
|
+
"refunds": {
|
67
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm/refunds",
|
68
|
+
"method": "GET"
|
69
|
+
},
|
70
|
+
"cancel": {
|
71
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cjgt8i57kavb8jfufhjlh129fm/cancel",
|
72
|
+
"method": "POST"
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
{
|
2
|
+
"amount": 10501,
|
3
|
+
"description": "Waste carrier registration upper tier",
|
4
|
+
"reference": "12345",
|
5
|
+
"language": "en",
|
6
|
+
"metadata": {
|
7
|
+
"ledger_code": "AB100",
|
8
|
+
"an_internal_reference_number": 200
|
9
|
+
},
|
10
|
+
"email": "sherlock.holmes@example.com",
|
11
|
+
"state": {
|
12
|
+
"status": "success",
|
13
|
+
"finished": true
|
14
|
+
},
|
15
|
+
"payment_id": "cnnffa1e6s3u9a6n24u2cp527d",
|
16
|
+
"payment_provider": "sandbox",
|
17
|
+
"created_date": "2022-05-18T11:52:13.669Z",
|
18
|
+
"refund_summary": {
|
19
|
+
"status": "available",
|
20
|
+
"amount_available": 10501,
|
21
|
+
"amount_submitted": 0
|
22
|
+
},
|
23
|
+
"settlement_summary": {
|
24
|
+
"capture_submit_time": "2022-05-18T11:52:39.172Z",
|
25
|
+
"captured_date": "2022-05-18"
|
26
|
+
},
|
27
|
+
"card_details": {
|
28
|
+
"last_digits_card_number": "5100",
|
29
|
+
"first_digits_card_number": "510510",
|
30
|
+
"cardholder_name": "Sherlock Holmes",
|
31
|
+
"expiry_date": "01/24",
|
32
|
+
"billing_address": {
|
33
|
+
"line1": "221 Baker Street",
|
34
|
+
"line2": "Flat b",
|
35
|
+
"postcode": "NW1 6XE",
|
36
|
+
"city": "London",
|
37
|
+
"country": "GB"
|
38
|
+
},
|
39
|
+
"card_brand": "Mastercard",
|
40
|
+
"card_type": "debit"
|
41
|
+
},
|
42
|
+
"delayed_capture": false,
|
43
|
+
"moto": false,
|
44
|
+
"provider_id": "9bb0c2c1-d0c5-4a63-8945-f4240e06f8ae",
|
45
|
+
"return_url": "https://some-wcr-env.defra.gov.uk/completed",
|
46
|
+
"authorisation_mode": "web",
|
47
|
+
"card_brand": "Mastercard",
|
48
|
+
"_links": {
|
49
|
+
"self": {
|
50
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d",
|
51
|
+
"method": "GET"
|
52
|
+
},
|
53
|
+
"events": {
|
54
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d/events",
|
55
|
+
"method": "GET"
|
56
|
+
},
|
57
|
+
"refunds": {
|
58
|
+
"href": "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d/refunds",
|
59
|
+
"method": "GET"
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
@@ -40,12 +40,17 @@ module DefraRubyMocks
|
|
40
40
|
expect(response_json["description"]).to eq payment_request[:description]
|
41
41
|
expect(response_json["_links"]["next_url"]["href"]).to eq payment_request[:return_url]
|
42
42
|
end
|
43
|
+
|
44
|
+
it "enqueues a job to perform the payment callback" do
|
45
|
+
ActiveJob::Base.queue_adapter = :test
|
46
|
+
expect { post path, params: payment_request.as_json }.to have_enqueued_job(GovpayPaymentCallbackJob)
|
47
|
+
end
|
43
48
|
end
|
44
49
|
|
45
50
|
context "when the request is missing a mandatory parameter" do
|
46
51
|
before { payment_request[:amount] = nil }
|
47
52
|
|
48
|
-
it "returns a HTTP 500
|
53
|
+
it "returns a HTTP 500 response" do
|
49
54
|
post path, params: payment_request.as_json
|
50
55
|
|
51
56
|
expect(response.code).to eq "500"
|
@@ -55,8 +60,16 @@ module DefraRubyMocks
|
|
55
60
|
|
56
61
|
describe "#payment_details" do
|
57
62
|
let(:path) { "/defra_ruby_mocks/govpay/v1/payments/#{payment_id}" }
|
63
|
+
|
58
64
|
context "when the payment id is valid" do
|
65
|
+
before do
|
66
|
+
allow(GovpayGetPaymentService).to receive(:run)
|
67
|
+
.with(payment_id)
|
68
|
+
.and_return(JSON.parse(File.read("spec/fixtures/files/govpay/get_payment_response_success.json")))
|
69
|
+
end
|
70
|
+
|
59
71
|
let(:payment_id) { "12345678901234567890123456" }
|
72
|
+
|
60
73
|
it "returns a valid success response" do
|
61
74
|
get path
|
62
75
|
|
@@ -65,7 +78,14 @@ module DefraRubyMocks
|
|
65
78
|
end
|
66
79
|
|
67
80
|
context "when the payment id is not valid" do
|
81
|
+
before do
|
82
|
+
allow(GovpayGetPaymentService).to receive(:run)
|
83
|
+
.with(payment_id)
|
84
|
+
.and_return(JSON.parse(File.read("spec/fixtures/files/govpay/get_payment_response_error.json")))
|
85
|
+
end
|
86
|
+
|
68
87
|
let(:payment_id) { "0" }
|
88
|
+
|
69
89
|
it "returns a 422 response" do
|
70
90
|
get path
|
71
91
|
|
@@ -73,6 +93,49 @@ module DefraRubyMocks
|
|
73
93
|
end
|
74
94
|
end
|
75
95
|
end
|
96
|
+
|
97
|
+
describe "#create_refund" do
|
98
|
+
let(:payment_id) { "12345678901234567890123456" }
|
99
|
+
let(:path) { "/defra_ruby_mocks/govpay/v1/payments/#{payment_id}/refunds" }
|
100
|
+
let(:refund_request) do
|
101
|
+
{
|
102
|
+
"amount": 2000,
|
103
|
+
"refund_amount_available": 5000
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
context "when the request is missing a mandatory parameter" do
|
108
|
+
before { refund_request[:refund_amount_available] = nil }
|
109
|
+
|
110
|
+
it "returns a HTTP 500 response" do
|
111
|
+
post path, params: refund_request.as_json
|
112
|
+
|
113
|
+
expect(response.code).to eq "500"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context "with a valid request" do
|
118
|
+
it "returns a valid success response" do
|
119
|
+
post path, params: refund_request.as_json
|
120
|
+
|
121
|
+
expect(response.code).to eq "200"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "#refund_details" do
|
127
|
+
let(:payment_id) { "12345678901234567890123456" }
|
128
|
+
let(:refund_id) { "j6se0f2o427g28g8yg3u3i" }
|
129
|
+
let(:path) { "/defra_ruby_mocks/govpay/v1/payments/#{payment_id}/refunds/#{refund_id}" }
|
130
|
+
|
131
|
+
context "with a valid request" do
|
132
|
+
it "returns a valid success response" do
|
133
|
+
get path
|
134
|
+
|
135
|
+
expect(response.code).to eq "200"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
76
139
|
end
|
77
140
|
|
78
141
|
context "when mocks are disabled" do
|