affirm-ruby-api 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +17 -0
- data/lib/affirm/client.rb +0 -1
- data/lib/affirm/testing_support/fixtures.http/404_not_found.http +12 -0
- data/lib/affirm/testing_support/fixtures.http/authentication_failed.http +16 -0
- data/lib/affirm/testing_support/fixtures.http/authorize/already_authorized.http +19 -0
- data/lib/affirm/testing_support/fixtures.http/authorize/success.http +36 -0
- data/lib/affirm/testing_support/fixtures.http/capture/already_captured.http +18 -0
- data/lib/affirm/testing_support/fixtures.http/capture/success.http +23 -0
- data/lib/affirm/testing_support/fixtures.http/checkout_direct/success.http +22 -0
- data/lib/affirm/testing_support/fixtures.http/checkout_store/success.http +22 -0
- data/lib/affirm/testing_support/fixtures.http/get_checkout/success.http +112 -0
- data/lib/affirm/testing_support/fixtures.http/get_checkout/success_direct.http +112 -0
- data/lib/affirm/testing_support/fixtures.http/get_transaction/success.http +28 -0
- data/lib/affirm/testing_support/fixtures.http/get_transaction/success_captured.http +28 -0
- data/lib/affirm/testing_support/fixtures.http/get_transaction/success_with_multiple_events.http +47 -0
- data/lib/affirm/testing_support/fixtures.http/refund/already_voided.http +19 -0
- data/lib/affirm/testing_support/fixtures.http/refund/not_captured_yet.http +18 -0
- data/lib/affirm/testing_support/fixtures.http/refund/partially_refund_success.http +23 -0
- data/lib/affirm/testing_support/fixtures.http/refund/success.http +23 -0
- data/lib/affirm/testing_support/fixtures.http/void/already_captured.http +18 -0
- data/lib/affirm/testing_support/fixtures.http/void/not_authorized.http +19 -0
- data/lib/affirm/testing_support/fixtures.http/void/success.http +21 -0
- data/lib/affirm/testing_support/fixtures.json/authorize_transaction.json +1 -0
- data/lib/affirm/testing_support/fixtures.json/create_checkout_payload.json +58 -0
- data/lib/affirm/testing_support/fixtures.json/partially_refund.json +1 -0
- data/lib/affirm/testing_support/http_responses.rb +28 -0
- data/lib/affirm/version.rb +1 -1
- metadata +26 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb476ada854f87754b3a17dc7cae3935e129ac62dd6be452d3244e9ee4c76f6b
|
4
|
+
data.tar.gz: ba20fd676d408cc39fdbf1a9efc3822a21f00d393bfe4ceb145ecc59face5008
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0710a8d0d937dde6ba98f1e8ac54a37dd411536ed4afd1d016ec7e44a9b8a19eeaed37d48f9b9e2ef0e94e9fff649b7a71b8f4cda9ca6d7ecbd1c4db3aca913
|
7
|
+
data.tar.gz: ec5e34418e3e2f873dcc275f741637d00aed6aedb61a62a0ef5255163fb65b378b48621afdec14d61634ade576d0a160d64c53a58aa2f50b5da8d5164ce3e038
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
|
6
|
+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- Introduce `TestingSupport::HttpResponses` for sharing the http and JSON fixtures
|
12
|
+
so we can share these in environments that use this gem.
|
13
|
+
|
14
|
+
## [1.0.0] - 2020-04-13
|
15
|
+
|
16
|
+
Initial release.
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Affirm Ruby
|
2
2
|
|
3
3
|
![Run Tests](https://github.com/peterberkenbosch/affirm-ruby-api/workflows/Run%20Tests/badge.svg)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/affirm-ruby-api.svg)](https://badge.fury.io/rb/affirm-ruby-api)
|
4
5
|
|
5
6
|
Implements the Affirm api using just Ruby. [Affirm documentation](https://docs.affirm.com/affirm-developers/reference)
|
6
7
|
|
@@ -31,6 +32,22 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
31
32
|
|
32
33
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
34
|
|
35
|
+
### Testing support
|
36
|
+
|
37
|
+
When implementing this gem into your application or other gem, you can reuse the JSON and HTTP payloads and responses. For example with RSpec you can add the following to your `spec_helper.rb` file:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
require "affirm/testing_support/http_responses"
|
41
|
+
|
42
|
+
RSpec.configure do |config|
|
43
|
+
config.include Affirm::TestingSupport::HttpResponses
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
this will provide you with the `read_http_fixture` and `read_json_fixture` methods. These can be used to mock the responses and payload body's with `WebMock`.
|
48
|
+
|
49
|
+
For details on how to use this, take a look at the usage in the spec files here.
|
50
|
+
|
34
51
|
## Contributing
|
35
52
|
|
36
53
|
Bug reports and pull requests are welcome on GitHub at https://github.com/peterberkenbosch/affirm-ruby-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/peterberkenbosch/affirm-ruby-api/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/affirm/client.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
HTTP/1.1 404 Not Found
|
2
|
+
Connection: keep-alive
|
3
|
+
Content-Type: application/xml
|
4
|
+
Date: Mon, 30 Mar 2020 15:57:39 GMT
|
5
|
+
Server: openresty
|
6
|
+
Transfer-Encoding: chunked
|
7
|
+
X-Affirm-Cache-Status: MISS
|
8
|
+
X-Affirm-Request-Id: fdf161fb-aa06-46ea-c652-d97fd0d0b7df
|
9
|
+
cache-control: max-age=600
|
10
|
+
|
11
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
12
|
+
<Error><Code>InvalidArgument</Code><Message>Unsupported Authorization Type</Message><ArgumentName>Authorization</ArgumentName><ArgumentValue>Basic MkJHNUhFN1pZVDJWWTFHSDp2RGNFUk55Q2VWckZiMk9XZmVGcEFvdzdnb3hqcmI1VA==</ArgumentValue><RequestId>1EF5E75D651A04A4</RequestId><HostId>5qt2zCGaOOVVEcfoXok1ZhkG8x1OwI1uOOqzpHLqC1P9NjhkFVnc/OCIk4kggJ6/FJJe5BQnjno=</HostId></Error>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
HTTP/1.1 401 UNAUTHORIZED
|
2
|
+
Connection: keep-alive
|
3
|
+
Content-Type: application/json
|
4
|
+
Date: Mon, 30 Mar 2020 15:42:37 GMT
|
5
|
+
Server: openresty
|
6
|
+
Set-Cookie: tracker_device=4c3ba276-ede7-4738-95dc-dde36c5582b6; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 15:42:37 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
7
|
+
Set-Cookie: 3060738.3440491=4c3ba276-ede7-4738-95dc-dde36c5582b6; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 15:42:37 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
8
|
+
X-Affirm-Request-Id: 04628f6d-af62-4411-c40b-ea900ea4aa1b
|
9
|
+
cache-control: private, no-cache, no-store, must-revalidate
|
10
|
+
|
11
|
+
{
|
12
|
+
"code": "api-key-pair-invalid",
|
13
|
+
"message": "You have provided an invalid API key pair.",
|
14
|
+
"status_code": 401,
|
15
|
+
"type": "unauthorized"
|
16
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
HTTP/1.1 403 FORBIDDEN
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 11:49:30 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=0c38b21c-3523-4ef4-885b-8fa3d72bba5c; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 11:49:30 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=0c38b21c-3523-4ef4-885b-8fa3d72bba5c; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 11:49:30 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IlAwOE5XVDNaODRQNThHWlMifQ.EXXjSg.WBcGAi_wSjta-MAUhHvSp1RnZjg; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Transfer-Encoding: chunked
|
12
|
+
Vary: Accept-Encoding
|
13
|
+
X-Affirm-Request-Id: fc58e45e-c790-416a-c1d0-f43392081800
|
14
|
+
|
15
|
+
{
|
16
|
+
"message": "The transaction has already been authorized.",
|
17
|
+
"status_code": 403,
|
18
|
+
"type": "already_authorized"
|
19
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 30 Mar 2020 12:55:39 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=a8e825ed-e3f6-41d1-ac86-ceb9405d4a6b; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 12:55:39 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=a8e825ed-e3f6-41d1-ac86-ceb9405d4a6b; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 12:55:39 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IlAwOE5XVDNaODRQNThHWlMifQ.EWN9yw.Sdv9NcDuWsIysjpShYJ6MM05axo; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Strict-Transport-Security: max-age=86400
|
12
|
+
Transfer-Encoding: chunked
|
13
|
+
Vary: Accept-Encoding
|
14
|
+
X-Affirm-Request-Id: c0a5b2d7-032b-4741-c783-0c0f31ab9b87
|
15
|
+
|
16
|
+
{
|
17
|
+
"amount": 25000,
|
18
|
+
"amount_refunded": 0,
|
19
|
+
"authorization_expiration": "2020-04-29T12:55:39Z",
|
20
|
+
"checkout_id": "P08NWT3Z84P58GZS",
|
21
|
+
"created": "2020-03-30T12:36:17Z",
|
22
|
+
"currency": "USD",
|
23
|
+
"events": [
|
24
|
+
{
|
25
|
+
"amount": 25000,
|
26
|
+
"created": "2020-03-30T12:55:39Z",
|
27
|
+
"currency": "USD",
|
28
|
+
"id": "8FKXAQSHIIGU4I3F",
|
29
|
+
"type": "auth"
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"id": "DVEP-FTQO",
|
33
|
+
"order_id": "R637017534",
|
34
|
+
"provider_id": 1,
|
35
|
+
"status": "authorized"
|
36
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
HTTP/1.1 403 FORBIDDEN
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 30 Mar 2020 13:53:28 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=776bb326-53c1-4809-be05-dd5848dafd1a; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 13:53:28 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=776bb326-53c1-4809-be05-dd5848dafd1a; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 13:53:28 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Transfer-Encoding: chunked
|
11
|
+
Vary: Accept-Encoding
|
12
|
+
X-Affirm-Request-Id: a4ee0648-089c-45a3-c5e9-841c7bdde1b6
|
13
|
+
|
14
|
+
{
|
15
|
+
"message": "The transaction has already been captured.",
|
16
|
+
"status_code": 403,
|
17
|
+
"type": "already_captured"
|
18
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 30 Mar 2020 13:11:57 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=0df1f7ab-de81-4a43-a717-c376e955a88b; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 13:11:57 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=0df1f7ab-de81-4a43-a717-c376e955a88b; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 13:11:57 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IkRWRVAtRlRRTyJ9.EWOBnQ.-fvyPIIwGG8iqmgHGUtme-u37sE; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Strict-Transport-Security: max-age=86400
|
12
|
+
Transfer-Encoding: chunked
|
13
|
+
Vary: Accept-Encoding
|
14
|
+
X-Affirm-Request-Id: 94dcbe1d-bebc-4c14-ccb6-fbb42dd9e5ce
|
15
|
+
|
16
|
+
{
|
17
|
+
"amount": 25000,
|
18
|
+
"created": "2020-03-30T13:11:57Z",
|
19
|
+
"currency": "USD",
|
20
|
+
"fee": 0,
|
21
|
+
"id": "U4ABBRQG5M01JDZ6",
|
22
|
+
"type": "capture"
|
23
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Access-Control-Allow-Credentials: true
|
3
|
+
Access-Control-Allow-Headers: Accept, Content-Type, X-Requested-With
|
4
|
+
Access-Control-Allow-Methods: POST, OPTIONS
|
5
|
+
Access-Control-Allow-Origin: None
|
6
|
+
Access-Control-Max-Age: 86400
|
7
|
+
Connection: keep-alive
|
8
|
+
Content-Type: application/json
|
9
|
+
Date: Mon, 30 Mar 2020 11:04:40 GMT
|
10
|
+
Server: openresty
|
11
|
+
Set-Cookie: tracker_device=e35f439d-f1e6-441f-9c43-073c3b3f6c7a; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 11:04:40 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
12
|
+
Set-Cookie: 3060738.3440491=e35f439d-f1e6-441f-9c43-073c3b3f6c7a; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 11:04:40 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
13
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6Ik9MQlFaNjExVUJCQ0RaMjgifQ.EWNjyA.BbrjmVSGZhJOqzT8Bk_Y-HXvdvI; Secure; HttpOnly; Path=/; SameSite=None
|
14
|
+
Strict-Transport-Security: max-age=86400
|
15
|
+
Vary: Origin
|
16
|
+
X-Affirm-Request-Id: 4a093a27-a7e9-4b8d-cb5b-dbcd02aa24a6
|
17
|
+
cache-control: private, no-cache, no-store, must-revalidate
|
18
|
+
|
19
|
+
{
|
20
|
+
"checkout_id": "OLBQZ611UBBCDZ28",
|
21
|
+
"redirect_url": "https://sandbox.affirm.com/checkout/2BG5HE7ZYT2VY1GH/new/OLBQZ611UBBCDZ28/"
|
22
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Access-Control-Allow-Credentials: true
|
3
|
+
Access-Control-Allow-Headers: Accept, Content-Type, X-Requested-With
|
4
|
+
Access-Control-Allow-Methods: POST, OPTIONS
|
5
|
+
Access-Control-Allow-Origin: None
|
6
|
+
Access-Control-Max-Age: 86400
|
7
|
+
Connection: keep-alive
|
8
|
+
Content-Type: application/json
|
9
|
+
Date: Fri, 27 Mar 2020 23:57:03 GMT
|
10
|
+
Server: openresty
|
11
|
+
Set-Cookie: tracker_device=bf9174e7-b02c-4e15-84cb-743a0c4c3147; Domain=.affirm.com; Expires=Sun, 27-Mar-2022 23:57:03 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
12
|
+
Set-Cookie: 3060738.3440491=bf9174e7-b02c-4e15-84cb-743a0c4c3147; Domain=.affirm.com; Expires=Sun, 27-Mar-2022 23:57:03 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
13
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IkhFWVI2VENWNFZCWDZOUE0ifQ.EWAkTw.V1GOXBncxzjTxkx-XMQWVqM_RfQ; Secure; HttpOnly; Path=/; SameSite=None
|
14
|
+
Strict-Transport-Security: max-age=86400
|
15
|
+
Vary: Origin
|
16
|
+
X-Affirm-Request-Id: e4f0a08f-6464-4b4a-cb39-a5676ef1153c
|
17
|
+
cache-control: private, no-cache, no-store, must-revalidate
|
18
|
+
|
19
|
+
{
|
20
|
+
"checkout_id": "HEYR6TCV4VBX6NPM",
|
21
|
+
"redirect_url": "https://sandbox.affirm.com/checkout/2BG5HE7ZYT2VY1GH/new/HEYR6TCV4VBX6NPM/"
|
22
|
+
}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Connection: keep-alive
|
3
|
+
Content-Type: application/json
|
4
|
+
Date: Sat, 28 Mar 2020 15:20:41 GMT
|
5
|
+
Server: openresty
|
6
|
+
Set-Cookie: tracker_device=bc20f05a-d821-4570-8cc3-5dff10b68bae; Domain=.affirm.com; Expires=Mon, 28-Mar-2022 15:20:41 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
7
|
+
Set-Cookie: 3060738.3440491=bc20f05a-d821-4570-8cc3-5dff10b68bae; Domain=.affirm.com; Expires=Mon, 28-Mar-2022 15:20:41 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
8
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IkhFWVI2VENWNFZCWDZOUE0ifQ.EWD8yQ.XnVasyKYIXj5X_yyx5279JLH-Ug; Secure; HttpOnly; Path=/; SameSite=None
|
9
|
+
Strict-Transport-Security: max-age=86400
|
10
|
+
X-Affirm-Cache-Status: MISS
|
11
|
+
X-Affirm-Request-Id: bd10b716-de7e-4504-c5aa-63b97908a479
|
12
|
+
cache-control: private, no-cache, no-store, must-revalidate
|
13
|
+
|
14
|
+
{
|
15
|
+
"api_version": "v2",
|
16
|
+
"billing": {
|
17
|
+
"address": {
|
18
|
+
"city": "New York",
|
19
|
+
"country": "USA",
|
20
|
+
"line1": "21 W 29th St",
|
21
|
+
"line2": "room 123",
|
22
|
+
"state": "NY",
|
23
|
+
"zipcode": "10001"
|
24
|
+
},
|
25
|
+
"email": "test@example.com",
|
26
|
+
"name": {
|
27
|
+
"first": "John",
|
28
|
+
"full": "John Bar",
|
29
|
+
"last": "Bar"
|
30
|
+
},
|
31
|
+
"phone_number": "+1-917-447-7123"
|
32
|
+
},
|
33
|
+
"checkout_flow_type": "classic",
|
34
|
+
"checkout_status": "unknown",
|
35
|
+
"checkout_type": "merchant",
|
36
|
+
"config": {},
|
37
|
+
"currency": "USD",
|
38
|
+
"discounts": {
|
39
|
+
"RETURN5": {
|
40
|
+
"discount_amount": 500,
|
41
|
+
"discount_display_name": "Returning customer 5% discount"
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"financing_program_external_name": "standard_3_6_12",
|
45
|
+
"financing_program_name": "standard_3_6_12",
|
46
|
+
"items": {
|
47
|
+
"ABC-123": {
|
48
|
+
"display_name": "Awesome Pants",
|
49
|
+
"item_image_url": "http://merchantsite.com/images/awesome-pants.jpg",
|
50
|
+
"item_type": "physical",
|
51
|
+
"item_url": "http://merchantsite.com/products/awesome-pants.html",
|
52
|
+
"leasable": true,
|
53
|
+
"qty": 3,
|
54
|
+
"sku": "ABC-123",
|
55
|
+
"unit_price": 1999
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"loan_type": "classic",
|
59
|
+
"merchant": {
|
60
|
+
"exchange_lease_enabled": true,
|
61
|
+
"name": "Affirm Ruby API merchant",
|
62
|
+
"public_api_key": "2BG5HE7ZYT2VY1GH",
|
63
|
+
"user_cancel_url": "https://0d2bd47d.ngrok.io",
|
64
|
+
"user_confirmation_url": "https://0d2bd47d.ngrok.io"
|
65
|
+
},
|
66
|
+
"merchant_external_reference": "R637017522",
|
67
|
+
"metadata": {
|
68
|
+
"checkout_channel_type": "in_store",
|
69
|
+
"platform_type": "Ruby API CLI",
|
70
|
+
"platform_version": "0.1.0"
|
71
|
+
},
|
72
|
+
"mfp_rule_input_data": {
|
73
|
+
"items": {
|
74
|
+
"ABC-123": {
|
75
|
+
"display_name": "Awesome Pants",
|
76
|
+
"item_image_url": "http://merchantsite.com/images/awesome-pants.jpg",
|
77
|
+
"item_type": "physical",
|
78
|
+
"item_url": "http://merchantsite.com/products/awesome-pants.html",
|
79
|
+
"leasable": true,
|
80
|
+
"qty": 3,
|
81
|
+
"sku": "ABC-123",
|
82
|
+
"unit_price": 1999
|
83
|
+
}
|
84
|
+
},
|
85
|
+
"metadata": {
|
86
|
+
"checkout_channel_type": "in_store",
|
87
|
+
"platform_type": "Ruby API CLI",
|
88
|
+
"platform_version": "0.1.0"
|
89
|
+
},
|
90
|
+
"total": 25000
|
91
|
+
},
|
92
|
+
"order_id": "R637017522",
|
93
|
+
"product": "checkout",
|
94
|
+
"shipping": {
|
95
|
+
"address": {
|
96
|
+
"city": "New York",
|
97
|
+
"country": "USA",
|
98
|
+
"line1": "21 W 29th St",
|
99
|
+
"line2": "room 123",
|
100
|
+
"state": "NY",
|
101
|
+
"zipcode": "10001"
|
102
|
+
},
|
103
|
+
"name": {
|
104
|
+
"first": "John",
|
105
|
+
"full": "John Bar",
|
106
|
+
"last": "Bar"
|
107
|
+
}
|
108
|
+
},
|
109
|
+
"shipping_amount": 999,
|
110
|
+
"tax_amount": 2500,
|
111
|
+
"total": 25000
|
112
|
+
}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Connection: keep-alive
|
3
|
+
Content-Type: application/json
|
4
|
+
Date: Mon, 30 Mar 2020 11:11:21 GMT
|
5
|
+
Server: openresty
|
6
|
+
Set-Cookie: tracker_device=3358b383-2c58-4497-927e-3cacfb16b15a; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 11:11:21 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
7
|
+
Set-Cookie: 3060738.3440491=3358b383-2c58-4497-927e-3cacfb16b15a; Domain=.affirm.com; Expires=Wed, 30-Mar-2022 11:11:21 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
8
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6Ik9MQlFaNjExVUJCQ0RaMjgifQ.EWNlWQ.4lUoikoANCYLJkcS994Ga8k6HoM; Secure; HttpOnly; Path=/; SameSite=None
|
9
|
+
Strict-Transport-Security: max-age=86400
|
10
|
+
X-Affirm-Cache-Status: MISS
|
11
|
+
X-Affirm-Request-Id: 95d86355-17c8-47da-c756-19f1b3340b84
|
12
|
+
cache-control: private, no-cache, no-store, must-revalidate
|
13
|
+
|
14
|
+
{
|
15
|
+
"api_version": "v2",
|
16
|
+
"billing": {
|
17
|
+
"address": {
|
18
|
+
"city": "New York",
|
19
|
+
"country": "USA",
|
20
|
+
"line1": "21 W 29th St",
|
21
|
+
"line2": "room 123",
|
22
|
+
"state": "NY",
|
23
|
+
"zipcode": "10001"
|
24
|
+
},
|
25
|
+
"email": "test@example.com",
|
26
|
+
"name": {
|
27
|
+
"first": "John",
|
28
|
+
"full": "John Bar",
|
29
|
+
"last": "Bar"
|
30
|
+
},
|
31
|
+
"phone_number": "+1-917-447-7123"
|
32
|
+
},
|
33
|
+
"checkout_flow_type": "classic",
|
34
|
+
"checkout_status": "unknown",
|
35
|
+
"checkout_type": "merchant",
|
36
|
+
"config": {},
|
37
|
+
"currency": "USD",
|
38
|
+
"discounts": {
|
39
|
+
"RETURN5": {
|
40
|
+
"discount_amount": 500,
|
41
|
+
"discount_display_name": "Returning customer 5% discount"
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"financing_program_external_name": "standard_3_6_12",
|
45
|
+
"financing_program_name": "standard_3_6_12",
|
46
|
+
"items": {
|
47
|
+
"ABC-123": {
|
48
|
+
"display_name": "Awesome Pants",
|
49
|
+
"item_image_url": "http://merchantsite.com/images/awesome-pants.jpg",
|
50
|
+
"item_type": "physical",
|
51
|
+
"item_url": "http://merchantsite.com/products/awesome-pants.html",
|
52
|
+
"leasable": true,
|
53
|
+
"qty": 3,
|
54
|
+
"sku": "ABC-123",
|
55
|
+
"unit_price": 1999
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"loan_type": "classic",
|
59
|
+
"merchant": {
|
60
|
+
"exchange_lease_enabled": true,
|
61
|
+
"name": "Affirm Ruby API merchant",
|
62
|
+
"public_api_key": "2BG5HE7ZYT2VY1GH",
|
63
|
+
"user_cancel_url": "https://0d2bd47d.ngrok.io",
|
64
|
+
"user_confirmation_url": "https://0d2bd47d.ngrok.io"
|
65
|
+
},
|
66
|
+
"merchant_external_reference": "R637017522",
|
67
|
+
"metadata": {
|
68
|
+
"checkout_channel_type": "direct",
|
69
|
+
"platform_type": "Ruby API CLI",
|
70
|
+
"platform_version": "0.1.0"
|
71
|
+
},
|
72
|
+
"mfp_rule_input_data": {
|
73
|
+
"items": {
|
74
|
+
"ABC-123": {
|
75
|
+
"display_name": "Awesome Pants",
|
76
|
+
"item_image_url": "http://merchantsite.com/images/awesome-pants.jpg",
|
77
|
+
"item_type": "physical",
|
78
|
+
"item_url": "http://merchantsite.com/products/awesome-pants.html",
|
79
|
+
"leasable": true,
|
80
|
+
"qty": 3,
|
81
|
+
"sku": "ABC-123",
|
82
|
+
"unit_price": 1999
|
83
|
+
}
|
84
|
+
},
|
85
|
+
"metadata": {
|
86
|
+
"checkout_channel_type": "direct",
|
87
|
+
"platform_type": "Ruby API CLI",
|
88
|
+
"platform_version": "0.1.0"
|
89
|
+
},
|
90
|
+
"total": 25000
|
91
|
+
},
|
92
|
+
"order_id": "R637017522",
|
93
|
+
"product": "checkout",
|
94
|
+
"shipping": {
|
95
|
+
"address": {
|
96
|
+
"city": "New York",
|
97
|
+
"country": "USA",
|
98
|
+
"line1": "21 W 29th St",
|
99
|
+
"line2": "room 123",
|
100
|
+
"state": "NY",
|
101
|
+
"zipcode": "10001"
|
102
|
+
},
|
103
|
+
"name": {
|
104
|
+
"first": "John",
|
105
|
+
"full": "John Bar",
|
106
|
+
"last": "Bar"
|
107
|
+
}
|
108
|
+
},
|
109
|
+
"shipping_amount": 999,
|
110
|
+
"tax_amount": 2500,
|
111
|
+
"total": 25000
|
112
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Fri, 27 Mar 2020 19:55:08 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=119c93d2-64c4-4783-b155-ac6b7ff1df7f; Domain=.affirm.com; Expires=Sun, 27-Mar-2022 19:55:08 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=119c93d2-64c4-4783-b155-ac6b7ff1df7f; Domain=.affirm.com; Expires=Sun, 27-Mar-2022 19:55:08 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Strict-Transport-Security: max-age=86400
|
11
|
+
Transfer-Encoding: chunked
|
12
|
+
Vary: Accept-Encoding
|
13
|
+
X-Affirm-Cache-Status: MISS
|
14
|
+
X-Affirm-Request-Id: 67285850-ce4c-4213-c21d-c61b46c26888
|
15
|
+
|
16
|
+
{
|
17
|
+
"amount": 315945,
|
18
|
+
"amount_refunded": 0,
|
19
|
+
"authorization_expiration": "2020-04-25T14:30:24Z",
|
20
|
+
"checkout_id": "OC3CQ42VRJNI5ZKV",
|
21
|
+
"created": "2020-03-26T14:30:07Z",
|
22
|
+
"currency": "USD",
|
23
|
+
"events": [],
|
24
|
+
"id": "TNUC-ZQP1",
|
25
|
+
"order_id": "R637017527",
|
26
|
+
"provider_id": 1,
|
27
|
+
"status": "authorized"
|
28
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 07:57:01 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=549e57d4-8d1a-4b22-80cf-ad12ff29f8a7; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 07:57:01 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=549e57d4-8d1a-4b22-80cf-ad12ff29f8a7; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 07:57:01 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Strict-Transport-Security: max-age=86400
|
11
|
+
Transfer-Encoding: chunked
|
12
|
+
Vary: Accept-Encoding
|
13
|
+
X-Affirm-Cache-Status: MISS
|
14
|
+
X-Affirm-Request-Id: c34db14b-a7ca-4702-c77c-0e67cc995060
|
15
|
+
|
16
|
+
{
|
17
|
+
"amount": 25000,
|
18
|
+
"amount_refunded": 0,
|
19
|
+
"authorization_expiration": "2020-04-29T12:55:39Z",
|
20
|
+
"checkout_id": "P08NWT3Z84P58GZS",
|
21
|
+
"created": "2020-03-30T12:36:17Z",
|
22
|
+
"currency": "USD",
|
23
|
+
"events": [],
|
24
|
+
"id": "DVEP-FTQO",
|
25
|
+
"order_id": "R637017534",
|
26
|
+
"provider_id": 1,
|
27
|
+
"status": "captured"
|
28
|
+
}
|
data/lib/affirm/testing_support/fixtures.http/get_transaction/success_with_multiple_events.http
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 12:04:27 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=12543da4-3618-43d6-8166-e58ab858bd95; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:04:27 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=12543da4-3618-43d6-8166-e58ab858bd95; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:04:27 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IjFFWllNQVFEU1pQU043UE0ifQ.EXXmyw.VqpMdJwRRFux22-Ilw2qAFsWO70; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Strict-Transport-Security: max-age=86400
|
12
|
+
Transfer-Encoding: chunked
|
13
|
+
Vary: Accept-Encoding
|
14
|
+
X-Affirm-Cache-Status: MISS
|
15
|
+
X-Affirm-Request-Id: 236f33c6-7bda-4ee5-ce0e-48461ea880c1
|
16
|
+
|
17
|
+
{
|
18
|
+
"amount": 210420,
|
19
|
+
"amount_refunded": 0,
|
20
|
+
"authorization_expiration": "2020-05-09T17:20:43Z",
|
21
|
+
"checkout_id": "1EZYMAQDSZPSN7PM",
|
22
|
+
"created": "2020-04-09T17:20:43Z",
|
23
|
+
"currency": "USD",
|
24
|
+
"events": [
|
25
|
+
{
|
26
|
+
"created": "2020-04-13T11:58:48Z",
|
27
|
+
"currency": "USD",
|
28
|
+
"id": "LSE-7MZU-P24E",
|
29
|
+
"type": "void"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"created": "2020-04-13T11:51:27Z",
|
33
|
+
"currency": "USD",
|
34
|
+
"id": "LSE-CC0X-ZW5I",
|
35
|
+
"type": "auth"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"created": "2020-04-09T17:22:02Z",
|
39
|
+
"currency": "USD",
|
40
|
+
"id": "LSE-N2OE-UX2H",
|
41
|
+
"type": "confirm"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"id": "LS-4BSY-SV6E",
|
45
|
+
"provider_id": 2,
|
46
|
+
"status": "voided"
|
47
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
HTTP/1.1 403 FORBIDDEN
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 12:31:29 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=72e95a24-15b6-4f71-be43-f3079f762273; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:31:29 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=72e95a24-15b6-4f71-be43-f3079f762273; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:31:29 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IjFFWllNQVFEU1pQU043UE0ifQ.EXXtIQ.kfL1JjufyCoRc05XFE7NYJLreO8; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Transfer-Encoding: chunked
|
12
|
+
Vary: Accept-Encoding
|
13
|
+
X-Affirm-Request-Id: d6ce4a88-215a-49c2-c99f-ade436810722
|
14
|
+
|
15
|
+
{
|
16
|
+
"message": "The transaction has been voided and cannot be refunded.",
|
17
|
+
"status_code": 403,
|
18
|
+
"type": "refund_forbidden_on_voided"
|
19
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
HTTP/1.1 403 FORBIDDEN
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 12:32:57 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=fda0eaab-7615-47cd-afb8-083e0a8906bc; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:32:57 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=fda0eaab-7615-47cd-afb8-083e0a8906bc; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:32:57 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Transfer-Encoding: chunked
|
11
|
+
Vary: Accept-Encoding
|
12
|
+
X-Affirm-Request-Id: 0843b178-e132-4c29-cc0a-69699d1f67ca
|
13
|
+
|
14
|
+
{
|
15
|
+
"message": "The transaction is authorized and may not be refunded. Try voiding the transaction instead.",
|
16
|
+
"status_code": 403,
|
17
|
+
"type": "refund_forbidden_on_authorized"
|
18
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 12:51:28 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=203bfdca-13f3-4a5c-b198-d5abe346c7b0; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:51:28 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=203bfdca-13f3-4a5c-b198-d5abe346c7b0; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:51:28 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IlMzWVEtWjRWMSJ9.EXXx0A.UbQ2XsXC4G5HRNQDmfYMKqM2ea8; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Strict-Transport-Security: max-age=86400
|
12
|
+
Transfer-Encoding: chunked
|
13
|
+
Vary: Accept-Encoding
|
14
|
+
X-Affirm-Request-Id: 78a79cfc-70e8-4ef9-ce61-2d9ec92b5d6c
|
15
|
+
|
16
|
+
{
|
17
|
+
"amount": 25000,
|
18
|
+
"created": "2020-04-13T12:51:28Z",
|
19
|
+
"currency": "USD",
|
20
|
+
"fee_refunded": 0,
|
21
|
+
"id": "J4TBOU2ZXVGB7IHJ",
|
22
|
+
"type": "refund"
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 12:34:45 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=3a94a693-eb94-4b71-84f6-28eede18eb28; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:34:45 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=3a94a693-eb94-4b71-84f6-28eede18eb28; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 12:34:45 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6Iks0RUYtSE0wMiJ9.EXXt5Q.86aZ0muWk3V03NWYBm8lLhbKprE; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Strict-Transport-Security: max-age=86400
|
12
|
+
Transfer-Encoding: chunked
|
13
|
+
Vary: Accept-Encoding
|
14
|
+
X-Affirm-Request-Id: 23bfdc27-e30f-4529-c57d-a7aa792aafda
|
15
|
+
|
16
|
+
{
|
17
|
+
"amount": 105420,
|
18
|
+
"created": "2020-04-13T12:34:45Z",
|
19
|
+
"currency": "USD",
|
20
|
+
"fee_refunded": 0,
|
21
|
+
"id": "PM7VIBJBLOPC9YNA",
|
22
|
+
"type": "refund"
|
23
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
HTTP/1.1 403 FORBIDDEN
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 11:32:25 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=8c13da97-c7a7-4998-b7f3-8430ab18a7ff; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 11:32:25 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=8c13da97-c7a7-4998-b7f3-8430ab18a7ff; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 11:32:25 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Transfer-Encoding: chunked
|
11
|
+
Vary: Accept-Encoding
|
12
|
+
X-Affirm-Request-Id: fa7201aa-ece4-4ffd-cfcd-f10e51e30035
|
13
|
+
|
14
|
+
{
|
15
|
+
"message": "The transaction has been captured and may no longer be voided.",
|
16
|
+
"status_code": 403,
|
17
|
+
"type": "void_forbidden_on_captured"
|
18
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
HTTP/1.1 403 FORBIDDEN
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 11:38:34 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=1b629465-8847-40f9-939a-0e7dc09d24d5; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 11:38:34 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=1b629465-8847-40f9-939a-0e7dc09d24d5; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 11:38:34 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IjFFWllNQVFEU1pQU043UE0ifQ.EXXgug.s4KLV0wxNjqpL4KgxjTvFq2hX_g; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Transfer-Encoding: chunked
|
12
|
+
Vary: Accept-Encoding
|
13
|
+
X-Affirm-Request-Id: 6cccc63d-9f5c-4b16-cb84-486b09a4cc2a
|
14
|
+
|
15
|
+
{
|
16
|
+
"message": "The transaction must be authorized before it may be voided.",
|
17
|
+
"status_code": 403,
|
18
|
+
"type": "void_forbidden_on_confirmed"
|
19
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Cache-Control: private, no-cache, no-store, must-revalidate
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Encoding: gzip
|
5
|
+
Content-Type: application/json
|
6
|
+
Date: Mon, 13 Apr 2020 11:58:49 GMT
|
7
|
+
Server: openresty
|
8
|
+
Set-Cookie: tracker_device=2453415f-f3a5-4c5a-a179-da99a7d4fad2; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 11:58:49 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
9
|
+
Set-Cookie: 3060738.3440491=2453415f-f3a5-4c5a-a179-da99a7d4fad2; Domain=.affirm.com; Expires=Wed, 13-Apr-2022 11:58:49 GMT; Max-Age=63072000; Secure; Path=/; SameSite=None
|
10
|
+
Set-Cookie: session=eyJjb250ZXh0X2FyaSI6IjFFWllNQVFEU1pQU043UE0ifQ.EXXleQ.rk_mVws1KRflMEU0yQ0QQ9GQa5g; Secure; HttpOnly; Path=/; SameSite=None
|
11
|
+
Strict-Transport-Security: max-age=86400
|
12
|
+
Transfer-Encoding: chunked
|
13
|
+
Vary: Accept-Encoding
|
14
|
+
X-Affirm-Request-Id: 02a7a29a-537d-458a-c5f6-d5be7227f3cd
|
15
|
+
|
16
|
+
{
|
17
|
+
"created": "2020-04-13T11:58:48Z",
|
18
|
+
"currency": "USD",
|
19
|
+
"id": "LSE-7MZU-P24E",
|
20
|
+
"type": "void"
|
21
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{ "transaction_id": "P08NWT3Z84P58GZS" }
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"merchant": {
|
3
|
+
"public_api_key": "2BG5HE7ZYT2VY1GH",
|
4
|
+
"user_cancel_url": "https://e9ee9812.ngrok.io",
|
5
|
+
"user_confirmation_url": "https://e9ee9812.ngrok.io",
|
6
|
+
"name": "Affirm Ruby API merchant",
|
7
|
+
"exchange_lease_enabled": true
|
8
|
+
},
|
9
|
+
"billing": {
|
10
|
+
"name": { "full": "Engelbert Humpy" },
|
11
|
+
"phone_number": "9174477447",
|
12
|
+
"email": "humpy@testdomain.com",
|
13
|
+
"address": {
|
14
|
+
"line1": "21 W 29th St",
|
15
|
+
"line2": "room 123",
|
16
|
+
"city": "New York",
|
17
|
+
"state": "NY",
|
18
|
+
"zipcode": "10001",
|
19
|
+
"country": "US"
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"shipping": {
|
23
|
+
"name": { "full": "Engelbert Humpy" },
|
24
|
+
"address": {
|
25
|
+
"line1": "21 W 29th St",
|
26
|
+
"line2": "room 123",
|
27
|
+
"city": "New York",
|
28
|
+
"state": "NY",
|
29
|
+
"zipcode": "10001",
|
30
|
+
"country": "US"
|
31
|
+
}
|
32
|
+
},
|
33
|
+
"total": 25000,
|
34
|
+
"order_id": "R637017224",
|
35
|
+
"tax_amount": 2500,
|
36
|
+
"shipping_amount": 999,
|
37
|
+
"items": [
|
38
|
+
{
|
39
|
+
"display_name":"Awesome Pants",
|
40
|
+
"sku":"ABC-123",
|
41
|
+
"unit_price":2500,
|
42
|
+
"qty":10,
|
43
|
+
"item_image_url":"http://merchantsite.com/images/awesome-pants.jpg",
|
44
|
+
"item_url":"http://merchantsite.com/products/awesome-pants.html",
|
45
|
+
"leasable": true
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"discounts": {
|
49
|
+
"RETURN5": {
|
50
|
+
"discount_amount":500,
|
51
|
+
"discount_display_name":"Returning customer 5% discount"
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"metadata": {
|
55
|
+
"platform_type": "Ruby API CLI",
|
56
|
+
"platform_version": "0.1.0"
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"amount": 25000}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Affirm
|
2
|
+
module TestingSupport
|
3
|
+
module HttpResponses
|
4
|
+
def stub_headers
|
5
|
+
{
|
6
|
+
"Accept" => "application/json",
|
7
|
+
"Content-type" => "application/json",
|
8
|
+
"User-Agent" => /^Affirm\/#{Affirm::VERSION} Ruby\/#{RUBY_VERSION} OpenSSL\/.*$/
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
def stub_basic_auth
|
13
|
+
[
|
14
|
+
Affirm.config.public_api_key,
|
15
|
+
Affirm.config.private_api_key
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
19
|
+
def read_http_fixture(name)
|
20
|
+
File.read(File.join(File.dirname(__FILE__), "fixtures.http", name))
|
21
|
+
end
|
22
|
+
|
23
|
+
def read_json_fixture(name)
|
24
|
+
JSON.parse(File.read(File.join(File.dirname(__FILE__), "fixtures.json", name)))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/affirm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: affirm-ruby-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Berkenbosch
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- ".github/workflows/test.yml"
|
22
22
|
- ".gitignore"
|
23
23
|
- ".rspec"
|
24
|
+
- CHANGELOG.md
|
24
25
|
- CODE_OF_CONDUCT.md
|
25
26
|
- Gemfile
|
26
27
|
- Gemfile.lock
|
@@ -40,6 +41,30 @@ files:
|
|
40
41
|
- lib/affirm/structs/checkout/response.rb
|
41
42
|
- lib/affirm/structs/transaction.rb
|
42
43
|
- lib/affirm/structs/transaction/event.rb
|
44
|
+
- lib/affirm/testing_support/fixtures.http/404_not_found.http
|
45
|
+
- lib/affirm/testing_support/fixtures.http/authentication_failed.http
|
46
|
+
- lib/affirm/testing_support/fixtures.http/authorize/already_authorized.http
|
47
|
+
- lib/affirm/testing_support/fixtures.http/authorize/success.http
|
48
|
+
- lib/affirm/testing_support/fixtures.http/capture/already_captured.http
|
49
|
+
- lib/affirm/testing_support/fixtures.http/capture/success.http
|
50
|
+
- lib/affirm/testing_support/fixtures.http/checkout_direct/success.http
|
51
|
+
- lib/affirm/testing_support/fixtures.http/checkout_store/success.http
|
52
|
+
- lib/affirm/testing_support/fixtures.http/get_checkout/success.http
|
53
|
+
- lib/affirm/testing_support/fixtures.http/get_checkout/success_direct.http
|
54
|
+
- lib/affirm/testing_support/fixtures.http/get_transaction/success.http
|
55
|
+
- lib/affirm/testing_support/fixtures.http/get_transaction/success_captured.http
|
56
|
+
- lib/affirm/testing_support/fixtures.http/get_transaction/success_with_multiple_events.http
|
57
|
+
- lib/affirm/testing_support/fixtures.http/refund/already_voided.http
|
58
|
+
- lib/affirm/testing_support/fixtures.http/refund/not_captured_yet.http
|
59
|
+
- lib/affirm/testing_support/fixtures.http/refund/partially_refund_success.http
|
60
|
+
- lib/affirm/testing_support/fixtures.http/refund/success.http
|
61
|
+
- lib/affirm/testing_support/fixtures.http/void/already_captured.http
|
62
|
+
- lib/affirm/testing_support/fixtures.http/void/not_authorized.http
|
63
|
+
- lib/affirm/testing_support/fixtures.http/void/success.http
|
64
|
+
- lib/affirm/testing_support/fixtures.json/authorize_transaction.json
|
65
|
+
- lib/affirm/testing_support/fixtures.json/create_checkout_payload.json
|
66
|
+
- lib/affirm/testing_support/fixtures.json/partially_refund.json
|
67
|
+
- lib/affirm/testing_support/http_responses.rb
|
43
68
|
- lib/affirm/version.rb
|
44
69
|
homepage: https://github.com/peterberkenbosch/affirm-ruby-api
|
45
70
|
licenses:
|