fat_zebra 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +1 -1
  3. data/lib/fat_zebra.rb +1 -0
  4. data/lib/fat_zebra/authorise.rb +49 -0
  5. data/lib/fat_zebra/version.rb +1 -1
  6. data/spec/cassettes/FatZebra_Authorise/_authorise/with_challenge_response/1_2_3_1.yml +48 -0
  7. data/spec/cassettes/FatZebra_Authorise/_authorise/with_challenge_response/1_2_3_2.yml +48 -0
  8. data/spec/cassettes/FatZebra_Authorise/_authorise/with_frictionless_response/1_2_2_1.yml +48 -0
  9. data/spec/cassettes/FatZebra_Authorise/_authorise/with_frictionless_response/1_2_2_2.yml +48 -0
  10. data/spec/cassettes/FatZebra_Authorise/_authorise/with_invalid_input/1_2_1_1.yml +50 -0
  11. data/spec/cassettes/FatZebra_Authorise/_jwt_token/returns_JWT_with_given_params.yml +46 -0
  12. data/spec/cassettes/FatZebra_Authorise/_jwt_token/returns_JWT_with_no_params.yml +46 -0
  13. data/spec/cassettes/FatZebra_Authorise/_jwt_token/returns_JWT_with_some_params.yml +46 -0
  14. data/spec/cassettes/FatZebra_BankAccount/_create/1_1_1.yml +8 -14
  15. data/spec/cassettes/FatZebra_BankAccount/_create/1_1_2.yml +8 -14
  16. data/spec/cassettes/FatZebra_BankAccount/_search/1_2_1.yml +30 -30
  17. data/spec/cassettes/FatZebra_BankAccount/_search/1_2_2.yml +30 -30
  18. data/spec/cassettes/FatZebra_BankAccount/_search/1_2_3.yml +30 -30
  19. data/spec/cassettes/FatZebra_Batch/_create/with_file/1_1_1_1.yml +11 -17
  20. data/spec/cassettes/FatZebra_Batch/_create/with_file/1_1_1_2.yml +11 -17
  21. data/spec/cassettes/FatZebra_Batch/_create/with_path/1_1_2_1.yml +11 -17
  22. data/spec/cassettes/FatZebra_Batch/_create/with_path/1_1_2_2.yml +11 -17
  23. data/spec/cassettes/FatZebra_Batch/_find/1_2_1.yml +19 -31
  24. data/spec/cassettes/FatZebra_Batch/_find/1_2_2.yml +19 -31
  25. data/spec/cassettes/FatZebra_Batch/_result/1_4_1.yml +26 -44
  26. data/spec/cassettes/FatZebra_Batch/_search/1_3_1.yml +6 -6
  27. data/spec/cassettes/FatZebra_Batch/_search/1_3_2.yml +6 -6
  28. data/spec/cassettes/FatZebra_Batch/_search/1_3_3.yml +6 -6
  29. data/spec/cassettes/FatZebra_Card/_create/1_1_1.yml +7 -13
  30. data/spec/cassettes/FatZebra_Card/_create/1_1_2.yml +7 -13
  31. data/spec/cassettes/FatZebra_Card/_create/1_1_3.yml +7 -13
  32. data/spec/cassettes/FatZebra_Card/_create/1_1_4.yml +7 -13
  33. data/spec/cassettes/FatZebra_Card/_create/1_1_5.yml +7 -13
  34. data/spec/cassettes/FatZebra_Card/_create/1_1_6.yml +7 -13
  35. data/spec/cassettes/FatZebra_Card/_update/1_2_1.yml +15 -27
  36. data/spec/cassettes/FatZebra_Card/_update/1_2_2.yml +15 -27
  37. data/spec/cassettes/FatZebra_Card/_update/1_2_3.yml +15 -27
  38. data/spec/cassettes/FatZebra_Card/_update/validations/1_2_4_1.yml +7 -13
  39. data/spec/cassettes/FatZebra_Customer/_create/1_1_1.yml +9 -15
  40. data/spec/cassettes/FatZebra_Customer/_create/1_1_2.yml +9 -15
  41. data/spec/cassettes/FatZebra_Customer/_create/1_1_3.yml +9 -15
  42. data/spec/cassettes/FatZebra_Customer/_create/1_1_4.yml +9 -15
  43. data/spec/cassettes/FatZebra_Customer/_create/1_1_5.yml +9 -15
  44. data/spec/cassettes/FatZebra_Customer/_create/1_1_6.yml +9 -15
  45. data/spec/cassettes/FatZebra_Customer/_delete/1_5_1.yml +18 -30
  46. data/spec/cassettes/FatZebra_Customer/_find/1_3_1.yml +18 -30
  47. data/spec/cassettes/FatZebra_Customer/_find/1_3_2.yml +18 -30
  48. data/spec/cassettes/FatZebra_Customer/_search/1_2_1.yml +12 -16
  49. data/spec/cassettes/FatZebra_Customer/_search/1_2_2.yml +12 -16
  50. data/spec/cassettes/FatZebra_Customer/_search/1_2_3.yml +12 -16
  51. data/spec/cassettes/FatZebra_Customer/_update/1_4_1.yml +19 -31
  52. data/spec/cassettes/FatZebra_Customer/_update/1_4_2.yml +19 -31
  53. data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_1.yml +8 -14
  54. data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_2.yml +8 -14
  55. data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_3.yml +8 -14
  56. data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_4.yml +8 -14
  57. data/spec/cassettes/FatZebra_DirectCredit/_create/validations/valid/1_1_5_1_1.yml +7 -13
  58. data/spec/cassettes/FatZebra_DirectCredit/_delete/1_4_1.yml +16 -28
  59. data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_1.yml +16 -28
  60. data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_2.yml +16 -28
  61. data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_3.yml +13 -13
  62. data/spec/cassettes/FatZebra_DirectCredit/_search/1_3_1.yml +20 -20
  63. data/spec/cassettes/FatZebra_DirectCredit/_search/1_3_2.yml +20 -20
  64. data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_1.yml +8 -14
  65. data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_2.yml +8 -14
  66. data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_3.yml +8 -14
  67. data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_4.yml +8 -14
  68. data/spec/cassettes/FatZebra_DirectDebit/_create/validations/valid/1_1_5_1_1.yml +7 -13
  69. data/spec/cassettes/FatZebra_DirectDebit/_delete/1_4_1.yml +16 -28
  70. data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_1.yml +16 -28
  71. data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_2.yml +16 -28
  72. data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_3.yml +13 -13
  73. data/spec/cassettes/FatZebra_DirectDebit/_search/1_3_1.yml +20 -20
  74. data/spec/cassettes/FatZebra_DirectDebit/_search/1_3_2.yml +20 -20
  75. data/spec/cassettes/FatZebra_Information/_ping/1_1_1.yml +7 -13
  76. data/spec/cassettes/FatZebra_Information/_ping/1_1_2.yml +7 -13
  77. data/spec/cassettes/FatZebra_PaymentPlan/_active_/1_8_1.yml +48 -48
  78. data/spec/cassettes/FatZebra_PaymentPlan/_active_/1_8_2.yml +48 -48
  79. data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_1.yml +20 -20
  80. data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_2.yml +20 -20
  81. data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_3.yml +20 -20
  82. data/spec/cassettes/FatZebra_PaymentPlan/_delete/1_5_1.yml +28 -28
  83. data/spec/cassettes/FatZebra_PaymentPlan/_destroy/1_6_1.yml +28 -28
  84. data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_1.yml +32 -32
  85. data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_2.yml +32 -32
  86. data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_3.yml +32 -32
  87. data/spec/cassettes/FatZebra_PaymentPlan/_suspend_/1_7_1.yml +34 -34
  88. data/spec/cassettes/FatZebra_PaymentPlan/_suspend_/1_7_2.yml +34 -34
  89. data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_1.yml +28 -28
  90. data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_2.yml +28 -28
  91. data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_3.yml +28 -28
  92. data/spec/cassettes/FatZebra_PaymentPlan/_update/1_4_1.yml +34 -34
  93. data/spec/cassettes/FatZebra_PaymentPlan/_update/1_4_2.yml +34 -34
  94. data/spec/cassettes/FatZebra_Purchase/_create/1_1_1.yml +9 -15
  95. data/spec/cassettes/FatZebra_Purchase/_create/1_1_10.yml +9 -15
  96. data/spec/cassettes/FatZebra_Purchase/_create/1_1_11.yml +9 -15
  97. data/spec/cassettes/FatZebra_Purchase/_create/1_1_12.yml +9 -15
  98. data/spec/cassettes/FatZebra_Purchase/_create/1_1_13.yml +9 -15
  99. data/spec/cassettes/FatZebra_Purchase/_create/1_1_2.yml +9 -15
  100. data/spec/cassettes/FatZebra_Purchase/_create/1_1_3.yml +9 -15
  101. data/spec/cassettes/FatZebra_Purchase/_create/1_1_4.yml +9 -15
  102. data/spec/cassettes/FatZebra_Purchase/_create/1_1_5.yml +9 -15
  103. data/spec/cassettes/FatZebra_Purchase/_create/1_1_6.yml +9 -15
  104. data/spec/cassettes/FatZebra_Purchase/_create/1_1_7.yml +9 -15
  105. data/spec/cassettes/FatZebra_Purchase/_create/1_1_8.yml +9 -15
  106. data/spec/cassettes/FatZebra_Purchase/_create/1_1_9.yml +9 -15
  107. data/spec/cassettes/FatZebra_Purchase/_create/bad_request/1_1_14_1.yml +11 -17
  108. data/spec/cassettes/FatZebra_Purchase/_create/bad_request/1_1_14_2.yml +11 -17
  109. data/spec/cassettes/FatZebra_Purchase/_void/1_6_1.yml +18 -30
  110. data/spec/cassettes/FatZebra_Purchase/_void/1_6_2.yml +18 -30
  111. data/spec/cassettes/FatZebra_Purchase/_void/1_6_3.yml +18 -30
  112. data/spec/cassettes/FatZebra_Purchase/_void/1_6_4.yml +18 -30
  113. data/spec/cassettes/FatZebra_Purchase/_void/1_7_1.yml +18 -30
  114. data/spec/cassettes/FatZebra_Purchase/_void/1_7_2.yml +18 -30
  115. data/spec/cassettes/FatZebra_Purchase/_void/1_7_3.yml +18 -30
  116. data/spec/cassettes/FatZebra_Purchase/_void/1_7_4.yml +18 -30
  117. data/spec/cassettes/FatZebra_Refund/_create/1_1_1.yml +16 -16
  118. data/spec/cassettes/FatZebra_Refund/_create/1_1_10.yml +16 -16
  119. data/spec/cassettes/FatZebra_Refund/_create/1_1_2.yml +16 -16
  120. data/spec/cassettes/FatZebra_Refund/_create/1_1_3.yml +16 -16
  121. data/spec/cassettes/FatZebra_Refund/_create/1_1_4.yml +16 -16
  122. data/spec/cassettes/FatZebra_Refund/_create/1_1_5.yml +16 -16
  123. data/spec/cassettes/FatZebra_Refund/_create/1_1_6.yml +16 -16
  124. data/spec/cassettes/FatZebra_Refund/_create/1_1_7.yml +16 -16
  125. data/spec/cassettes/FatZebra_Refund/_create/1_1_8.yml +16 -16
  126. data/spec/cassettes/FatZebra_Refund/_create/1_1_9.yml +16 -16
  127. data/spec/cassettes/FatZebra_Refund/_find/1_2_1.yml +24 -24
  128. data/spec/cassettes/FatZebra_Refund/_find/1_2_2.yml +24 -24
  129. data/spec/cassettes/FatZebra_Refund/_find/1_2_3.yml +24 -24
  130. data/spec/cassettes/FatZebra_Refund/_search/responds_with_the_newly-created_refunds.yml +40 -40
  131. data/spec/cassettes/FatZebra_Refund/_void/1_4_1.yml +24 -24
  132. data/spec/cassettes/FatZebra_Refund/_void/1_4_2.yml +24 -24
  133. data/spec/cassettes/FatZebra_Refund/_void/1_4_3.yml +24 -24
  134. data/spec/cassettes/FatZebra_Refund/_void/1_4_4.yml +24 -24
  135. data/spec/cassettes/FatZebra_WebHook/_create/1_1_1.yml +7 -13
  136. data/spec/cassettes/FatZebra_WebHook/_create/1_1_2.yml +7 -13
  137. data/spec/cassettes/FatZebra_WebHook/_create/1_1_3.yml +7 -13
  138. data/spec/cassettes/FatZebra_WebHook/_delete/1_4_1.yml +15 -27
  139. data/spec/cassettes/FatZebra_WebHook/_search/1_2_1.yml +160 -133
  140. data/spec/cassettes/FatZebra_WebHook/_search/1_2_2.yml +162 -135
  141. data/spec/cassettes/FatZebra_WebHook/_update/1_3_1.yml +15 -27
  142. data/spec/cassettes/FatZebra_WebHook/_update/1_3_2.yml +15 -27
  143. data/spec/lib/fat_zebra/authorise_spec.rb +101 -0
  144. data/spec/lib/fat_zebra/purchase_spec.rb +3 -3
  145. data/spec/lib/fat_zebra/refund_spec.rb +1 -1
  146. data/spec/support/payloads.rb +42 -0
  147. metadata +13 -4
  148. data/spec/cassettes/FatZebra_DirectDebit/_create/validations/failed_with_non-float/1_1_5_3_1.yml +0 -52
@@ -23,7 +23,7 @@ http_interactions:
23
23
  message: OK
24
24
  headers:
25
25
  Date:
26
- - Tue, 08 May 2018 11:08:20 GMT
26
+ - Mon, 29 Apr 2019 09:20:37 GMT
27
27
  Content-Type:
28
28
  - application/json; charset=utf-8
29
29
  Transfer-Encoding:
@@ -35,30 +35,24 @@ http_interactions:
35
35
  Cache-Control:
36
36
  - no-store
37
37
  X-Request-Version:
38
- - 1.16.9-3186@7b619da
38
+ - 1.16.9-3941@c1d8236
39
+ X-Runtime:
40
+ - '0.032522'
39
41
  Pragma:
40
42
  - no-cache
41
- X-Xss-Protection:
42
- - 1; mode=block
43
43
  X-Request-Id:
44
- - f6ea309c72e407639cea5b5c
45
- X-Runtime:
46
- - '0.027988'
47
- X-Frame-Options:
48
- - SAMEORIGIN
49
- X-Content-Type-Options:
50
- - nosniff
44
+ - 8cb733fcf021fd9072423e58
51
45
  X-Backend:
52
46
  - sbox-priv-gateway-a
53
47
  body:
54
48
  encoding: UTF-8
55
49
  string: '{"successful":true,"response":{"address":"http://stage.example.com.au/v1/api/hook_listener","events":"*","mode":"Test","authentication_username":null,"authentication_password":"","is_active":null,"name":"test
56
- hook","id":"071-WH-IU6R12ZF"},"errors":[],"test":true}'
50
+ hook","id":"071-WH-NOQIX4KB"},"errors":[],"test":true}'
57
51
  http_version:
58
- recorded_at: Tue, 08 May 2018 11:08:20 GMT
52
+ recorded_at: Mon, 29 Apr 2019 09:20:37 GMT
59
53
  - request:
60
54
  method: put
61
- uri: https://gateway.sandbox.fatzebra.com.au/v1.0/web_hooks/071-WH-IU6R12ZF
55
+ uri: https://gateway.sandbox.fatzebra.com.au/v1.0/web_hooks/071-WH-NOQIX4KB
62
56
  body:
63
57
  encoding: UTF-8
64
58
  string: '{"address":"http://stage.example.com.au/v1/api/hook_listener","events":"*","mode":"Test","authentication_username":null,"authentication_password":"","is_active":null,"name":"test
@@ -80,7 +74,7 @@ http_interactions:
80
74
  message: OK
81
75
  headers:
82
76
  Date:
83
- - Tue, 08 May 2018 11:08:20 GMT
77
+ - Mon, 29 Apr 2019 09:20:37 GMT
84
78
  Content-Type:
85
79
  - application/json; charset=utf-8
86
80
  Transfer-Encoding:
@@ -92,25 +86,19 @@ http_interactions:
92
86
  Cache-Control:
93
87
  - no-store
94
88
  X-Request-Version:
95
- - 1.16.9-3186@7b619da
89
+ - 1.16.9-3941@c1d8236
90
+ X-Runtime:
91
+ - '0.031956'
96
92
  Pragma:
97
93
  - no-cache
98
- X-Xss-Protection:
99
- - 1; mode=block
100
94
  X-Request-Id:
101
- - ebd6bac370b3aab1dab345ab
102
- X-Runtime:
103
- - '0.029835'
104
- X-Frame-Options:
105
- - SAMEORIGIN
106
- X-Content-Type-Options:
107
- - nosniff
95
+ - 94529f48078709302340b848
108
96
  X-Backend:
109
97
  - sbox-priv-gateway-a
110
98
  body:
111
99
  encoding: UTF-8
112
100
  string: '{"successful":true,"response":{"address":"http://stage.example.com.au/v1/api/hook_listener","events":"*","mode":"Test","authentication_username":null,"authentication_password":"","is_active":null,"name":"New
113
- Test hook","id":"071-WH-IU6R12ZF"},"errors":[],"test":true}'
101
+ Test hook","id":"071-WH-NOQIX4KB"},"errors":[],"test":true}'
114
102
  http_version:
115
- recorded_at: Tue, 08 May 2018 11:08:20 GMT
103
+ recorded_at: Mon, 29 Apr 2019 09:20:37 GMT
116
104
  recorded_with: VCR 3.0.3
@@ -23,7 +23,7 @@ http_interactions:
23
23
  message: OK
24
24
  headers:
25
25
  Date:
26
- - Tue, 08 May 2018 11:08:20 GMT
26
+ - Mon, 29 Apr 2019 09:20:38 GMT
27
27
  Content-Type:
28
28
  - application/json; charset=utf-8
29
29
  Transfer-Encoding:
@@ -35,30 +35,24 @@ http_interactions:
35
35
  Cache-Control:
36
36
  - no-store
37
37
  X-Request-Version:
38
- - 1.16.9-3186@7b619da
38
+ - 1.16.9-3941@c1d8236
39
+ X-Runtime:
40
+ - '0.030886'
39
41
  Pragma:
40
42
  - no-cache
41
- X-Xss-Protection:
42
- - 1; mode=block
43
43
  X-Request-Id:
44
- - f036676f5d59d8ce28caf7db
45
- X-Runtime:
46
- - '0.028663'
47
- X-Frame-Options:
48
- - SAMEORIGIN
49
- X-Content-Type-Options:
50
- - nosniff
44
+ - 1d1740ccf6ae9e943b19214c
51
45
  X-Backend:
52
46
  - sbox-priv-gateway-a
53
47
  body:
54
48
  encoding: UTF-8
55
49
  string: '{"successful":true,"response":{"address":"http://stage.example.com.au/v1/api/hook_listener","events":"*","mode":"Test","authentication_username":null,"authentication_password":"","is_active":null,"name":"test
56
- hook","id":"071-WH-1H7L5ZCI"},"errors":[],"test":true}'
50
+ hook","id":"071-WH-Q5W5NSU9"},"errors":[],"test":true}'
57
51
  http_version:
58
- recorded_at: Tue, 08 May 2018 11:08:20 GMT
52
+ recorded_at: Mon, 29 Apr 2019 09:20:38 GMT
59
53
  - request:
60
54
  method: put
61
- uri: https://gateway.sandbox.fatzebra.com.au/v1.0/web_hooks/071-WH-1H7L5ZCI
55
+ uri: https://gateway.sandbox.fatzebra.com.au/v1.0/web_hooks/071-WH-Q5W5NSU9
62
56
  body:
63
57
  encoding: UTF-8
64
58
  string: '{"address":"http://stage.example.com.au/v1/api/hook_listener","events":"*","mode":"Test","authentication_username":null,"authentication_password":"","is_active":null,"name":"test
@@ -80,7 +74,7 @@ http_interactions:
80
74
  message: OK
81
75
  headers:
82
76
  Date:
83
- - Tue, 08 May 2018 11:08:20 GMT
77
+ - Mon, 29 Apr 2019 09:20:38 GMT
84
78
  Content-Type:
85
79
  - application/json; charset=utf-8
86
80
  Transfer-Encoding:
@@ -92,25 +86,19 @@ http_interactions:
92
86
  Cache-Control:
93
87
  - no-store
94
88
  X-Request-Version:
95
- - 1.16.9-3186@7b619da
89
+ - 1.16.9-3941@c1d8236
90
+ X-Runtime:
91
+ - '0.034236'
96
92
  Pragma:
97
93
  - no-cache
98
- X-Xss-Protection:
99
- - 1; mode=block
100
94
  X-Request-Id:
101
- - a8c5edf2ac586652e4c0b818
102
- X-Runtime:
103
- - '0.029149'
104
- X-Frame-Options:
105
- - SAMEORIGIN
106
- X-Content-Type-Options:
107
- - nosniff
95
+ - 0ca930a64c9287f6466e0332
108
96
  X-Backend:
109
97
  - sbox-priv-gateway-a
110
98
  body:
111
99
  encoding: UTF-8
112
100
  string: '{"successful":true,"response":{"address":"http://stage.example.com.au/v1/api/hook_listener","events":"*","mode":"Test","authentication_username":null,"authentication_password":"","is_active":null,"name":"New
113
- Test hook","id":"071-WH-1H7L5ZCI"},"errors":[],"test":true}'
101
+ Test hook","id":"071-WH-Q5W5NSU9"},"errors":[],"test":true}'
114
102
  http_version:
115
- recorded_at: Tue, 08 May 2018 11:08:20 GMT
103
+ recorded_at: Mon, 29 Apr 2019 09:20:38 GMT
116
104
  recorded_with: VCR 3.0.3
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ describe FatZebra::Authorise do
4
+
5
+ describe '.jwt_token', :vcr do
6
+ subject(:token) { FatZebra::Authorise.jwt_token(valid_3ds_token_payload) }
7
+
8
+ let(:valid_3ds_token_payload) {{
9
+ reference_id: 'xxxx-xxxx-xxxx',
10
+ confirm_url: 'https://example.com',
11
+ order_number: 'xxxx-xxxx-xxxx',
12
+ currency_code: '036',
13
+ amount: 100
14
+ }}
15
+
16
+ it 'returns JWT with given params' do
17
+ is_expected.to be_accepted
18
+ expect(token.jwt).to be_truthy
19
+ expect(token.reference_id).to be_truthy
20
+ end
21
+
22
+ it 'returns JWT with some params' do
23
+ valid_3ds_token_payload.delete(:reference_id)
24
+ is_expected.to be_accepted
25
+ expect(token.jwt).to be_truthy
26
+ expect(token.reference_id).to be_truthy
27
+ end
28
+
29
+ it 'returns JWT with no params' do
30
+ valid_3ds_token_payload.clear
31
+ is_expected.to be_accepted
32
+ expect(token.jwt).to be_truthy
33
+ expect(token.reference_id).to be_truthy
34
+ end
35
+ end
36
+
37
+ describe '.authorise', :vcr do
38
+ subject(:authorise) { FatZebra::Authorise.authorise(valid_3ds_authorise_payload) }
39
+
40
+ context 'with invalid input' do
41
+ before do
42
+ valid_3ds_authorise_payload[:card_expiry] = DateTime.now.prev_month.strftime('%m/%Y')
43
+ end
44
+
45
+ it do
46
+ is_expected.not_to be_accepted
47
+ expect(authorise.errors).to match(/Error Validating Credit Card Expiration/)
48
+ end
49
+ end
50
+
51
+ context 'with frictionless response' do
52
+ before do
53
+ valid_3ds_authorise_payload[:card_number] = '4000000000001000'
54
+ end
55
+
56
+ it do
57
+ is_expected.to be_accepted
58
+ expect(authorise.keys).to include('Enrolled', 'ACSUrl', 'CardBin', 'TransactionId')
59
+ expect(authorise.errors).not_to be_truthy
60
+ end
61
+
62
+ it do
63
+ expect(authorise.Enrolled).to eq('Y')
64
+ expect(authorise.ACSUrl).not_to be_truthy
65
+ expect(authorise.CardBin).to be_truthy
66
+ expect(authorise.ErrorNo).to eq('0')
67
+ expect(authorise.ErrorDesc).not_to be_truthy
68
+ expect(authorise.CardBrand).to be_truthy
69
+ expect(authorise.TransactionId).to be_truthy
70
+ end
71
+ end
72
+
73
+ context 'with challenge response' do
74
+ before do
75
+ valid_3ds_authorise_payload[:card_number] = '4111111111111111'
76
+ end
77
+
78
+ it do
79
+ is_expected.to be_accepted
80
+ expect(authorise.keys).to include('Enrolled', 'ACSUrl', 'CardBin', 'TransactionId')
81
+ expect(authorise.errors).not_to be_truthy
82
+ end
83
+
84
+ it do
85
+ expect(authorise.Enrolled).to eq('Y')
86
+ expect(authorise.ACSUrl).to be_truthy
87
+ expect(authorise.CardBin).to be_truthy
88
+ expect(authorise.ErrorNo).to eq('0')
89
+ expect(authorise.ErrorDesc).not_to be_truthy
90
+ expect(authorise.CardBrand).to be_truthy
91
+ expect(authorise.TransactionId).to be_truthy
92
+ end
93
+ end
94
+
95
+ context 'validations' do
96
+ let(:valid_3ds_authorise_payload) {{}}
97
+
98
+ it { expect{ authorise }.to raise_error(FatZebra::RequestValidationError) }
99
+ end
100
+ end
101
+ end
@@ -16,7 +16,7 @@ describe FatZebra::Purchase do
16
16
  it { expect(purchase.card_category).to eq('Credit') }
17
17
  it { expect(purchase.card_token).to_not be_empty }
18
18
  it { expect(purchase.addendum_data).to eq({}) }
19
- it { expect(purchase.metadata).to eq({}) }
19
+ it { expect(purchase.metadata).to eq({ "authorization_tracking_id" => "", "original_transaction_reference" => "" }) }
20
20
  it { expect(purchase.response_code).to eq('00') }
21
21
 
22
22
  context 'bad request' do
@@ -77,7 +77,7 @@ describe FatZebra::Purchase do
77
77
  subject(:void) { FatZebra::Purchase.void(purchase.id) }
78
78
 
79
79
  it { is_expected.to be_accepted }
80
- it { is_expected.to_not be_successful }
80
+ it { is_expected.to be_successful }
81
81
  it { expect(void.message).to eq('Voided') }
82
82
  it { expect(void).to be_a(FatZebra::Purchase) }
83
83
  end
@@ -87,7 +87,7 @@ describe FatZebra::Purchase do
87
87
  before { expect(purchase.void).to be_truthy }
88
88
 
89
89
  it { is_expected.to be_accepted }
90
- it { is_expected.to_not be_successful }
90
+ it { is_expected.to be_successful }
91
91
  it { expect(purchase.message).to eq('Voided') }
92
92
  it { expect(purchase).to be_a(FatZebra::Purchase) }
93
93
  end
@@ -72,7 +72,7 @@ describe FatZebra::Refund do
72
72
  let(:reference) { purchase.reference }
73
73
 
74
74
  it { is_expected.to be_accepted }
75
- it { is_expected.to_not be_successful }
75
+ it { is_expected.to be_successful }
76
76
  it { expect(refund.message).to eq('Voided') }
77
77
  it { expect(refund).to be_a(FatZebra::Refund) }
78
78
  end
@@ -40,4 +40,46 @@ shared_context 'payloads' do
40
40
  }
41
41
  }}
42
42
 
43
+ let(:valid_3ds_authorise_payload) {{
44
+ card_number: '5123456789012346',
45
+ card_expiry: DateTime.now.next_year.strftime('%m/%Y'),
46
+ threeds: {
47
+ enabled: true,
48
+ amount: 100,
49
+ billing_address1: 'SOME ADDRESS',
50
+ billing_city: 'Sydney',
51
+ billing_country_code: '036', # Australia
52
+ billing_first_name: 'John',
53
+ billing_last_name: 'Smith',
54
+ billing_postal_code: '2000',
55
+ billing_state: 'NSW',
56
+ currency_code: '036',
57
+ df_reference_id: SecureRandom.hex(10),
58
+ mobile_phone: '1234567890',
59
+ email: 'dev@fatzebra.com.au',
60
+ transaction_mode: 'mobile',
61
+ transaction_type: 'C',
62
+ order_number: SecureRandom.hex(10),
63
+
64
+ shipping_address1: 'SOME ADDRESS',
65
+ shipping_state: 'NSW',
66
+ shipping_city: 'Sydney',
67
+ shipping_country_code: '036',
68
+ shipping_address2: 'SOME ADDRESS',
69
+ shipping_address3: 'SOME ADDRESS',
70
+ shipping_postal_code: '2000',
71
+ billing_phone: '1234567890',
72
+ work_phone: '1234567890',
73
+ billing_address2: 'SOME ADDRESS',
74
+ billing_address3: 'SOME ADDRESS',
75
+ authentication_indicator: '01',
76
+ product_code: 'PHY',
77
+
78
+ installment: 2,
79
+ purchase_date: DateTime.now.next_year.strftime('%Y%m%d%H%M%S'),
80
+ recurring_end: DateTime.now.next_year.strftime('%Y%m%d'),
81
+ recurring_frequency: 31
82
+ }
83
+ }}
84
+
43
85
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_zebra
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Savage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2019-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -118,6 +118,7 @@ files:
118
118
  - lib/fat_zebra/api_operation/search.rb
119
119
  - lib/fat_zebra/api_operation/void.rb
120
120
  - lib/fat_zebra/api_resource.rb
121
+ - lib/fat_zebra/authorise.rb
121
122
  - lib/fat_zebra/bank_account.rb
122
123
  - lib/fat_zebra/batch.rb
123
124
  - lib/fat_zebra/card.rb
@@ -142,6 +143,14 @@ files:
142
143
  - lib/fat_zebra/validation.rb
143
144
  - lib/fat_zebra/version.rb
144
145
  - lib/fat_zebra/web_hook.rb
146
+ - spec/cassettes/FatZebra_Authorise/_authorise/with_challenge_response/1_2_3_1.yml
147
+ - spec/cassettes/FatZebra_Authorise/_authorise/with_challenge_response/1_2_3_2.yml
148
+ - spec/cassettes/FatZebra_Authorise/_authorise/with_frictionless_response/1_2_2_1.yml
149
+ - spec/cassettes/FatZebra_Authorise/_authorise/with_frictionless_response/1_2_2_2.yml
150
+ - spec/cassettes/FatZebra_Authorise/_authorise/with_invalid_input/1_2_1_1.yml
151
+ - spec/cassettes/FatZebra_Authorise/_jwt_token/returns_JWT_with_given_params.yml
152
+ - spec/cassettes/FatZebra_Authorise/_jwt_token/returns_JWT_with_no_params.yml
153
+ - spec/cassettes/FatZebra_Authorise/_jwt_token/returns_JWT_with_some_params.yml
145
154
  - spec/cassettes/FatZebra_BankAccount/_create/1_1_1.yml
146
155
  - spec/cassettes/FatZebra_BankAccount/_create/1_1_2.yml
147
156
  - spec/cassettes/FatZebra_BankAccount/_search/1_2_1.yml
@@ -196,7 +205,6 @@ files:
196
205
  - spec/cassettes/FatZebra_DirectDebit/_create/1_1_2.yml
197
206
  - spec/cassettes/FatZebra_DirectDebit/_create/1_1_3.yml
198
207
  - spec/cassettes/FatZebra_DirectDebit/_create/1_1_4.yml
199
- - spec/cassettes/FatZebra_DirectDebit/_create/validations/failed_with_non-float/1_1_5_3_1.yml
200
208
  - spec/cassettes/FatZebra_DirectDebit/_create/validations/valid/1_1_5_1_1.yml
201
209
  - spec/cassettes/FatZebra_DirectDebit/_delete/1_4_1.yml
202
210
  - spec/cassettes/FatZebra_DirectDebit/_find/1_2_1.yml
@@ -290,6 +298,7 @@ files:
290
298
  - spec/cassettes/FatZebra_WebHook/_update/1_3_2.yml
291
299
  - spec/fixtures/batch_test.csv
292
300
  - spec/lib/fat_zebra/api_resource_spec.rb
301
+ - spec/lib/fat_zebra/authorise_spec.rb
293
302
  - spec/lib/fat_zebra/bank_account_spec.rb
294
303
  - spec/lib/fat_zebra/batch_spec.rb
295
304
  - spec/lib/fat_zebra/card_spec.rb
@@ -328,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
337
  version: '0'
329
338
  requirements: []
330
339
  rubyforge_project: fat_zebra
331
- rubygems_version: 2.6.12
340
+ rubygems_version: 2.7.6.2
332
341
  signing_key:
333
342
  specification_version: 4
334
343
  summary: Fat Zebra payments gem - integrate your ruby app with Fat Zebra
@@ -1,52 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://gateway.sandbox.fatzebra.com.au/v1.0/direct_debits
6
- body:
7
- encoding: UTF-8
8
- string: '{"description":"Confirmation","amount":123,"bsb":"123-123","account_name":"Test","account_number":"012345678","test":true}'
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - application/json
14
- User-Agent:
15
- - Ruby
16
- Authorization:
17
- - Basic VEVTVDpURVNU
18
- Content-Type:
19
- - application/json
20
- response:
21
- status:
22
- code: 201
23
- message: Created
24
- headers:
25
- Date:
26
- - Wed, 24 Oct 2018 01:02:52 GMT
27
- Content-Type:
28
- - application/json; charset=utf-8
29
- Transfer-Encoding:
30
- - chunked
31
- Connection:
32
- - keep-alive
33
- Status:
34
- - 201 Created
35
- Cache-Control:
36
- - no-store
37
- X-Request-Version:
38
- - 1.16.9-3627@3b72f16
39
- X-Runtime:
40
- - '0.051478'
41
- Pragma:
42
- - no-cache
43
- X-Request-Id:
44
- - 8c0141486f43f0bace8e32fc
45
- X-Backend:
46
- - sbox-priv-gateway-a
47
- body:
48
- encoding: UTF-8
49
- string: '{"successful":true,"response":{"id":"071-DD-5SPL2753","amount":123.0,"bsb":"123-123","account_number":"012345678","account_name":"Test","description":"Confirmation","reference":"071-DD-5SPL2753","date":"2018-10-24","process_date":null,"status":"New","result":null,"metadata":null},"errors":[],"test":true}'
50
- http_version:
51
- recorded_at: Wed, 24 Oct 2018 01:02:52 GMT
52
- recorded_with: VCR 3.0.3