fat_zebra 3.1.0 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.travis.yml +2 -1
- data/README.md +5 -5
- data/fat_zebra.gemspec +4 -6
- data/lib/fat_zebra.rb +8 -0
- data/lib/fat_zebra/authenticate.rb +64 -0
- data/lib/fat_zebra/card.rb +1 -0
- data/lib/fat_zebra/paypal/authorization.rb +49 -0
- data/lib/fat_zebra/paypal/billing_agreement.rb +56 -0
- data/lib/fat_zebra/paypal/capture.rb +36 -0
- data/lib/fat_zebra/paypal/order.rb +22 -0
- data/lib/fat_zebra/paypal/refund.rb +22 -0
- data/lib/fat_zebra/purchase.rb +23 -0
- data/lib/fat_zebra/util.rb +1 -1
- data/lib/fat_zebra/version.rb +1 -1
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/validations/1_3_5_1.yml +46 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_challenge_response/1_3_3_1.yml +90 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_challenge_response/1_3_3_2.yml +90 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_frictionless_response/1_3_2_1.yml +90 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_frictionless_response/1_3_2_2.yml +90 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_invalid_input/1_3_1_1.yml +90 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_invalid_input/1_3_1_2.yml +87 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_invalid_input/1_3_1_3.yml +92 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_invalid_input/1_3_1_4.yml +91 -0
- data/spec/cassettes/FatZebra_Authenticate/_authenticate/with_type_validation/1_3_4_1.yml +46 -0
- data/spec/cassettes/FatZebra_Authenticate/_decode_session/when_token_is_invalid/returns_error_when_invalid_token.yml +47 -0
- data/spec/cassettes/FatZebra_Authenticate/_decode_session/when_token_is_valid/decodes_JWT.yml +87 -0
- data/spec/cassettes/FatZebra_Authenticate/_session/returns_JWT_with_given_params.yml +44 -0
- data/spec/cassettes/FatZebra_Authenticate/_session/returns_JWT_with_no_amount.yml +44 -0
- data/spec/cassettes/FatZebra_Authenticate/_session/returns_error_when_amount_is_invalid.yml +44 -0
- data/spec/cassettes/FatZebra_Authenticate/_session/returns_error_when_currency_is_invalid.yml +46 -0
- data/spec/cassettes/FatZebra_BankAccount/_create/1_1_1.yml +8 -14
- data/spec/cassettes/FatZebra_BankAccount/_create/1_1_2.yml +8 -14
- data/spec/cassettes/FatZebra_BankAccount/_search/1_2_1.yml +30 -30
- data/spec/cassettes/FatZebra_BankAccount/_search/1_2_2.yml +30 -30
- data/spec/cassettes/FatZebra_BankAccount/_search/1_2_3.yml +30 -30
- data/spec/cassettes/FatZebra_Batch/_create/with_file/1_1_1_1.yml +11 -17
- data/spec/cassettes/FatZebra_Batch/_create/with_file/1_1_1_2.yml +11 -17
- data/spec/cassettes/FatZebra_Batch/_create/with_path/1_1_2_1.yml +11 -17
- data/spec/cassettes/FatZebra_Batch/_create/with_path/1_1_2_2.yml +11 -17
- data/spec/cassettes/FatZebra_Batch/_find/1_2_1.yml +19 -31
- data/spec/cassettes/FatZebra_Batch/_find/1_2_2.yml +19 -31
- data/spec/cassettes/FatZebra_Batch/_result/1_4_1.yml +26 -44
- data/spec/cassettes/FatZebra_Batch/_search/1_3_1.yml +6 -6
- data/spec/cassettes/FatZebra_Batch/_search/1_3_2.yml +6 -6
- data/spec/cassettes/FatZebra_Batch/_search/1_3_3.yml +6 -6
- data/spec/cassettes/FatZebra_Card/_create/1_1_1.yml +7 -13
- data/spec/cassettes/FatZebra_Card/_create/1_1_2.yml +7 -13
- data/spec/cassettes/FatZebra_Card/_create/1_1_3.yml +7 -13
- data/spec/cassettes/FatZebra_Card/_create/1_1_4.yml +7 -13
- data/spec/cassettes/FatZebra_Card/_create/1_1_5.yml +7 -13
- data/spec/cassettes/FatZebra_Card/_create/1_1_6.yml +7 -13
- data/spec/cassettes/FatZebra_Card/_find/1_3_1.yml +111 -0
- data/spec/cassettes/FatZebra_Card/_find/1_3_2.yml +111 -0
- data/spec/cassettes/FatZebra_Card/_update/1_2_1.yml +15 -27
- data/spec/cassettes/FatZebra_Card/_update/1_2_2.yml +15 -27
- data/spec/cassettes/FatZebra_Card/_update/1_2_3.yml +15 -27
- data/spec/cassettes/FatZebra_Card/_update/validations/1_2_4_1.yml +7 -13
- data/spec/cassettes/FatZebra_Customer/_create/1_1_1.yml +9 -15
- data/spec/cassettes/FatZebra_Customer/_create/1_1_2.yml +9 -15
- data/spec/cassettes/FatZebra_Customer/_create/1_1_3.yml +9 -15
- data/spec/cassettes/FatZebra_Customer/_create/1_1_4.yml +9 -15
- data/spec/cassettes/FatZebra_Customer/_create/1_1_5.yml +9 -15
- data/spec/cassettes/FatZebra_Customer/_create/1_1_6.yml +9 -15
- data/spec/cassettes/FatZebra_Customer/_delete/1_5_1.yml +18 -30
- data/spec/cassettes/FatZebra_Customer/_find/1_3_1.yml +18 -30
- data/spec/cassettes/FatZebra_Customer/_find/1_3_2.yml +18 -30
- data/spec/cassettes/FatZebra_Customer/_search/1_2_1.yml +12 -16
- data/spec/cassettes/FatZebra_Customer/_search/1_2_2.yml +12 -16
- data/spec/cassettes/FatZebra_Customer/_search/1_2_3.yml +12 -16
- data/spec/cassettes/FatZebra_Customer/_update/1_4_1.yml +19 -31
- data/spec/cassettes/FatZebra_Customer/_update/1_4_2.yml +19 -31
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_1.yml +8 -14
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_2.yml +8 -14
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_3.yml +8 -14
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_4.yml +8 -14
- data/spec/cassettes/FatZebra_DirectCredit/_create/validations/valid/1_1_5_1_1.yml +7 -13
- data/spec/cassettes/FatZebra_DirectCredit/_delete/1_4_1.yml +16 -28
- data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_1.yml +16 -28
- data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_2.yml +16 -28
- data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_3.yml +13 -13
- data/spec/cassettes/FatZebra_DirectCredit/_search/1_3_1.yml +20 -20
- data/spec/cassettes/FatZebra_DirectCredit/_search/1_3_2.yml +20 -20
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_1.yml +8 -14
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_2.yml +8 -14
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_3.yml +8 -14
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_4.yml +8 -14
- data/spec/cassettes/FatZebra_DirectDebit/_create/validations/valid/1_1_5_1_1.yml +7 -13
- data/spec/cassettes/FatZebra_DirectDebit/_delete/1_4_1.yml +16 -28
- data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_1.yml +16 -28
- data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_2.yml +16 -28
- data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_3.yml +13 -13
- data/spec/cassettes/FatZebra_DirectDebit/_search/1_3_1.yml +20 -20
- data/spec/cassettes/FatZebra_DirectDebit/_search/1_3_2.yml +20 -20
- data/spec/cassettes/FatZebra_Information/_ping/1_1_1.yml +7 -13
- data/spec/cassettes/FatZebra_Information/_ping/1_1_2.yml +7 -13
- data/spec/cassettes/FatZebra_PaymentPlan/_active_/1_8_1.yml +48 -48
- data/spec/cassettes/FatZebra_PaymentPlan/_active_/1_8_2.yml +48 -48
- data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_1.yml +20 -20
- data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_2.yml +20 -20
- data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_3.yml +20 -20
- data/spec/cassettes/FatZebra_PaymentPlan/_delete/1_5_1.yml +28 -28
- data/spec/cassettes/FatZebra_PaymentPlan/_destroy/1_6_1.yml +28 -28
- data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_1.yml +32 -32
- data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_2.yml +32 -32
- data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_3.yml +32 -32
- data/spec/cassettes/FatZebra_PaymentPlan/_suspend_/1_7_1.yml +34 -34
- data/spec/cassettes/FatZebra_PaymentPlan/_suspend_/1_7_2.yml +34 -34
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_1.yml +28 -28
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_2.yml +28 -28
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_3.yml +28 -28
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_4_1.yml +34 -34
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_4_2.yml +34 -34
- data/spec/cassettes/FatZebra_Paypal_Authorization/_capture/returns_a_new_capture_record.yml +45 -0
- data/spec/cassettes/FatZebra_Paypal_Authorization/_find/when_found/returns_authorization.yml +46 -0
- data/spec/cassettes/FatZebra_Paypal_Authorization/_search/with_date_filter/returns_records_created_after_start_date.yml +46 -0
- data/spec/cassettes/FatZebra_Paypal_Authorization/_void/returns_a_voided_capture_record.yml +44 -0
- data/spec/cassettes/FatZebra_Paypal_BillingAgreement/_charge/Valid_payload/returns_a_new_order_record.yml +48 -0
- data/spec/cassettes/FatZebra_Paypal_BillingAgreement/_find/when_found/returns_billing_agreement.yml +48 -0
- data/spec/cassettes/FatZebra_Paypal_BillingAgreement/_search/with_date_filter/returns_records_created_after_start_date.yml +48 -0
- data/spec/cassettes/FatZebra_Paypal_Capture/_find/when_found/returns_capture.yml +47 -0
- data/spec/cassettes/FatZebra_Paypal_Capture/_refund/returns_a_new_refund_record.yml +45 -0
- data/spec/cassettes/FatZebra_Paypal_Capture/_search/with_date_filter/returns_records_created_after_start_date.yml +49 -0
- data/spec/cassettes/FatZebra_Paypal_Order/_find/when_found/returns_order.yml +48 -0
- data/spec/cassettes/FatZebra_Paypal_Order/_search/with_date_filter/returns_orders_created_after_start_date.yml +55 -0
- data/spec/cassettes/FatZebra_Paypal_Refund/_find/when_found/returns_refund.yml +47 -0
- data/spec/cassettes/FatZebra_Paypal_Refund/_search/with_date_filter/returns_all_refund_records_created_after_start_date.yml +50 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_1.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_10.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_11.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_12.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_13.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_2.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_3.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_4.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_5.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_6.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_7.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_8.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_9.yml +9 -15
- data/spec/cassettes/FatZebra_Purchase/_create/bad_request/1_1_14_1.yml +11 -17
- data/spec/cassettes/FatZebra_Purchase/_create/bad_request/1_1_14_2.yml +11 -17
- data/spec/cassettes/FatZebra_Purchase/_extend_/1_9_1.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_extend_/1_9_2.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_extend_/1_9_3.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_increment/1_10_1.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_increment/1_10_2.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_increment/1_10_3.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_increment/1_10_4.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_1.yml +18 -30
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_2.yml +18 -30
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_3.yml +18 -30
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_4.yml +18 -30
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_1.yml +18 -30
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_2.yml +18 -30
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_3.yml +18 -30
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_4.yml +18 -30
- data/spec/cassettes/FatZebra_Refund/_create/1_1_1.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_10.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_2.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_3.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_4.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_5.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_6.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_7.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_8.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_create/1_1_9.yml +16 -16
- data/spec/cassettes/FatZebra_Refund/_find/1_2_1.yml +24 -24
- data/spec/cassettes/FatZebra_Refund/_find/1_2_2.yml +24 -24
- data/spec/cassettes/FatZebra_Refund/_find/1_2_3.yml +24 -24
- data/spec/cassettes/FatZebra_Refund/_search/responds_with_the_newly-created_refunds.yml +40 -40
- data/spec/cassettes/FatZebra_Refund/_void/1_4_1.yml +24 -24
- data/spec/cassettes/FatZebra_Refund/_void/1_4_2.yml +24 -24
- data/spec/cassettes/FatZebra_Refund/_void/1_4_3.yml +24 -24
- data/spec/cassettes/FatZebra_Refund/_void/1_4_4.yml +24 -24
- data/spec/cassettes/FatZebra_WebHook/_create/1_1_1.yml +7 -13
- data/spec/cassettes/FatZebra_WebHook/_create/1_1_2.yml +7 -13
- data/spec/cassettes/FatZebra_WebHook/_create/1_1_3.yml +7 -13
- data/spec/cassettes/FatZebra_WebHook/_delete/1_4_1.yml +15 -27
- data/spec/cassettes/FatZebra_WebHook/_search/1_2_1.yml +160 -133
- data/spec/cassettes/FatZebra_WebHook/_search/1_2_2.yml +162 -135
- data/spec/cassettes/FatZebra_WebHook/_update/1_3_1.yml +15 -27
- data/spec/cassettes/FatZebra_WebHook/_update/1_3_2.yml +15 -27
- data/spec/lib/fat_zebra/authenticate_spec.rb +187 -0
- data/spec/lib/fat_zebra/card_spec.rb +8 -0
- data/spec/lib/fat_zebra/paypal/authorization_spec.rb +79 -0
- data/spec/lib/fat_zebra/paypal/billing_agreement_spec.rb +62 -0
- data/spec/lib/fat_zebra/paypal/capture_spec.rb +60 -0
- data/spec/lib/fat_zebra/paypal/order_spec.rb +35 -0
- data/spec/lib/fat_zebra/paypal/refund_spec.rb +36 -0
- data/spec/lib/fat_zebra/purchase_spec.rb +21 -3
- data/spec/lib/fat_zebra/refund_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/support/payloads.rb +135 -0
- metadata +61 -12
- data/spec/cassettes/FatZebra_DirectDebit/_create/validations/failed_with_non-float/1_1_5_3_1.yml +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ce036c9eb7ff13fb1c6f60e6b0e4230299ccdb3384e4359959426d75c9a8e42b
|
4
|
+
data.tar.gz: b55070ec65cbbad8c82ed8974c572dc0cc9eae5d38b3d49a0446dd91febc1570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 741c6e12a74bc6f05de8b1b04794476dd3dd1c711db11e093ccba35768e753657c5289d8151458140f8e582f971eb0d0876bd9240151df6ba97ac12b577f8e16
|
7
|
+
data.tar.gz: 9aee0585dd4f0addde3fbf1ce4408a8905ccf2c336994a9a46d4fd7b2dd6a0d11d1bf9b1c6a33af4f6148b790cfe097de5739f645395a269c684e34cc6e18b96
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -3,14 +3,14 @@ Ruby API Library for Fat Zebra
|
|
3
3
|
|
4
4
|
[![Build Status](https://travis-ci.org/fatzebra/Ruby-Library.svg?branch=master)](https://travis-ci.org/fatzebra/Ruby-Library)
|
5
5
|
|
6
|
-
Release 3.
|
6
|
+
Release 3.2.3 for API version 1.0
|
7
7
|
|
8
|
-
A Ruby client for the [Fat Zebra](https://www.fatzebra.com
|
8
|
+
A Ruby client for the [Fat Zebra](https://www.fatzebra.com) Online Payment Gateway
|
9
9
|
|
10
10
|
Dependencies
|
11
11
|
------------
|
12
12
|
|
13
|
-
* Ruby (tested on 2.
|
13
|
+
* Ruby (tested on 2.3, 2.4, 2.5, 2.6)
|
14
14
|
* Rest Client
|
15
15
|
|
16
16
|
Installing
|
@@ -54,11 +54,11 @@ end
|
|
54
54
|
Documentation
|
55
55
|
-------------
|
56
56
|
|
57
|
-
Full API reference can be found at http://docs.fatzebra.com
|
57
|
+
Full API reference can be found at http://docs.fatzebra.com
|
58
58
|
|
59
59
|
Support
|
60
60
|
-------
|
61
|
-
If you have any issue with the Fat Zebra Ruby Client please contact us at support@fatzebra.com
|
61
|
+
If you have any issue with the Fat Zebra Ruby Client please contact us at support@fatzebra.com and we will be more then happy to help out. Alternatively you may raise an issue in github.
|
62
62
|
|
63
63
|
Pull Requests
|
64
64
|
-------------
|
data/fat_zebra.gemspec
CHANGED
@@ -6,19 +6,17 @@ require 'fat_zebra/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'fat_zebra'
|
8
8
|
s.version = FatZebra::VERSION
|
9
|
-
s.authors = ['
|
10
|
-
s.email = ['
|
9
|
+
s.authors = ['Fat Zebra']
|
10
|
+
s.email = ['support@fatzebra.com']
|
11
11
|
s.homepage = ''
|
12
12
|
s.summary = 'Fat Zebra payments gem - integrate your ruby app with Fat Zebra'
|
13
|
-
s.description = 'Provides integration with the Fat Zebra internet payment gateway (www.fatzebra.com
|
14
|
-
|
15
|
-
s.rubyforge_project = 'fat_zebra'
|
13
|
+
s.description = 'Provides integration with the Fat Zebra internet payment gateway (www.fatzebra.com), including purchase, refund, auth, capture and recurring billing functionality.'
|
16
14
|
|
17
15
|
s.files = `git ls-files`.split("\n")
|
18
16
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
19
17
|
s.require_paths = %w[lib]
|
20
18
|
|
21
|
-
s.add_development_dependency '
|
19
|
+
s.add_development_dependency 'byebug'
|
22
20
|
s.add_development_dependency 'rake'
|
23
21
|
s.add_development_dependency 'rspec', '~> 3.6'
|
24
22
|
s.add_development_dependency 'rubocop', '~> 0.58.1'
|
data/lib/fat_zebra.rb
CHANGED
@@ -28,6 +28,7 @@ require 'fat_zebra/api_operation/void'
|
|
28
28
|
require 'fat_zebra/purchase'
|
29
29
|
require 'fat_zebra/information'
|
30
30
|
require 'fat_zebra/card'
|
31
|
+
require 'fat_zebra/authenticate'
|
31
32
|
require 'fat_zebra/refund'
|
32
33
|
require 'fat_zebra/payment_plan'
|
33
34
|
require 'fat_zebra/customer'
|
@@ -37,6 +38,13 @@ require 'fat_zebra/bank_account'
|
|
37
38
|
require 'fat_zebra/web_hook'
|
38
39
|
require 'fat_zebra/batch'
|
39
40
|
|
41
|
+
# Paypal API Resources
|
42
|
+
require 'fat_zebra/paypal/billing_agreement'
|
43
|
+
require 'fat_zebra/paypal/order'
|
44
|
+
require 'fat_zebra/paypal/authorization'
|
45
|
+
require 'fat_zebra/paypal/capture'
|
46
|
+
require 'fat_zebra/paypal/refund'
|
47
|
+
|
40
48
|
##
|
41
49
|
# Implementation of the FatZebra
|
42
50
|
module FatZebra
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module FatZebra
|
2
|
+
##
|
3
|
+
# == FatZebra \Authenticate
|
4
|
+
#
|
5
|
+
# Manage 3DS2/SCA authentication for the API
|
6
|
+
#
|
7
|
+
# * session
|
8
|
+
# * authenticate
|
9
|
+
# * decode_session
|
10
|
+
#
|
11
|
+
class Authenticate < APIResource
|
12
|
+
@resource_name = 'authenticate'
|
13
|
+
|
14
|
+
validates :card_token, required: true, on: :authenticate
|
15
|
+
validates :sca, required: true, on: :authenticate
|
16
|
+
validates :token, required: true, on: :decode_session
|
17
|
+
|
18
|
+
class << self
|
19
|
+
|
20
|
+
##
|
21
|
+
# Returns a JWT token for the 3DS authentication process
|
22
|
+
#
|
23
|
+
# @param [Hash] params
|
24
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
25
|
+
#
|
26
|
+
# @return [FatZebra::Authenticate]
|
27
|
+
def session(params = {}, options = {})
|
28
|
+
valid!(params, :session) if respond_to?(:valid!)
|
29
|
+
|
30
|
+
response = request(:post, "#{resource_path}/session", params, options)
|
31
|
+
initialize_from(response)
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Decodes a JWT token for the 3DS authentication process
|
36
|
+
#
|
37
|
+
# @param [Hash] params
|
38
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
39
|
+
#
|
40
|
+
# @return [FatZebra::Authenticate]
|
41
|
+
def decode_session(params = {}, options = {})
|
42
|
+
valid!(params, :decode_session) if respond_to?(:valid!)
|
43
|
+
|
44
|
+
response = request(:get, "#{resource_path}/decode_session", params, options)
|
45
|
+
initialize_from(response)
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Authenticates a 3ds request
|
50
|
+
#
|
51
|
+
# @param [Hash] params
|
52
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
53
|
+
#
|
54
|
+
# @return [FatZebra::Authenticate]
|
55
|
+
def authenticate(params = {}, options = {})
|
56
|
+
valid!(params, :authenticate) if respond_to?(:valid!)
|
57
|
+
|
58
|
+
response = request(:post, resource_path, params, options)
|
59
|
+
initialize_from(response)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
data/lib/fat_zebra/card.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
module FatZebra
|
2
|
+
##
|
3
|
+
# == FatZebra \Paypal::Authorization
|
4
|
+
#
|
5
|
+
# Manage PayPal Authorizations
|
6
|
+
#
|
7
|
+
# * search
|
8
|
+
# * find
|
9
|
+
# * capture
|
10
|
+
# * void
|
11
|
+
#
|
12
|
+
module Paypal
|
13
|
+
class Authorization < APIResource
|
14
|
+
include FatZebra::APIOperation::Find
|
15
|
+
include FatZebra::APIOperation::Search
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def base_path
|
19
|
+
super + '/paypal/'
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# Capture a PayPal Authorization
|
24
|
+
#
|
25
|
+
# @param [String] Authorization id
|
26
|
+
# @param [Hash] params (amount, final_capture, note_to_payer)
|
27
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
28
|
+
#
|
29
|
+
# @return [FatZebra::Paypal::Capture]
|
30
|
+
def capture(id, params = {}, options = {})
|
31
|
+
response = request(:post, resource_path("authorizations/#{id}/capture"), params, options)
|
32
|
+
FatZebra::Paypal::Capture.initialize_from(response)
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Void a PayPal Authorization
|
37
|
+
#
|
38
|
+
# @param [String] Authorization id
|
39
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
40
|
+
#
|
41
|
+
# @return [FatZebra::Authorization]
|
42
|
+
def void(id, options = {})
|
43
|
+
response = request(:post, resource_path("authorizations/#{id}/void"), {}, options)
|
44
|
+
initialize_from(response)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module FatZebra
|
2
|
+
##
|
3
|
+
# == FatZebra \Paypal::BillingAgreement
|
4
|
+
#
|
5
|
+
# Manage PayPal Billing Agreements
|
6
|
+
#
|
7
|
+
# * search
|
8
|
+
# * find
|
9
|
+
# * charge
|
10
|
+
# * cancel
|
11
|
+
#
|
12
|
+
module Paypal
|
13
|
+
class BillingAgreement < APIResource
|
14
|
+
include FatZebra::APIOperation::Find
|
15
|
+
include FatZebra::APIOperation::Search
|
16
|
+
|
17
|
+
validates :purchases, required: true, on: :charge
|
18
|
+
validates :amount, required: true, on: :charge
|
19
|
+
validates :currency, required: true, on: :charge
|
20
|
+
validates :reference, required: true, on: :charge
|
21
|
+
|
22
|
+
class << self
|
23
|
+
def base_path
|
24
|
+
super + '/paypal/'
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Charge a PayPal Billing Agreement
|
29
|
+
#
|
30
|
+
# @param [String] Billing Agreement id
|
31
|
+
# @param [Hash] params (currency, reference, amount, purchases)
|
32
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
33
|
+
#
|
34
|
+
# @return [FatZebra::Paypal::Order]
|
35
|
+
def charge(id, params, options = {})
|
36
|
+
valid!(params, :charge) if respond_to?(:valid!)
|
37
|
+
|
38
|
+
response = request(:post, resource_path("billing_agreements/#{id}/charge"), params, options)
|
39
|
+
FatZebra::Paypal::Order.initialize_from(response)
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Cancel a PayPal Billing Agreement
|
44
|
+
#
|
45
|
+
# @param [String] Billing Agreement id
|
46
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
47
|
+
#
|
48
|
+
# @return [FatZebra::BillingAgreement]
|
49
|
+
def cancel(id, options = {})
|
50
|
+
response = request(:post, resource_path("billing_agreements/#{id}/cancel"), {}, options)
|
51
|
+
initialize_from(response)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module FatZebra
|
2
|
+
##
|
3
|
+
# == FatZebra \Paypal::Capture
|
4
|
+
#
|
5
|
+
# Manage PayPal Captures
|
6
|
+
#
|
7
|
+
# * search
|
8
|
+
# * find
|
9
|
+
# * refund
|
10
|
+
#
|
11
|
+
module Paypal
|
12
|
+
class Capture < APIResource
|
13
|
+
include FatZebra::APIOperation::Find
|
14
|
+
include FatZebra::APIOperation::Search
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def base_path
|
18
|
+
super + '/paypal/'
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# Refund a PayPal Capture
|
23
|
+
#
|
24
|
+
# @param [String] Capture id
|
25
|
+
# @param [Hash] params (amount, note_to_payer)
|
26
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
27
|
+
#
|
28
|
+
# @return [FatZebra::Paypal::Refund]
|
29
|
+
def refund(id, params = {}, options = {})
|
30
|
+
response = request(:post, resource_path("captures/#{id}/refund"), params, options)
|
31
|
+
FatZebra::Paypal::Refund.initialize_from(response)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module FatZebra
|
2
|
+
##
|
3
|
+
# == FatZebra \Paypal::Order
|
4
|
+
#
|
5
|
+
# Manage PayPal Orders
|
6
|
+
#
|
7
|
+
# * search
|
8
|
+
# * find
|
9
|
+
#
|
10
|
+
module Paypal
|
11
|
+
class Order < APIResource
|
12
|
+
include FatZebra::APIOperation::Find
|
13
|
+
include FatZebra::APIOperation::Search
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def base_path
|
17
|
+
super + '/paypal/'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module FatZebra
|
2
|
+
##
|
3
|
+
# == FatZebra \Paypal::Refund
|
4
|
+
#
|
5
|
+
# Manage PayPal Refunds
|
6
|
+
#
|
7
|
+
# * search
|
8
|
+
# * find
|
9
|
+
#
|
10
|
+
module Paypal
|
11
|
+
class Refund < APIResource
|
12
|
+
include FatZebra::APIOperation::Find
|
13
|
+
include FatZebra::APIOperation::Search
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def base_path
|
17
|
+
super + '/paypal/'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/fat_zebra/purchase.rb
CHANGED
@@ -92,5 +92,28 @@ module FatZebra
|
|
92
92
|
update_from(response)
|
93
93
|
end
|
94
94
|
|
95
|
+
##
|
96
|
+
# Extends an authorization expiry (if not already expired)
|
97
|
+
#
|
98
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
99
|
+
#
|
100
|
+
# @return [Response] Purchase response object
|
101
|
+
def extend!(options = {})
|
102
|
+
response = request(:put, resource_path("purchases/#{id}"), { extend: true }, options)
|
103
|
+
update_from(response)
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# Increments an authorization amount
|
108
|
+
#
|
109
|
+
# @param [Int] amount to increment the authorization by
|
110
|
+
# @param [Hash] options for the request, and configurations (Optional)
|
111
|
+
#
|
112
|
+
# @return [Response] Purchase response object
|
113
|
+
def increment!(additional_amount, options = {})
|
114
|
+
raise ArgumentError, 'Amount must be a positive amount' unless additional_amount > 0
|
115
|
+
response = request(:put, resource_path("purchases/#{id}"), { amount: amount + additional_amount }, options)
|
116
|
+
update_from(response)
|
117
|
+
end
|
95
118
|
end
|
96
119
|
end
|
data/lib/fat_zebra/util.rb
CHANGED
data/lib/fat_zebra/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://gateway.sandbox.fatzebra.com.au/v1.0/credit_cards
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"card_holder":"Matthew Savage","card_number":"5123456789012346","card_expiry":"02/2030","cvv":123,"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: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Cache-Control:
|
26
|
+
- no-store
|
27
|
+
Pragma:
|
28
|
+
- no-cache
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
X-Request-Version:
|
32
|
+
- 1.21.8
|
33
|
+
X-Request-Id:
|
34
|
+
- f7428654f99c8a3fbf1ed11296c3c3ea
|
35
|
+
X-Runtime:
|
36
|
+
- '0.273223'
|
37
|
+
Transfer-Encoding:
|
38
|
+
- chunked
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"successful":true,"response":{"token":"bybox0zptr3u8xuvtu7n","card_holder":"Matthew
|
42
|
+
Savage","card_number":"512345XXXXXX2346","card_expiry":"2030-02-28","card_type":"MasterCard","card_category":"Credit","card_subcategory":"Standard","card_issuer":"Banco
|
43
|
+
Del Pichincha, C.A.","card_country":"Ecuador","authorized":true,"transaction_count":0,"alias":null},"errors":[],"test":true}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Fri, 13 Dec 2019 03:37:01 GMT
|
46
|
+
recorded_with: VCR 3.0.3
|