paypal-checkout-sdk 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/lib/core/access_token.rb +20 -0
- data/lib/core/paypal_environment.rb +38 -0
- data/lib/core/paypal_http_client.rb +56 -0
- data/lib/core/token_requests.rb +40 -0
- data/lib/core/version.rb +3 -0
- data/lib/lib.rb +18 -0
- data/lib/orders/orders_authorize_request.rb +45 -0
- data/lib/orders/orders_capture_request.rb +45 -0
- data/lib/orders/orders_create_request.rb +39 -0
- data/lib/orders/orders_get_request.rb +31 -0
- data/lib/orders/orders_patch_request.rb +33 -0
- data/lib/orders/orders_validate_request.rb +37 -0
- data/lib/payments/authorizations_capture_request.rb +41 -0
- data/lib/payments/authorizations_get_request.rb +29 -0
- data/lib/payments/authorizations_reauthorize_request.rb +41 -0
- data/lib/payments/authorizations_void_request.rb +29 -0
- data/lib/payments/captures_get_request.rb +29 -0
- data/lib/payments/captures_refund_request.rb +41 -0
- data/lib/payments/refunds_get_request.rb +29 -0
- data/lib/paypal-checkout-sdk.rb +1 -0
- data/paypal-checkout-sdk.gemspec +13 -0
- data/spec/orders/orders_authorize_spec.rb +18 -0
- data/spec/orders/orders_capture_spec.rb +18 -0
- data/spec/orders/orders_create_spec.rb +36 -0
- data/spec/orders/orders_get_spec.rb +37 -0
- data/spec/orders/orders_helper.rb +33 -0
- data/spec/orders/orders_patch_spec.rb +60 -0
- data/spec/orders/orders_validate_spec.rb +18 -0
- data/spec/payments/authorizations_capture_spec.rb +18 -0
- data/spec/payments/authorizations_get_spec.rb +18 -0
- data/spec/payments/authorizations_reauthorize_spec.rb +17 -0
- data/spec/payments/authorizations_void_spec.rb +17 -0
- data/spec/payments/captures_get_spec.rb +18 -0
- data/spec/payments/captures_refund_spec.rb +18 -0
- data/spec/payments/refunds_get_spec.rb +18 -0
- data/spec/spec_helper.rb +109 -0
- data/spec/test_harness.rb +25 -0
- metadata +80 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require_relative '../test_harness'
|
4
|
+
require_relative '../../lib/lib'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
include PayPalCheckoutSdk::Payments
|
8
|
+
|
9
|
+
describe AuthorizationsCaptureRequest do
|
10
|
+
|
11
|
+
it 'successfully makes a request', :skip => 'This test is an example, in production, orders require payer approval' do
|
12
|
+
request = AuthorizationsCaptureRequest.new("AUTHORIZATION-ID")
|
13
|
+
|
14
|
+
resp = TestHarness::client.execute(request)
|
15
|
+
expect(resp.status_code).to eq(201)
|
16
|
+
expect(resp.result).not_to be_nil
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require_relative '../test_harness'
|
4
|
+
require_relative '../../lib/lib'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
include PayPalCheckoutSdk::Payments
|
8
|
+
|
9
|
+
describe AuthorizationsGetRequest do
|
10
|
+
|
11
|
+
it 'successfully makes a request', :skip => 'This test is an example, in production, orders require payer approval' do
|
12
|
+
request = AuthorizationsGetRequest.new("AUTHORIZATION-ID")
|
13
|
+
|
14
|
+
resp = TestHarness::client.execute(request)
|
15
|
+
expect(resp.status_code).to eq(200)
|
16
|
+
expect(resp.result).not_to be_nil
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require_relative '../test_harness'
|
4
|
+
require_relative '../../lib/lib'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
include PayPalCheckoutSdk::Payments
|
8
|
+
|
9
|
+
describe AuthorizationsReauthorizeRequest do
|
10
|
+
it 'successfully makes a request', :skip => 'This test is an example, in production, orders require payer approval' do
|
11
|
+
request = AuthorizationsReauthorizeRequest.new("xtIHGdKgdA25uQzr")
|
12
|
+
|
13
|
+
resp = TestHarness::client.execute(request)
|
14
|
+
expect(resp.status_code).to eq(201)
|
15
|
+
expect(resp.result).not_to be_nil
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require_relative '../test_harness'
|
4
|
+
require_relative '../../lib/lib'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
include PayPalCheckoutSdk::Payments
|
8
|
+
|
9
|
+
describe AuthorizationsVoidRequest do
|
10
|
+
|
11
|
+
it 'successfully makes a request', :skip => 'This test is an example, in production, orders require payer approval' do
|
12
|
+
request = AuthorizationsVoidRequest.new("AUTHORIZATION-ID")
|
13
|
+
|
14
|
+
resp = TestHarness::client.execute(request)
|
15
|
+
expect(resp.status_code).to eq(204)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require_relative '../test_harness'
|
4
|
+
require_relative '../../lib/lib'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
include PayPalCheckoutSdk::Payments
|
8
|
+
|
9
|
+
describe CapturesGetRequest do
|
10
|
+
|
11
|
+
it 'successfully makes a request', :skip => 'This test is an example, in production, orders require payer approval' do
|
12
|
+
request = CapturesGetRequest.new("CAPTURE-ID")
|
13
|
+
|
14
|
+
resp = TestHarness::client.execute(request)
|
15
|
+
expect(resp.status_code).to eq(200)
|
16
|
+
expect(resp.result).not_to be_nil
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require_relative '../test_harness'
|
4
|
+
require_relative '../../lib/lib'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
include PayPalCheckoutSdk::Payments
|
8
|
+
|
9
|
+
describe CapturesRefundRequest do
|
10
|
+
|
11
|
+
it 'successfully makes a request', :skip => 'This test is an example, in production, orders require payer approval' do
|
12
|
+
request = CapturesRefundRequest.new("CAPTURE-ID")
|
13
|
+
|
14
|
+
resp = TestHarness::client.execute(request)
|
15
|
+
expect(resp.status_code).to eq(201)
|
16
|
+
expect(resp.result).not_to be_nil
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require_relative '../test_harness'
|
4
|
+
require_relative '../../lib/lib'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
include PayPalCheckoutSdk::Payments
|
8
|
+
|
9
|
+
describe RefundsGetRequest do
|
10
|
+
|
11
|
+
it 'successfully makes a request', :skip => 'This test is an example, in production, orders require payer approval' do
|
12
|
+
request = RefundsGetRequest.new("REFUND-ID")
|
13
|
+
|
14
|
+
resp = TestHarness::client.execute(request)
|
15
|
+
expect(resp.status_code).to eq(200)
|
16
|
+
expect(resp.result).not_to be_nil
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
require_relative "../lib/lib.rb"
|
2
|
+
require 'pp'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
|
5
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
6
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
7
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
8
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
9
|
+
# files.
|
10
|
+
#
|
11
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
12
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
13
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
14
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
15
|
+
# a separate helper file that requires the additional dependencies and performs
|
16
|
+
# the additional setup, and require it from the spec files that actually need
|
17
|
+
# it.
|
18
|
+
#
|
19
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
20
|
+
# users commonly want.
|
21
|
+
#
|
22
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
23
|
+
RSpec.configure do |config|
|
24
|
+
# rspec-expectations config goes here. You can use an alternate
|
25
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
26
|
+
# assertions if you prefer.
|
27
|
+
config.expect_with :rspec do |expectations|
|
28
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
29
|
+
# and `failure_message` of custom matchers include text for helper methods
|
30
|
+
# defined using `chain`, e.g.:
|
31
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
32
|
+
# # => "be bigger than 2 and smaller than 4"
|
33
|
+
# ...rather than:
|
34
|
+
# # => "be bigger than 2"
|
35
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
36
|
+
end
|
37
|
+
|
38
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
39
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
40
|
+
config.mock_with :rspec do |mocks|
|
41
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
42
|
+
# a real object. This is generally recommended, and will default to
|
43
|
+
# `true` in RSpec 4.
|
44
|
+
mocks.verify_partial_doubles = true
|
45
|
+
end
|
46
|
+
|
47
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
48
|
+
# have no way to turn it off -- the option exists only for backwards
|
49
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
50
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
51
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
52
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
53
|
+
|
54
|
+
# The settings below are suggested to provide a good initial experience
|
55
|
+
# with RSpec, but feel free to customize to your heart's content.
|
56
|
+
=begin
|
57
|
+
# This allows you to limit a spec run to individual examples or groups
|
58
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
59
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
60
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
61
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
62
|
+
config.filter_run_when_matching :focus
|
63
|
+
|
64
|
+
# Allows RSpec to persist some state between runs in order to support
|
65
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
66
|
+
# you configure your source control system to ignore this file.
|
67
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
68
|
+
|
69
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
70
|
+
# recommended. For more details, see:
|
71
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
72
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
73
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
74
|
+
config.disable_monkey_patching!
|
75
|
+
|
76
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
77
|
+
# be too noisy due to issues in dependencies.
|
78
|
+
config.warnings = true
|
79
|
+
|
80
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
81
|
+
# file, and it's useful to allow more verbose output when running an
|
82
|
+
# individual spec file.
|
83
|
+
if config.files_to_run.one?
|
84
|
+
# Use the documentation formatter for detailed output,
|
85
|
+
# unless a formatter has already been configured
|
86
|
+
# (e.g. via a command-line flag).
|
87
|
+
config.default_formatter = 'doc'
|
88
|
+
end
|
89
|
+
|
90
|
+
# Print the 10 slowest examples and example groups at the
|
91
|
+
# end of the spec run, to help surface which specs are running
|
92
|
+
# particularly slow.
|
93
|
+
config.profile_examples = 10
|
94
|
+
|
95
|
+
# Run specs in random order to surface order dependencies. If you find an
|
96
|
+
# order dependency and want to debug it, you can fix the order by providing
|
97
|
+
# the seed, which is printed after each run.
|
98
|
+
# --seed 1234
|
99
|
+
config.order = :random
|
100
|
+
|
101
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
102
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
103
|
+
# test failures related to randomization by passing the same `--seed` value
|
104
|
+
# as the one that triggered the failure.
|
105
|
+
Kernel.srand config.seed
|
106
|
+
=end
|
107
|
+
end
|
108
|
+
|
109
|
+
WebMock.allow_net_connect!
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'braintreehttp'
|
2
|
+
require './lib/paypal-checkout-sdk'
|
3
|
+
|
4
|
+
module TestHarness
|
5
|
+
class << self
|
6
|
+
def environment
|
7
|
+
client_id = ENV['PAYPAL_CLIENT_ID'] || '<<PAYPAL-CLIENT-ID>>'
|
8
|
+
client_secret = ENV['PAYPAL_CLIENT_SECRET'] || '<<PAYPAL-CLIENT-SECRET>>'
|
9
|
+
|
10
|
+
PayPal::SandboxEnvironment.new(client_id, client_secret)
|
11
|
+
end
|
12
|
+
|
13
|
+
def client
|
14
|
+
PayPal::PayPalHttpClient.new(self.environment)
|
15
|
+
end
|
16
|
+
|
17
|
+
def exec(req, body = nil)
|
18
|
+
if body
|
19
|
+
req.request_body(body)
|
20
|
+
end
|
21
|
+
|
22
|
+
client.execute(req)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paypal-checkout-sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- http://developer.paypal.com
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-04 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This repository contains PayPal's Ruby SDK for Checkout REST API
|
14
|
+
email: dl-paypal-checkout-api@paypal.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/core/access_token.rb
|
20
|
+
- lib/core/paypal_environment.rb
|
21
|
+
- lib/core/paypal_http_client.rb
|
22
|
+
- lib/core/token_requests.rb
|
23
|
+
- lib/core/version.rb
|
24
|
+
- lib/lib.rb
|
25
|
+
- lib/orders/orders_authorize_request.rb
|
26
|
+
- lib/orders/orders_capture_request.rb
|
27
|
+
- lib/orders/orders_create_request.rb
|
28
|
+
- lib/orders/orders_get_request.rb
|
29
|
+
- lib/orders/orders_patch_request.rb
|
30
|
+
- lib/orders/orders_validate_request.rb
|
31
|
+
- lib/payments/authorizations_capture_request.rb
|
32
|
+
- lib/payments/authorizations_get_request.rb
|
33
|
+
- lib/payments/authorizations_reauthorize_request.rb
|
34
|
+
- lib/payments/authorizations_void_request.rb
|
35
|
+
- lib/payments/captures_get_request.rb
|
36
|
+
- lib/payments/captures_refund_request.rb
|
37
|
+
- lib/payments/refunds_get_request.rb
|
38
|
+
- lib/paypal-checkout-sdk.rb
|
39
|
+
- paypal-checkout-sdk.gemspec
|
40
|
+
- spec/orders/orders_authorize_spec.rb
|
41
|
+
- spec/orders/orders_capture_spec.rb
|
42
|
+
- spec/orders/orders_create_spec.rb
|
43
|
+
- spec/orders/orders_get_spec.rb
|
44
|
+
- spec/orders/orders_helper.rb
|
45
|
+
- spec/orders/orders_patch_spec.rb
|
46
|
+
- spec/orders/orders_validate_spec.rb
|
47
|
+
- spec/payments/authorizations_capture_spec.rb
|
48
|
+
- spec/payments/authorizations_get_spec.rb
|
49
|
+
- spec/payments/authorizations_reauthorize_spec.rb
|
50
|
+
- spec/payments/authorizations_void_spec.rb
|
51
|
+
- spec/payments/captures_get_spec.rb
|
52
|
+
- spec/payments/captures_refund_spec.rb
|
53
|
+
- spec/payments/refunds_get_spec.rb
|
54
|
+
- spec/spec_helper.rb
|
55
|
+
- spec/test_harness.rb
|
56
|
+
homepage: https://github.com/paypal/Checkout-Ruby-SDK
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.7.6
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: This repository contains PayPal's Ruby SDK for Checkout REST API
|
80
|
+
test_files: []
|