fat_zebra_multi 3.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +0 -0
- data/.rubocop.yml +44 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/README.md +104 -0
- data/Rakefile +11 -0
- data/fat_zebra_multi.gemspec +27 -0
- data/lib/fat_zebra.rb +65 -0
- data/lib/fat_zebra/api_helper.rb +91 -0
- data/lib/fat_zebra/api_operation/delete.rb +38 -0
- data/lib/fat_zebra/api_operation/find.rb +30 -0
- data/lib/fat_zebra/api_operation/save.rb +67 -0
- data/lib/fat_zebra/api_operation/search.rb +39 -0
- data/lib/fat_zebra/api_operation/void.rb +52 -0
- data/lib/fat_zebra/api_resource.rb +88 -0
- data/lib/fat_zebra/bank_account.rb +20 -0
- data/lib/fat_zebra/batch.rb +60 -0
- data/lib/fat_zebra/card.rb +23 -0
- data/lib/fat_zebra/config.rb +90 -0
- data/lib/fat_zebra/customer.rb +26 -0
- data/lib/fat_zebra/direct_credit.rb +26 -0
- data/lib/fat_zebra/direct_debit.rb +26 -0
- data/lib/fat_zebra/errors.rb +37 -0
- data/lib/fat_zebra/fat_zebra_object.rb +68 -0
- data/lib/fat_zebra/information.rb +29 -0
- data/lib/fat_zebra/object_helper.rb +119 -0
- data/lib/fat_zebra/payment_plan.rb +61 -0
- data/lib/fat_zebra/purchase.rb +96 -0
- data/lib/fat_zebra/refund.rb +27 -0
- data/lib/fat_zebra/request.rb +174 -0
- data/lib/fat_zebra/request/multipart/epilogue.rb +23 -0
- data/lib/fat_zebra/request/multipart/file_io.rb +40 -0
- data/lib/fat_zebra/request/multipart/param.rb +37 -0
- data/lib/fat_zebra/request/multipart/part.rb +28 -0
- data/lib/fat_zebra/request/multipart/stream.rb +57 -0
- data/lib/fat_zebra/util.rb +71 -0
- data/lib/fat_zebra/validation.rb +67 -0
- data/lib/fat_zebra/version.rb +3 -0
- data/lib/fat_zebra/web_hook.rb +22 -0
- data/spec/cassettes/FatZebra_BankAccount/_create/1_1_1.yml +53 -0
- data/spec/cassettes/FatZebra_BankAccount/_create/1_1_2.yml +53 -0
- data/spec/cassettes/FatZebra_BankAccount/_search/1_2_1.yml +164 -0
- data/spec/cassettes/FatZebra_BankAccount/_search/1_2_2.yml +164 -0
- data/spec/cassettes/FatZebra_BankAccount/_search/1_2_3.yml +164 -0
- data/spec/cassettes/FatZebra_Batch/_create/with_file/1_1_1_1.yml +61 -0
- data/spec/cassettes/FatZebra_Batch/_create/with_file/1_1_1_2.yml +61 -0
- data/spec/cassettes/FatZebra_Batch/_create/with_path/1_1_2_1.yml +61 -0
- data/spec/cassettes/FatZebra_Batch/_create/with_path/1_1_2_2.yml +61 -0
- data/spec/cassettes/FatZebra_Batch/_find/1_2_1.yml +112 -0
- data/spec/cassettes/FatZebra_Batch/_find/1_2_2.yml +112 -0
- data/spec/cassettes/FatZebra_Batch/_result/1_4_1.yml +163 -0
- data/spec/cassettes/FatZebra_Batch/_search/1_3_1.yml +54 -0
- data/spec/cassettes/FatZebra_Batch/_search/1_3_2.yml +54 -0
- data/spec/cassettes/FatZebra_Batch/_search/1_3_3.yml +54 -0
- data/spec/cassettes/FatZebra_Card/_create/1_1_1.yml +54 -0
- data/spec/cassettes/FatZebra_Card/_create/1_1_2.yml +54 -0
- data/spec/cassettes/FatZebra_Card/_create/1_1_3.yml +54 -0
- data/spec/cassettes/FatZebra_Card/_create/1_1_4.yml +54 -0
- data/spec/cassettes/FatZebra_Card/_create/1_1_5.yml +54 -0
- data/spec/cassettes/FatZebra_Card/_create/1_1_6.yml +54 -0
- data/spec/cassettes/FatZebra_Card/_update/1_2_1.yml +105 -0
- data/spec/cassettes/FatZebra_Card/_update/1_2_2.yml +105 -0
- data/spec/cassettes/FatZebra_Card/_update/1_2_3.yml +105 -0
- data/spec/cassettes/FatZebra_Card/_update/validations/1_2_4_1.yml +54 -0
- data/spec/cassettes/FatZebra_Customer/_create/1_1_1.yml +55 -0
- data/spec/cassettes/FatZebra_Customer/_create/1_1_2.yml +55 -0
- data/spec/cassettes/FatZebra_Customer/_create/1_1_3.yml +55 -0
- data/spec/cassettes/FatZebra_Customer/_create/1_1_4.yml +55 -0
- data/spec/cassettes/FatZebra_Customer/_create/1_1_5.yml +55 -0
- data/spec/cassettes/FatZebra_Customer/_create/1_1_6.yml +55 -0
- data/spec/cassettes/FatZebra_Customer/_delete/1_5_1.yml +103 -0
- data/spec/cassettes/FatZebra_Customer/_find/1_3_1.yml +107 -0
- data/spec/cassettes/FatZebra_Customer/_find/1_3_2.yml +107 -0
- data/spec/cassettes/FatZebra_Customer/_search/1_2_1.yml +60 -0
- data/spec/cassettes/FatZebra_Customer/_search/1_2_2.yml +60 -0
- data/spec/cassettes/FatZebra_Customer/_search/1_2_3.yml +60 -0
- data/spec/cassettes/FatZebra_Customer/_update/1_4_1.yml +106 -0
- data/spec/cassettes/FatZebra_Customer/_update/1_4_2.yml +106 -0
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_1.yml +52 -0
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_2.yml +52 -0
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_3.yml +52 -0
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_4.yml +52 -0
- data/spec/cassettes/FatZebra_DirectCredit/_create/validations/valid/1_1_5_1_1.yml +52 -0
- data/spec/cassettes/FatZebra_DirectCredit/_delete/1_4_1.yml +99 -0
- data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_1.yml +103 -0
- data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_2.yml +103 -0
- data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_3.yml +103 -0
- data/spec/cassettes/FatZebra_DirectCredit/_search/1_3_1.yml +152 -0
- data/spec/cassettes/FatZebra_DirectCredit/_search/1_3_2.yml +152 -0
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_1.yml +52 -0
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_2.yml +52 -0
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_3.yml +52 -0
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_4.yml +52 -0
- data/spec/cassettes/FatZebra_DirectDebit/_create/validations/valid/1_1_5_1_1.yml +52 -0
- data/spec/cassettes/FatZebra_DirectDebit/_delete/1_4_1.yml +99 -0
- data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_1.yml +103 -0
- data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_2.yml +103 -0
- data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_3.yml +103 -0
- data/spec/cassettes/FatZebra_DirectDebit/_search/1_3_1.yml +152 -0
- data/spec/cassettes/FatZebra_DirectDebit/_search/1_3_2.yml +152 -0
- data/spec/cassettes/FatZebra_Information/_ping/1_1_1.yml +54 -0
- data/spec/cassettes/FatZebra_Information/_ping/1_1_2.yml +54 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_active_/1_8_1.yml +222 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_active_/1_8_2.yml +222 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_1.yml +110 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_2.yml +110 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_3.yml +110 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_delete/1_5_1.yml +158 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_destroy/1_6_1.yml +158 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_1.yml +167 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_2.yml +167 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_3.yml +167 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_suspend_/1_7_1.yml +166 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_suspend_/1_7_2.yml +166 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_1.yml +160 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_2.yml +160 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_3.yml +160 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_4_1.yml +166 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_4_2.yml +166 -0
- data/spec/cassettes/FatZebra_Purchase/_capture/1_5_1.yml +115 -0
- data/spec/cassettes/FatZebra_Purchase/_capture/1_5_2.yml +115 -0
- data/spec/cassettes/FatZebra_Purchase/_capture/1_5_3.yml +115 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_1.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_10.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_11.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_12.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_13.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_2.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_3.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_4.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_5.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_6.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_7.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_8.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_9.yml +53 -0
- data/spec/cassettes/FatZebra_Purchase/_create/bad_request/1_1_14_1.yml +55 -0
- data/spec/cassettes/FatZebra_Purchase/_create/bad_request/1_1_14_2.yml +55 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_2_1.yml +117 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_2_2.yml +117 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_2_3.yml +117 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_2_4.yml +117 -0
- data/spec/cassettes/FatZebra_Purchase/_refund/1_4_1.yml +115 -0
- data/spec/cassettes/FatZebra_Purchase/_refund/1_4_2.yml +115 -0
- data/spec/cassettes/FatZebra_Purchase/_refund/1_4_3.yml +115 -0
- data/spec/cassettes/FatZebra_Purchase/_search/1_3_1.yml +164 -0
- data/spec/cassettes/FatZebra_Purchase/_search/1_3_2.yml +164 -0
- data/spec/cassettes/FatZebra_Purchase/_search/1_3_3.yml +164 -0
- data/spec/cassettes/FatZebra_Purchase/_settlement/1_8_1.yml +652 -0
- data/spec/cassettes/FatZebra_Purchase/_settlement/1_8_2.yml +652 -0
- data/spec/cassettes/FatZebra_Purchase/_settlement/1_8_3.yml +652 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_1.yml +103 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_2.yml +103 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_3.yml +103 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_4.yml +103 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_1.yml +103 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_2.yml +103 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_3.yml +103 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_4.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_1.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_10.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_2.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_3.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_4.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_5.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_6.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_7.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_8.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_9.yml +103 -0
- data/spec/cassettes/FatZebra_Refund/_find/1_2_1.yml +155 -0
- data/spec/cassettes/FatZebra_Refund/_find/1_2_2.yml +155 -0
- data/spec/cassettes/FatZebra_Refund/_find/1_2_3.yml +155 -0
- data/spec/cassettes/FatZebra_Refund/_search/responds_with_the_newly-created_refunds.yml +214 -0
- data/spec/cassettes/FatZebra_Refund/_void/1_4_1.yml +153 -0
- data/spec/cassettes/FatZebra_Refund/_void/1_4_2.yml +153 -0
- data/spec/cassettes/FatZebra_Refund/_void/1_4_3.yml +153 -0
- data/spec/cassettes/FatZebra_Refund/_void/1_4_4.yml +153 -0
- data/spec/cassettes/FatZebra_WebHook/_create/1_1_1.yml +53 -0
- data/spec/cassettes/FatZebra_WebHook/_create/1_1_2.yml +53 -0
- data/spec/cassettes/FatZebra_WebHook/_create/1_1_3.yml +53 -0
- data/spec/cassettes/FatZebra_WebHook/_delete/1_4_1.yml +101 -0
- data/spec/cassettes/FatZebra_WebHook/_search/1_2_1.yml +298 -0
- data/spec/cassettes/FatZebra_WebHook/_search/1_2_2.yml +300 -0
- data/spec/cassettes/FatZebra_WebHook/_update/1_3_1.yml +104 -0
- data/spec/cassettes/FatZebra_WebHook/_update/1_3_2.yml +104 -0
- data/spec/cassettes/Multiple_accounts/The_basics/1_1_5.yml +59 -0
- data/spec/cassettes/Multiple_accounts/The_basics/1_1_6.yml +59 -0
- data/spec/fixtures/batch_test.csv +4 -0
- data/spec/lib/fat_zebra/api_resource_spec.rb +25 -0
- data/spec/lib/fat_zebra/bank_account_spec.rb +34 -0
- data/spec/lib/fat_zebra/batch_spec.rb +59 -0
- data/spec/lib/fat_zebra/card_spec.rb +41 -0
- data/spec/lib/fat_zebra/config_spec.rb +69 -0
- data/spec/lib/fat_zebra/customer_spec.rb +53 -0
- data/spec/lib/fat_zebra/direct_credit_spec.rb +74 -0
- data/spec/lib/fat_zebra/direct_debit_spec.rb +74 -0
- data/spec/lib/fat_zebra/fat_zebra_object_spec.rb +117 -0
- data/spec/lib/fat_zebra/information_spec.rb +13 -0
- data/spec/lib/fat_zebra/multiple_accounts_spec.rb +69 -0
- data/spec/lib/fat_zebra/payment_plan_spec.rb +94 -0
- data/spec/lib/fat_zebra/purchase_spec.rb +105 -0
- data/spec/lib/fat_zebra/refund_spec.rb +95 -0
- data/spec/lib/fat_zebra/request_spec.rb +59 -0
- data/spec/lib/fat_zebra/util_spec.rb +43 -0
- data/spec/lib/fat_zebra/validation_spec.rb +22 -0
- data/spec/lib/fat_zebra/web_hook_spec.rb +50 -0
- data/spec/spec_helper.rb +68 -0
- data/spec/support/payloads.rb +43 -0
- data/vendor/cacert.pem +3390 -0
- metadata +338 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://gateway.sandbox.fatzebra.com.au/v1.0/purchases
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"amount":10000,"card_holder":"Matthew Savage","card_number":"5123456789012346","card_expiry":"02/2030","cvv":123,"reference":"b02f1e45aad72c56e5c6a4a2a4b393e3","customer_ip":"1.2.3.4","currency":"AUD","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 VEVTVF9VU0VSTkFNRV8xOlRFU1RfVE9LRU5fMQ==
|
18
|
+
Content-Type:
|
19
|
+
- application/json
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Tue, 23 Apr 2019 07:34:33 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Status:
|
34
|
+
- 200 OK
|
35
|
+
Cache-Control:
|
36
|
+
- no-store
|
37
|
+
X-Request-Version:
|
38
|
+
- 1.16.9-3186@7b619da
|
39
|
+
Pragma:
|
40
|
+
- no-cache
|
41
|
+
X-Xss-Protection:
|
42
|
+
- 1; mode=block
|
43
|
+
X-Request-Id:
|
44
|
+
- 27efad845a3e26a69c2ec666
|
45
|
+
X-Runtime:
|
46
|
+
- '0.553949'
|
47
|
+
X-Frame-Options:
|
48
|
+
- SAMEORIGIN
|
49
|
+
X-Content-Type-Options:
|
50
|
+
- nosniff
|
51
|
+
X-Backend:
|
52
|
+
- sbox-priv-gateway-a
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: '{"successful":true,"response":{"authorization":"513689","id":"071-P-ACCOUNT-1","card_number":"512345XXXXXX2346","card_holder":"Matthew
|
56
|
+
Savage","card_expiry":"2030-02-28","card_token":"fke8drvv","card_type":"MasterCard","card_category":"Credit","card_subcategory":"Standard","amount":10000,"decimal_amount":100.0,"successful":true,"message":"Approved","reference":"4a395a60de25bccd8ee9f884178b2e4f","currency":"AUD","transaction_id":"071-P-OLIA44E1","settlement_date":null,"transaction_date":"2018-05-08T21:07:31.073+10:00","response_code":"00","captured":false,"captured_amount":0,"rrn":"071POLIA44E1","cvv_match":"M","metadata":{},"addendum_data":{}},"errors":[],"test":true}'
|
57
|
+
http_version:
|
58
|
+
recorded_at: Tue, 23 Apr 2019 07:34:33 GMT
|
59
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://gateway.sandbox.fatzebra.com.au/v1.0/purchases
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"amount":10000,"card_holder":"Matthew Savage","card_number":"5123456789012346","card_expiry":"02/2030","cvv":123,"reference":"b02f1e45aad72c56e5c6a4a2a4b393e3","customer_ip":"1.2.3.4","currency":"AUD","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 VEVTVF9VU0VSTkFNRV8yOlRFU1RfVE9LRU5fMg==
|
18
|
+
Content-Type:
|
19
|
+
- application/json
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Tue, 23 Apr 2019 07:34:33 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Status:
|
34
|
+
- 200 OK
|
35
|
+
Cache-Control:
|
36
|
+
- no-store
|
37
|
+
X-Request-Version:
|
38
|
+
- 1.16.9-3186@7b619da
|
39
|
+
Pragma:
|
40
|
+
- no-cache
|
41
|
+
X-Xss-Protection:
|
42
|
+
- 1; mode=block
|
43
|
+
X-Request-Id:
|
44
|
+
- 27efad845a3e26a69c2ec666
|
45
|
+
X-Runtime:
|
46
|
+
- '0.553949'
|
47
|
+
X-Frame-Options:
|
48
|
+
- SAMEORIGIN
|
49
|
+
X-Content-Type-Options:
|
50
|
+
- nosniff
|
51
|
+
X-Backend:
|
52
|
+
- sbox-priv-gateway-a
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: '{"successful":true,"response":{"authorization":"513689","id":"071-P-ACCOUNT-2","card_number":"512345XXXXXX2346","card_holder":"Matthew
|
56
|
+
Savage","card_expiry":"2030-02-28","card_token":"fke8drvv","card_type":"MasterCard","card_category":"Credit","card_subcategory":"Standard","amount":10000,"decimal_amount":100.0,"successful":true,"message":"Approved","reference":"4a395a60de25bccd8ee9f884178b2e4f","currency":"AUD","transaction_id":"071-P-OLIA44E1","settlement_date":null,"transaction_date":"2018-05-08T21:07:31.073+10:00","response_code":"00","captured":false,"captured_amount":0,"rrn":"071POLIA44E1","cvv_match":"M","metadata":{},"addendum_data":{}},"errors":[],"test":true}'
|
57
|
+
http_version:
|
58
|
+
recorded_at: Tue, 23 Apr 2019 07:34:33 GMT
|
59
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,4 @@
|
|
1
|
+
1000,AUD,Order12345,John Doe 1,4444333322221111,12/2020,,Gizmo ABC 1
|
2
|
+
2051,AUD,Order22345,John Doe 2,4444333322221111,12/2020,,Gizmo ABC 2
|
3
|
+
3000,AUD,Order32345,John Doe 3,4444333322221111,12/2020,,Gizmo ABC 3
|
4
|
+
4000,AUD,Order42345,John Doe 4,4444333322221111,12/2020,,Gizmo ABC 4
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FatZebra::APIResource do
|
4
|
+
|
5
|
+
describe '#request' do
|
6
|
+
subject(:resource) { FatZebra::APIResource.request(:post, '/test') }
|
7
|
+
|
8
|
+
context 'with errors' do
|
9
|
+
before { allow(FatZebra::Request).to receive(:execute).and_raise(FatZebra::RequestError.new(response)) }
|
10
|
+
|
11
|
+
context 'with Net::HTTPUnprocessableEntity' do
|
12
|
+
let(:response) { double('response', code: '422', code_type: Net::HTTPUnprocessableEntity, body: {}.to_json, message: 'failed') }
|
13
|
+
|
14
|
+
it { expect { resource }.to_not raise_error }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'with Net::HTTPBadRequest' do
|
18
|
+
let(:response) { double('response', code: '400', code_type: Net::HTTPBadRequest, body: {}.to_json, message: 'failed') }
|
19
|
+
|
20
|
+
it { expect { resource }.to raise_error(FatZebra::RequestError) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FatZebra::BankAccount do
|
4
|
+
|
5
|
+
let(:valid_bank_account_payload) {{
|
6
|
+
bsb: '123-123',
|
7
|
+
account_name: 'Test name',
|
8
|
+
account_number: '012345678'
|
9
|
+
}}
|
10
|
+
|
11
|
+
describe '.create', :vcr do
|
12
|
+
subject(:bank_account) { FatZebra::BankAccount.create(valid_bank_account_payload) }
|
13
|
+
|
14
|
+
it { is_expected.to be_accepted }
|
15
|
+
it { expect(bank_account.id).to_not be_empty }
|
16
|
+
|
17
|
+
context 'validations' do
|
18
|
+
let(:valid_bank_account_payload) {{}}
|
19
|
+
|
20
|
+
it { expect{ bank_account }.to raise_error(FatZebra::RequestValidationError) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.search', :vcr do
|
25
|
+
subject(:bank_accounts) { FatZebra::BankAccount.search }
|
26
|
+
|
27
|
+
before { 2.times { |i| FatZebra::BankAccount.create(valid_bank_account_payload) } }
|
28
|
+
|
29
|
+
it { is_expected.to be_accepted }
|
30
|
+
it { expect(bank_accounts.data.count).to be >= 2 }
|
31
|
+
it { expect(bank_accounts.data.first).to be_a(FatZebra::BankAccount) }
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FatZebra::Batch do
|
4
|
+
let(:batch_path) { "#{File.dirname(__FILE__)}/../../fixtures/batch_test.csv" }
|
5
|
+
|
6
|
+
let(:valid_batch_payload) {{
|
7
|
+
file: File.new(batch_path),
|
8
|
+
filename: "BATCH-v1-PURCHASE-TEST-#{Time.now.strftime('%Y%m%d')}-#{SecureRandom.hex}.csv"
|
9
|
+
}}
|
10
|
+
|
11
|
+
describe '.create', :vcr do
|
12
|
+
subject(:batch) { FatZebra::Batch.create(valid_batch_payload) }
|
13
|
+
|
14
|
+
context 'with file' do
|
15
|
+
it { is_expected.to be_accepted }
|
16
|
+
it { expect(batch.reference).to_not be_empty }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'with path' do
|
20
|
+
let(:valid_batch_payload) {{
|
21
|
+
path: batch_path,
|
22
|
+
filename: "BATCH-v1-PURCHASE-TEST-#{Time.now.strftime('%Y%m%d')}-#{SecureRandom.hex}.csv"
|
23
|
+
}}
|
24
|
+
|
25
|
+
it { is_expected.to be_accepted }
|
26
|
+
it { expect(batch.reference).to_not be_empty }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'validations' do
|
30
|
+
let(:valid_batch_payload) {{}}
|
31
|
+
|
32
|
+
it { expect{ batch }.to raise_error(FatZebra::RequestValidationError) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '.find', :vcr do
|
37
|
+
let(:create) { FatZebra::Batch.create(valid_batch_payload) }
|
38
|
+
subject(:batch) { FatZebra::Batch.find(create.reference) }
|
39
|
+
|
40
|
+
it { is_expected.to be_accepted }
|
41
|
+
it { expect(batch.reference).to eq(create.reference) }
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '.search', :vcr do
|
45
|
+
subject(:batches) { FatZebra::Batch.search }
|
46
|
+
|
47
|
+
it { is_expected.to be_accepted }
|
48
|
+
it { expect(batches.data.count).to be >= 2 }
|
49
|
+
it { expect(batches.data.first).to be_a(FatZebra::Batch) }
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#result', :vcr do
|
53
|
+
let(:create) { FatZebra::Batch.create(valid_batch_payload) }
|
54
|
+
let(:batch) { FatZebra::Batch.find(create.reference) }
|
55
|
+
|
56
|
+
it { expect(batch.result).to eq("Batch is not yet completed") }
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FatZebra::Card do
|
4
|
+
|
5
|
+
describe '.create', :vcr do
|
6
|
+
subject(:credit_card) { FatZebra::Card.create(valid_credit_card_payload) }
|
7
|
+
|
8
|
+
it { is_expected.to be_accepted }
|
9
|
+
it { expect(credit_card.token).to_not be_empty }
|
10
|
+
it { expect(credit_card.card_holder).to eq('Matthew Savage') }
|
11
|
+
it { expect(credit_card.card_number).to_not be_empty }
|
12
|
+
it { expect(credit_card.card_type).to eq('MasterCard') }
|
13
|
+
it { expect(credit_card.authorized?).to be_truthy }
|
14
|
+
|
15
|
+
context 'validations' do
|
16
|
+
let(:valid_credit_card_payload) {{}}
|
17
|
+
|
18
|
+
it { expect{ credit_card }.to raise_error(FatZebra::RequestValidationError) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.update', :vcr do
|
23
|
+
let(:valid_credit_card_update_payload) {{
|
24
|
+
card_expiry: DateTime.new(2050, 2, 3).strftime('%m/%Y'),
|
25
|
+
}}
|
26
|
+
|
27
|
+
let(:create) { FatZebra::Card.create(valid_credit_card_payload) }
|
28
|
+
subject(:credit_card) { FatZebra::Card.update(create.token, valid_credit_card_update_payload) }
|
29
|
+
|
30
|
+
it { is_expected.to be_accepted }
|
31
|
+
it { expect(credit_card.token).to eq(create.token) }
|
32
|
+
it { expect(credit_card.card_expiry).to_not eq(create.card_expiry) }
|
33
|
+
|
34
|
+
context 'validations' do
|
35
|
+
let(:valid_credit_card_update_payload) {{}}
|
36
|
+
|
37
|
+
it { expect{ credit_card }.to raise_error(FatZebra::RequestValidationError) }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FatZebra::Config do
|
4
|
+
let(:params) {{
|
5
|
+
token: 'my-token',
|
6
|
+
username: 'my-username'
|
7
|
+
}}
|
8
|
+
|
9
|
+
subject(:config) { FatZebra::Config.new(params) }
|
10
|
+
|
11
|
+
describe '#initialize' do
|
12
|
+
it { expect(config.valid!).to be_truthy }
|
13
|
+
it { expect(config.token).to eq(params[:token]) }
|
14
|
+
it { expect(config.username).to eq(params[:username]) }
|
15
|
+
it { expect(config.gateway).to eq('gateway.fatzebra.com.au') }
|
16
|
+
it { expect(config.test_mode).to be_falsey }
|
17
|
+
it { expect(config.http_secure).to be_truthy }
|
18
|
+
it { expect(config.api_version).to eq('v1.0') }
|
19
|
+
|
20
|
+
context 'with all params' do
|
21
|
+
let(:params) {{
|
22
|
+
token: 'my-token',
|
23
|
+
username: 'my-username',
|
24
|
+
gateway: 'my-gateway',
|
25
|
+
test_mode: 'my-test_mode',
|
26
|
+
http_secure: 'my-http_secure',
|
27
|
+
api_version: 'my-api_version',
|
28
|
+
proxy: 'my-proxy'
|
29
|
+
}}
|
30
|
+
|
31
|
+
it { expect(config.valid!).to be_truthy }
|
32
|
+
it { expect(config.gateway).to eq(params[:gateway]) }
|
33
|
+
it { expect(config.test_mode).to eq(params[:test_mode]) }
|
34
|
+
it { expect(config.http_secure).to eq(params[:http_secure]) }
|
35
|
+
it { expect(config.api_version).to eq(params[:api_version]) }
|
36
|
+
it { expect(config.proxy).to eq(params[:proxy]) }
|
37
|
+
end
|
38
|
+
|
39
|
+
%i[username token].each do |field|
|
40
|
+
context "validate #{field}" do
|
41
|
+
let(:params) {{ token: 'my-token', username: 'my-username' }.merge(field => '')}
|
42
|
+
|
43
|
+
it { expect { config.valid! }.to raise_error(FatZebra::ConfigurationError, "#{field} can't be blank") }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'with gateway' do
|
48
|
+
before { expect(config.valid!).to be_truthy }
|
49
|
+
|
50
|
+
context 'with production' do
|
51
|
+
subject(:config) { FatZebra::Config.new(params.merge(gateway: :production)) }
|
52
|
+
|
53
|
+
it { expect(config.gateway).to eq('gateway.fatzebra.com.au') }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'remove http' do
|
58
|
+
let(:params) {{
|
59
|
+
token: 'my-token',
|
60
|
+
username: 'my-username',
|
61
|
+
gateway: 'http://my-gateway',
|
62
|
+
proxy: 'https://my-proxy'
|
63
|
+
}}
|
64
|
+
|
65
|
+
it { expect(config.gateway).to eq('my-gateway') }
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FatZebra::Customer do
|
4
|
+
|
5
|
+
describe '.create', :vcr do
|
6
|
+
subject(:customer) { FatZebra::Customer.create(customer_valid_payload) }
|
7
|
+
|
8
|
+
it { is_expected.to be_accepted }
|
9
|
+
it { expect(customer.id).to_not be_empty }
|
10
|
+
it { expect(customer.first_name).to eq(customer_valid_payload[:first_name]) }
|
11
|
+
it { expect(customer.last_name).to eq(customer_valid_payload[:last_name]) }
|
12
|
+
it { expect(customer.card_token).to_not be_empty }
|
13
|
+
it { expect(customer.bank_account).to be_nil }
|
14
|
+
|
15
|
+
context 'validations' do
|
16
|
+
let(:customer_valid_payload) {{}}
|
17
|
+
|
18
|
+
it { expect{ customer }.to raise_error(FatZebra::RequestValidationError) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.search', :vcr do
|
23
|
+
subject(:purchases) { FatZebra::Customer.search }
|
24
|
+
|
25
|
+
it { is_expected.to be_accepted }
|
26
|
+
it { expect(purchases.data.count).to be >= 2 }
|
27
|
+
it { expect(purchases.data.first).to be_a(FatZebra::Customer) }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '.find', :vcr do
|
31
|
+
let!(:create) { FatZebra::Customer.create(customer_valid_payload) }
|
32
|
+
subject(:customer) { FatZebra::Customer.find(create.reference) }
|
33
|
+
|
34
|
+
it { is_expected.to be_accepted }
|
35
|
+
it { expect(customer.reference).to eq(create.reference) }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '.update', :vcr do
|
39
|
+
let(:create) { FatZebra::Customer.create(customer_valid_payload) }
|
40
|
+
subject(:customer) { FatZebra::Customer.update(create.id, first_name: 'New Name') }
|
41
|
+
|
42
|
+
it { is_expected.to be_accepted }
|
43
|
+
it { expect(customer.first_name).to eq('New Name') }
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '.delete', :vcr do
|
47
|
+
let(:create) { FatZebra::Customer.create(customer_valid_payload) }
|
48
|
+
subject(:customer) { FatZebra::Customer.delete(create.id) }
|
49
|
+
|
50
|
+
it { is_expected.to be_accepted }
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FatZebra::DirectCredit do
|
4
|
+
|
5
|
+
let(:valid_direct_credit_payload) {{
|
6
|
+
description: 'Confirmation',
|
7
|
+
amount: 42.0,
|
8
|
+
bsb: '123-123',
|
9
|
+
account_name: 'Test',
|
10
|
+
account_number: '012345678'
|
11
|
+
}}
|
12
|
+
|
13
|
+
describe '.create', :vcr do
|
14
|
+
subject(:direct_credit) { FatZebra::DirectCredit.create(valid_direct_credit_payload) }
|
15
|
+
|
16
|
+
it { is_expected.to be_accepted }
|
17
|
+
it { expect(direct_credit.bsb).to eq(valid_direct_credit_payload[:bsb]) }
|
18
|
+
it { expect(direct_credit.reference).to_not be_empty }
|
19
|
+
it { expect(direct_credit.id).to_not be_empty }
|
20
|
+
|
21
|
+
context 'validations' do
|
22
|
+
context 'valid' do
|
23
|
+
before { valid_direct_credit_payload[:amount] = 42.42 }
|
24
|
+
|
25
|
+
it { is_expected.to be_accepted }
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'failed' do
|
29
|
+
let(:valid_direct_credit_payload) {{}}
|
30
|
+
|
31
|
+
it { expect{ direct_credit }.to raise_error(FatZebra::RequestValidationError) }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'failed with non-float' do
|
35
|
+
let(:valid_direct_credit_payload) {{
|
36
|
+
description: 'Confirmation',
|
37
|
+
amount: 123,
|
38
|
+
bsb: '123-123',
|
39
|
+
account_name: 'Test',
|
40
|
+
account_number: '012345678'
|
41
|
+
}}
|
42
|
+
|
43
|
+
it { expect{ direct_credit }.to raise_error(FatZebra::RequestValidationError) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '.find', :vcr do
|
49
|
+
let!(:create) { FatZebra::DirectCredit.create(valid_direct_credit_payload) }
|
50
|
+
subject(:direct_credit) { FatZebra::DirectCredit.find(create.reference) }
|
51
|
+
|
52
|
+
it { is_expected.to be_accepted }
|
53
|
+
it { expect(direct_credit.reference).to eq(create.reference) }
|
54
|
+
it { expect(direct_credit.amount).to be_instance_of(Float) }
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '.search', :vcr do
|
58
|
+
let!(:start) { Time.now }
|
59
|
+
subject(:direct_credits) { FatZebra::DirectCredit.search }
|
60
|
+
|
61
|
+
before { 2.times { |i| FatZebra::DirectCredit.create(valid_direct_credit_payload) } }
|
62
|
+
|
63
|
+
it { is_expected.to be_accepted }
|
64
|
+
it { expect(direct_credits.data.count).to be >= 2 }
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '.delete', :vcr do
|
68
|
+
let(:create) { FatZebra::DirectCredit.create(valid_direct_credit_payload) }
|
69
|
+
subject(:direct_credit) { FatZebra::DirectCredit.delete(create.id) }
|
70
|
+
|
71
|
+
it { is_expected.to be_accepted }
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|