paypal-sdk-rest 1.7.3 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +5 -14
- data/README.md +48 -243
- data/lib/lib.rb +95 -0
- data/lib/paypal-sdk-rest.rb +1 -2
- data/lib/paypal/core/access_token.rb +20 -0
- data/lib/paypal/core/paypal_environment.rb +38 -0
- data/lib/paypal/core/paypal_http_client.rb +52 -0
- data/lib/paypal/core/token_requests.rb +40 -0
- data/lib/paypal/core/version.rb +3 -0
- data/lib/v1/billing_agreements/agreement_bill_balance_request.rb +35 -0
- data/lib/v1/billing_agreements/agreement_cancel_request.rb +35 -0
- data/lib/v1/billing_agreements/agreement_create_request.rb +33 -0
- data/lib/v1/billing_agreements/agreement_execute_request.rb +31 -0
- data/lib/v1/billing_agreements/agreement_get_request.rb +31 -0
- data/lib/v1/billing_agreements/agreement_re_activate_request.rb +35 -0
- data/lib/v1/billing_agreements/agreement_set_balance_request.rb +35 -0
- data/lib/v1/billing_agreements/agreement_suspend_request.rb +35 -0
- data/lib/v1/billing_agreements/agreement_transactions_request.rb +41 -0
- data/lib/v1/billing_agreements/agreement_update_request.rb +35 -0
- data/lib/v1/billing_plans/plan_create_request.rb +33 -0
- data/lib/v1/billing_plans/plan_get_request.rb +31 -0
- data/lib/v1/billing_plans/plan_list_request.rb +49 -0
- data/lib/v1/billing_plans/plan_update_request.rb +35 -0
- data/lib/v1/customer_disputes/dispute_accept_claim_request.rb +35 -0
- data/lib/v1/customer_disputes/dispute_adjudicate_request.rb +35 -0
- data/lib/v1/customer_disputes/dispute_appeal_request.rb +35 -0
- data/lib/v1/customer_disputes/dispute_get_request.rb +31 -0
- data/lib/v1/customer_disputes/dispute_list_request.rb +59 -0
- data/lib/v1/customer_disputes/dispute_provide_evidence_request.rb +35 -0
- data/lib/v1/customer_disputes/dispute_require_evidence_request.rb +35 -0
- data/lib/v1/identity/user_consent.rb +45 -0
- data/lib/v1/identity/userinfo_get_request.rb +33 -0
- data/lib/v1/invoices/invoice_cancel_request.rb +35 -0
- data/lib/v1/invoices/invoice_create_request.rb +33 -0
- data/lib/v1/invoices/invoice_delete_external_payment_request.rb +33 -0
- data/lib/v1/invoices/invoice_delete_external_refund_request.rb +33 -0
- data/lib/v1/invoices/invoice_delete_request.rb +31 -0
- data/lib/v1/invoices/invoice_get_request.rb +31 -0
- data/lib/v1/invoices/invoice_list_request.rb +44 -0
- data/lib/v1/invoices/invoice_next_invoice_number_request.rb +29 -0
- data/lib/v1/invoices/invoice_qr_code_request.rb +46 -0
- data/lib/v1/invoices/invoice_record_payment_request.rb +35 -0
- data/lib/v1/invoices/invoice_record_refund_request.rb +35 -0
- data/lib/v1/invoices/invoice_remind_request.rb +35 -0
- data/lib/v1/invoices/invoice_search_request.rb +33 -0
- data/lib/v1/invoices/invoice_send_request.rb +36 -0
- data/lib/v1/invoices/invoice_update_request.rb +40 -0
- data/lib/v1/invoices/template_create_request.rb +33 -0
- data/lib/v1/invoices/template_delete_request.rb +31 -0
- data/lib/v1/invoices/template_get_request.rb +31 -0
- data/lib/v1/invoices/template_list_request.rb +34 -0
- data/lib/v1/invoices/template_update_request.rb +35 -0
- data/lib/v1/orders/orders_cancel_request.rb +31 -0
- data/lib/v1/orders/orders_create_request.rb +33 -0
- data/lib/v1/orders/orders_get_request.rb +31 -0
- data/lib/v1/orders/orders_pay_request.rb +35 -0
- data/lib/v1/payment_experience/web_profile_create_request.rb +33 -0
- data/lib/v1/payment_experience/web_profile_delete_request.rb +31 -0
- data/lib/v1/payment_experience/web_profile_get_request.rb +31 -0
- data/lib/v1/payment_experience/web_profile_list_request.rb +29 -0
- data/lib/v1/payment_experience/web_profile_partial_update_request.rb +35 -0
- data/lib/v1/payment_experience/web_profile_update_request.rb +35 -0
- data/lib/v1/payments/authorization_capture_request.rb +35 -0
- data/lib/v1/payments/authorization_get_request.rb +31 -0
- data/lib/v1/payments/authorization_reauthorize_request.rb +35 -0
- data/lib/v1/payments/authorization_void_request.rb +35 -0
- data/lib/v1/payments/capture_get_request.rb +31 -0
- data/lib/v1/payments/capture_refund_request.rb +39 -0
- data/lib/v1/payments/order_authorize_request.rb +35 -0
- data/lib/v1/payments/order_capture_request.rb +35 -0
- data/lib/v1/payments/order_get_request.rb +31 -0
- data/lib/v1/payments/order_void_request.rb +35 -0
- data/lib/v1/payments/payment_create_request.rb +37 -0
- data/lib/v1/payments/payment_execute_request.rb +43 -0
- data/lib/v1/payments/payment_get_request.rb +31 -0
- data/lib/v1/payments/payment_list_request.rb +69 -0
- data/lib/v1/payments/payment_update_request.rb +35 -0
- data/lib/v1/payments/refund_get_request.rb +31 -0
- data/lib/v1/payments/sale_get_request.rb +31 -0
- data/lib/v1/payments/sale_refund_request.rb +39 -0
- data/lib/v1/sync/search_get_request.rb +99 -0
- data/lib/v1/vault/credit_card_create_request.rb +33 -0
- data/lib/v1/vault/credit_card_delete_request.rb +31 -0
- data/lib/v1/vault/credit_card_get_request.rb +31 -0
- data/lib/v1/vault/credit_card_list_request.rb +79 -0
- data/lib/v1/vault/credit_card_update_request.rb +35 -0
- data/lib/v1/webhooks/available_event_type_list_request.rb +29 -0
- data/lib/v1/webhooks/event_get_request.rb +31 -0
- data/lib/v1/webhooks/event_list_request.rb +54 -0
- data/lib/v1/webhooks/event_resend_request.rb +35 -0
- data/lib/v1/webhooks/simulate_event_request.rb +33 -0
- data/lib/v1/webhooks/webhook_create_request.rb +33 -0
- data/lib/v1/webhooks/webhook_delete_request.rb +31 -0
- data/lib/v1/webhooks/webhook_get_request.rb +31 -0
- data/lib/v1/webhooks/webhook_list_event_subscriptions_request.rb +31 -0
- data/lib/v1/webhooks/webhook_list_request.rb +34 -0
- data/lib/v1/webhooks/webhook_update_request.rb +35 -0
- data/lib/v1/webhooks/webhook_verify_signature_request.rb +33 -0
- data/spec/integration/test_harness.rb +25 -0
- data/spec/integration/v1/billing_agreements/agreement_create_spec.rb +69 -0
- data/spec/integration/v1/billing_plans/plan_create_spec.rb +12 -0
- data/spec/integration/v1/billing_plans/plan_get_spec.rb +16 -0
- data/spec/integration/v1/billing_plans/plan_helper.rb +71 -0
- data/spec/integration/v1/billing_plans/plan_list_spec.rb +16 -0
- data/spec/integration/v1/billing_plans/plan_update_spec.rb +19 -0
- data/spec/integration/v1/customer_disputes/dispute_accept_claim_spec.rb +26 -0
- data/spec/integration/v1/customer_disputes/dispute_adjudicate_spec.rb +24 -0
- data/spec/integration/v1/customer_disputes/dispute_appeal_spec.rb +33 -0
- data/spec/integration/v1/customer_disputes/dispute_get_spec.rb +19 -0
- data/spec/integration/v1/customer_disputes/dispute_list_spec.rb +17 -0
- data/spec/integration/v1/customer_disputes/dispute_provide_evidence_spec.rb +32 -0
- data/spec/integration/v1/customer_disputes/dispute_require_evidence_spec.rb +24 -0
- data/spec/integration/v1/customer_disputes/test_image.png +0 -0
- data/spec/integration/v1/identity/userinfo_get_spec.rb +65 -0
- data/spec/integration/v1/invoices/invoice_cancel_spec.rb +23 -0
- data/spec/integration/v1/invoices/invoice_create_spec.rb +15 -0
- data/spec/integration/v1/invoices/invoice_delete_external_payment_spec.rb +23 -0
- data/spec/integration/v1/invoices/invoice_delete_external_refund_spec.rb +21 -0
- data/spec/integration/v1/invoices/invoice_delete_spec.rb +16 -0
- data/spec/integration/v1/invoices/invoice_get_spec.rb +18 -0
- data/spec/integration/v1/invoices/invoice_helper.rb +171 -0
- data/spec/integration/v1/invoices/invoice_list_spec.rb +20 -0
- data/spec/integration/v1/invoices/invoice_next_invoice_number_spec.rb +14 -0
- data/spec/integration/v1/invoices/invoice_qr_code_spec.rb +18 -0
- data/spec/integration/v1/invoices/invoice_record_payment_spec.rb +14 -0
- data/spec/integration/v1/invoices/invoice_record_refund_spec.rb +14 -0
- data/spec/integration/v1/invoices/invoice_remind_spec.rb +22 -0
- data/spec/integration/v1/invoices/invoice_search_spec.rb +20 -0
- data/spec/integration/v1/invoices/invoice_send_spec.rb +15 -0
- data/spec/integration/v1/invoices/invoice_update_spec.rb +26 -0
- data/spec/integration/v1/invoices/template_create_spec.rb +14 -0
- data/spec/integration/v1/invoices/template_delete_spec.rb +15 -0
- data/spec/integration/v1/invoices/template_get_spec.rb +18 -0
- data/spec/integration/v1/invoices/template_list_spec.rb +15 -0
- data/spec/integration/v1/invoices/template_update_spec.rb +62 -0
- data/spec/integration/v1/orders/orders_cancel_spec.rb +15 -0
- data/spec/integration/v1/orders/orders_create_spec.rb +17 -0
- data/spec/integration/v1/orders/orders_get_spec.rb +18 -0
- data/spec/integration/v1/orders/orders_helper.rb +36 -0
- data/spec/integration/v1/orders/orders_pay_spec.rb +19 -0
- data/spec/integration/v1/payment_experience/pe_helper.rb +35 -0
- data/spec/integration/v1/payment_experience/web_profile_create_spec.rb +20 -0
- data/spec/integration/v1/payment_experience/web_profile_delete_spec.rb +15 -0
- data/spec/integration/v1/payment_experience/web_profile_get_spec.rb +17 -0
- data/spec/integration/v1/payment_experience/web_profile_list_spec.rb +18 -0
- data/spec/integration/v1/payment_experience/web_profile_partial_update_spec.rb +32 -0
- data/spec/integration/v1/payment_experience/web_profile_update_spec.rb +44 -0
- data/spec/integration/v1/payments/authorization_capture_spec.rb +17 -0
- data/spec/integration/v1/payments/authorization_get_spec.rb +18 -0
- data/spec/integration/v1/payments/authorization_reauthorize_spec.rb +26 -0
- data/spec/integration/v1/payments/authorization_void_spec.rb +19 -0
- data/spec/integration/v1/payments/capture_get_spec.rb +20 -0
- data/spec/integration/v1/payments/capture_refund_spec.rb +27 -0
- data/spec/integration/v1/payments/order_authorize_spec.rb +20 -0
- data/spec/integration/v1/payments/order_capture_spec.rb +21 -0
- data/spec/integration/v1/payments/order_get_spec.rb +14 -0
- data/spec/integration/v1/payments/order_void_spec.rb +14 -0
- data/spec/integration/v1/payments/payment_create_spec.rb +13 -0
- data/spec/integration/v1/payments/payment_execute_spec.rb +19 -0
- data/spec/integration/v1/payments/payment_get_spec.rb +17 -0
- data/spec/integration/v1/payments/payment_list_spec.rb +16 -0
- data/spec/integration/v1/payments/payment_update_spec.rb +28 -0
- data/spec/integration/v1/payments/payments_helper.rb +78 -0
- data/spec/integration/v1/payments/refund_get_spec.rb +19 -0
- data/spec/integration/v1/payments/sale_get_spec.rb +18 -0
- data/spec/integration/v1/payments/sale_refund_spec.rb +18 -0
- data/spec/integration/v1/sync/search_get_spec.rb +34 -0
- data/spec/integration/v1/vault/credit_card_create_spec.rb +16 -0
- data/spec/integration/v1/vault/credit_card_delete_spec.rb +16 -0
- data/spec/integration/v1/vault/credit_card_get_spec.rb +17 -0
- data/spec/integration/v1/vault/credit_card_list_spec.rb +18 -0
- data/spec/integration/v1/vault/credit_card_update_spec.rb +26 -0
- data/spec/integration/v1/vault/vault_helper.rb +28 -0
- data/spec/integration/v1/webhooks/available_event_type_list_spec.rb +16 -0
- data/spec/integration/v1/webhooks/webhook_create_spec.rb +12 -0
- data/spec/integration/v1/webhooks/webhook_delete_spec.rb +13 -0
- data/spec/integration/v1/webhooks/webhook_get_spec.rb +16 -0
- data/spec/integration/v1/webhooks/webhook_helper.rb +42 -0
- data/spec/integration/v1/webhooks/webhook_list_event_subscriptions_spec.rb +16 -0
- data/spec/integration/v1/webhooks/webhook_list_spec.rb +15 -0
- data/spec/integration/v1/webhooks/webhook_update_spec.rb +29 -0
- data/spec/integration/v1/webhooks/webhook_verify_signature_spec.rb +20 -0
- data/spec/log/http.log +0 -0
- data/spec/log/rest_http.log +0 -0
- data/spec/spec_helper.rb +98 -26
- data/spec/unit/paypal_http_client_spec.rb +272 -0
- metadata +277 -119
- data/Rakefile +0 -15
- data/data/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/data/DigiCertSHA2ExtendedValidationServerCA.pem +0 -28
- data/data/paypal.crt +0 -171
- data/lib/generators/paypal/sdk/USAGE +0 -3
- data/lib/generators/paypal/sdk/install_generator.rb +0 -17
- data/lib/generators/paypal/sdk/templates/paypal.rb +0 -2
- data/lib/generators/paypal/sdk/templates/paypal.yml +0 -29
- data/lib/paypal-sdk-core.rb +0 -38
- data/lib/paypal-sdk/core/api.rb +0 -20
- data/lib/paypal-sdk/core/api/base.rb +0 -169
- data/lib/paypal-sdk/core/api/data_types/array_with_block.rb +0 -44
- data/lib/paypal-sdk/core/api/data_types/base.rb +0 -225
- data/lib/paypal-sdk/core/api/data_types/enum.rb +0 -26
- data/lib/paypal-sdk/core/api/data_types/simple_types.rb +0 -52
- data/lib/paypal-sdk/core/api/ipn.rb +0 -66
- data/lib/paypal-sdk/core/api/rest.rb +0 -177
- data/lib/paypal-sdk/core/authentication.rb +0 -66
- data/lib/paypal-sdk/core/config.rb +0 -253
- data/lib/paypal-sdk/core/credential.rb +0 -16
- data/lib/paypal-sdk/core/credential/base.rb +0 -27
- data/lib/paypal-sdk/core/credential/certificate.rb +0 -32
- data/lib/paypal-sdk/core/credential/signature.rb +0 -22
- data/lib/paypal-sdk/core/credential/third_party/subject.rb +0 -25
- data/lib/paypal-sdk/core/credential/third_party/token.rb +0 -39
- data/lib/paypal-sdk/core/exceptions.rb +0 -112
- data/lib/paypal-sdk/core/logging.rb +0 -50
- data/lib/paypal-sdk/core/openid_connect.rb +0 -140
- data/lib/paypal-sdk/core/openid_connect/api.rb +0 -50
- data/lib/paypal-sdk/core/openid_connect/data_types.rb +0 -73
- data/lib/paypal-sdk/core/openid_connect/get_api.rb +0 -28
- data/lib/paypal-sdk/core/openid_connect/request_data_type.rb +0 -52
- data/lib/paypal-sdk/core/openid_connect/set_api.rb +0 -36
- data/lib/paypal-sdk/core/util.rb +0 -11
- data/lib/paypal-sdk/core/util/http_helper.rb +0 -171
- data/lib/paypal-sdk/core/util/oauth_signature.rb +0 -64
- data/lib/paypal-sdk/core/util/ordered_hash.rb +0 -165
- data/lib/paypal-sdk/rest.rb +0 -39
- data/lib/paypal-sdk/rest/api.rb +0 -23
- data/lib/paypal-sdk/rest/data_types.rb +0 -2596
- data/lib/paypal-sdk/rest/error_hash.rb +0 -39
- data/lib/paypal-sdk/rest/get_api.rb +0 -20
- data/lib/paypal-sdk/rest/request_data_type.rb +0 -53
- data/lib/paypal-sdk/rest/set_api.rb +0 -42
- data/lib/paypal-sdk/rest/version.rb +0 -7
- data/spec/README.md +0 -22
- data/spec/config/cacert.pem +0 -171
- data/spec/config/cert_key.pem +0 -33
- data/spec/config/paypal.yml +0 -35
- data/spec/config/sample_data.yml +0 -3
- data/spec/core/api/data_type_spec.rb +0 -289
- data/spec/core/api/rest_spec.rb +0 -211
- data/spec/core/config_spec.rb +0 -192
- data/spec/core/logging_spec.rb +0 -28
- data/spec/core/openid_connect_spec.rb +0 -153
- data/spec/invoice_examples_spec.rb +0 -38
- data/spec/payments_examples_spec.rb +0 -437
- data/spec/payouts_examples_spec.rb +0 -49
- data/spec/rest/data_types_spec.rb +0 -62
- data/spec/rest/error_hash_spec.rb +0 -83
- data/spec/subscription_examples_spec.rb +0 -227
- data/spec/support/sample_data.rb +0 -5
- data/spec/web_profile_examples_spec.rb +0 -106
- data/spec/webhooks_examples_spec.rb +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 427c6d4722666af759f0fdef08ffdf13c744ddfd
|
4
|
+
data.tar.gz: 568acf30041cb766248d7eb5f07be36c33d68493
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 508242f3d5d765639f856e0c44eeea940e125bf290369a6ffbdf46a5b8f56a59b81e87d6f5734237b462b7a29de81bad9e9e876538e52b6ef4e92f7d134dcb19
|
7
|
+
data.tar.gz: b2fd4bb56102bdcdb8f74202ff25d50ff2c7c5a243c112525883e12dc36b68054d448d866f98743403b61d9305ff7f33cdf3a85afee5ca5ff1339e18ff1009dd
|
data/Gemfile
CHANGED
@@ -1,15 +1,6 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
gem 'rake', :require => false
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem 'simplecov', :require => false
|
11
|
-
gem 'rspec'
|
12
|
-
gem 'webmock'
|
13
|
-
end
|
14
|
-
|
15
|
-
gem 'releasinator', '~> 0.6'
|
3
|
+
gem "rake"
|
4
|
+
gem "rspec"
|
5
|
+
gem "webmock"
|
6
|
+
gem "braintreehttp", '0.5.0'
|
data/README.md
CHANGED
@@ -1,273 +1,78 @@
|
|
1
|
-
|
1
|
+
# PayPal SDK 2.0-beta [![Build Status](https://travis-ci.org/paypal/PayPal-Ruby-SDK.svg?branch=2.0-beta)](https://travis-ci.org/paypal/PayPal-Ruby-SDK)
|
2
2
|
|
3
|
+
This is a preview of how PayPal SDKs will look in the next major version. We've simplified the interface to only provide HTTPRequest that can easily be called via our HttpClient.
|
3
4
|
|
4
|
-
|
5
|
+
## What's New
|
5
6
|
|
7
|
+
Please see the [CHANGELOG.md](./CHANGELOG.md) for the latest changes.
|
6
8
|
|
7
|
-
##
|
8
|
-
We're releasing a [brand new version of our SDK!](https://github.com/paypal/PayPal-Ruby-SDK/tree/2.0-beta) 2.0 is currently at release candidate status, and represents a full refactor, with the goal of making all of our APIs extremely easy to use. 2.0 includes all of the existing APIs (except payouts), and includes the new Orders API (disputes and Marketplace coming soon). Check out the [FAQ and migration guide](https://github.com/paypal/PayPal-Ruby-SDK/tree/2.0-beta/docs), and let us know if you have any suggestions or issues!
|
9
|
+
## Example
|
9
10
|
|
10
|
-
|
11
|
-
- Ruby 2.0.0 or above
|
12
|
-
- Bundler
|
13
|
-
|
14
|
-
## Installation
|
15
|
-
|
16
|
-
Add this line to your application's Gemfile:
|
17
|
-
|
18
|
-
```ruby
|
19
|
-
gem 'paypal-sdk-rest'
|
20
|
-
```
|
21
|
-
|
22
|
-
And then execute:
|
23
|
-
|
24
|
-
```sh
|
25
|
-
$ bundle
|
26
|
-
```
|
27
|
-
|
28
|
-
Or install it yourself as:
|
29
|
-
|
30
|
-
```sh
|
31
|
-
$ gem install paypal-sdk-rest
|
32
|
-
```
|
33
|
-
|
34
|
-
## Configuration
|
35
|
-
|
36
|
-
For Rails application:
|
37
|
-
|
38
|
-
```sh
|
39
|
-
rails g paypal:sdk:install
|
40
|
-
```
|
41
|
-
|
42
|
-
For other ruby application, create a configuration file(`config/paypal.yml`):
|
43
|
-
|
44
|
-
```yaml
|
45
|
-
development: &default
|
46
|
-
mode: sandbox
|
47
|
-
client_id: EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM
|
48
|
-
client_secret: EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM
|
49
|
-
# # with Proxy
|
50
|
-
# http_proxy: http://proxy-ipaddress:3129/
|
51
|
-
# # with CA File
|
52
|
-
# ssl_options:
|
53
|
-
# ca_file: config/cacert.pem
|
54
|
-
# # Override Endpoint
|
55
|
-
# rest_endpoint: https://api.sandbox.paypal.com
|
56
|
-
test:
|
57
|
-
<<: *default
|
58
|
-
production:
|
59
|
-
mode: live
|
60
|
-
client_id: CLIENT_ID
|
61
|
-
client_secret: CLIENT_SECRET
|
62
|
-
```
|
63
|
-
|
64
|
-
|
65
|
-
Load Configurations from specified file:
|
66
|
-
|
67
|
-
```ruby
|
68
|
-
PayPal::SDK::Core::Config.load('spec/config/paypal.yml', ENV['RACK_ENV'] || 'development')
|
69
|
-
```
|
70
|
-
|
71
|
-
Without configuration file:
|
72
|
-
|
73
|
-
```ruby
|
74
|
-
PayPal::SDK.configure(
|
75
|
-
:mode => "sandbox", # "sandbox" or "live"
|
76
|
-
:client_id => "EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM",
|
77
|
-
:client_secret => "EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM",
|
78
|
-
:ssl_options => { } )
|
79
|
-
```
|
80
|
-
|
81
|
-
Logger configuration:
|
82
|
-
|
83
|
-
```ruby
|
84
|
-
PayPal::SDK.logger = Logger.new(STDERR)
|
85
|
-
|
86
|
-
# change log level to INFO
|
87
|
-
PayPal::SDK.logger.level = Logger::INFO
|
88
|
-
```
|
89
|
-
**NOTE**: At `DEBUG` level, all requests/responses are logged except when `mode` is set to `live`. In order to disable request/response printing, set the log level to `INFO` or less verbose ones.
|
90
|
-
|
91
|
-
|
92
|
-
### OpenIDConnect Samples
|
11
|
+
### Creating a Payment
|
93
12
|
|
94
13
|
```ruby
|
95
14
|
require 'paypal-sdk-rest'
|
96
15
|
|
97
|
-
|
98
|
-
PayPal::SDK.configure({
|
99
|
-
:openid_client_id => "client_id",
|
100
|
-
:openid_client_secret => "client_secret",
|
101
|
-
:openid_redirect_uri => "http://google.com"
|
102
|
-
})
|
103
|
-
include PayPal::SDK::OpenIDConnect
|
16
|
+
include PayPal::V1::Payments
|
104
17
|
|
105
|
-
|
106
|
-
|
18
|
+
environment = PayPal::SandboxEnvironment.new('AdV4d6nLHabWLyemrw4BKdO9LjcnioNIOgoz7vD611ObbDUL0kJQfzrdhXEBwnH8QmV-7XZjvjRWn0kg', 'EPKoPC_haZMTq5uM9WXuzoxUVdgzVqHyD5avCyVC1NCIUJeVaNNUZMnzduYIqrdw-carG9LBAizFGMyK')
|
19
|
+
client = PayPal::PayPalHttpClient.new(environment)
|
107
20
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
# Create tokeninfo by using refresh token
|
117
|
-
tokeninfo = Tokeninfo.refresh("Replace with refresh_token")
|
118
|
-
puts tokeninfo.to_hash
|
119
|
-
|
120
|
-
# Get Userinfo
|
121
|
-
userinfo = tokeninfo.userinfo
|
122
|
-
puts userinfo.to_hash
|
123
|
-
|
124
|
-
# Get logout url
|
125
|
-
put tokeninfo.logout_url
|
126
|
-
```
|
127
|
-
|
128
|
-
## Create Payment
|
129
|
-
|
130
|
-
```ruby
|
131
|
-
require 'paypal-sdk-rest'
|
132
|
-
include PayPal::SDK::REST
|
133
|
-
|
134
|
-
PayPal::SDK::REST.set_config(
|
135
|
-
:mode => "sandbox", # "sandbox" or "live"
|
136
|
-
:client_id => "EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM",
|
137
|
-
:client_secret => "EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM")
|
138
|
-
|
139
|
-
# Build Payment object
|
140
|
-
@payment = Payment.new({
|
141
|
-
:intent => "sale",
|
142
|
-
:payer => {
|
143
|
-
:payment_method => "paypal" },
|
21
|
+
payment = {
|
22
|
+
:intent => "sale",
|
23
|
+
:transactions => [
|
24
|
+
:amount => {
|
25
|
+
:currency => "USD",
|
26
|
+
:total => "10"
|
27
|
+
}
|
28
|
+
],
|
144
29
|
:redirect_urls => {
|
145
|
-
:
|
146
|
-
:
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
:price => "5",
|
153
|
-
:currency => "USD",
|
154
|
-
:quantity => 1 }]},
|
155
|
-
:amount => {
|
156
|
-
:total => "5",
|
157
|
-
:currency => "USD" },
|
158
|
-
:description => "This is the payment transaction description." }]})
|
159
|
-
|
160
|
-
if @payment.create
|
161
|
-
@payment.id # Payment Id
|
162
|
-
else
|
163
|
-
@payment.error # Error Hash
|
164
|
-
end
|
165
|
-
```
|
166
|
-
|
167
|
-
## Get Payment details
|
168
|
-
|
169
|
-
```ruby
|
170
|
-
# Fetch Payment
|
171
|
-
payment = Payment.find("PAY-57363176S1057143SKE2HO3A")
|
172
|
-
|
173
|
-
# Get List of Payments
|
174
|
-
payment_history = Payment.all( :count => 10 )
|
175
|
-
payment_history.payments
|
176
|
-
```
|
30
|
+
:cancel_url => "http://example.com/cancel",
|
31
|
+
:return_url => "http://example.com/return"
|
32
|
+
},
|
33
|
+
:payer => {
|
34
|
+
:payment_method => "paypal"
|
35
|
+
}
|
36
|
+
}
|
177
37
|
|
178
|
-
## Execute Payment
|
179
38
|
|
180
|
-
|
181
|
-
|
39
|
+
request = PaymentCreateRequest.new
|
40
|
+
request.request_body(payment);
|
182
41
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
42
|
+
begin
|
43
|
+
response = client.execute(request)
|
44
|
+
puts response.status_code
|
45
|
+
puts response.result
|
46
|
+
rescue BraintreeHttp::HttpError => e
|
47
|
+
puts e.status_code
|
48
|
+
puts e.result
|
188
49
|
end
|
189
50
|
```
|
190
51
|
|
191
|
-
|
192
|
-
[Future Payments](https://developer.paypal.com/docs/integration/mobile/make-future-payment/) sample is available [here](https://github.com/paypal/rest-api-sdk-ruby/blob/master/samples/payment/create_future_payment.rb#L149)
|
193
|
-
|
194
|
-
## Webhook event validation
|
195
|
-
See [webhook event validation code sample](https://github.com/paypal/PayPal-Ruby-SDK/blob/master/samples/notifications/verify_webhook_event.rb) and [webhook event validation docs](https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/#event-signature)
|
196
|
-
|
197
|
-
## OpenID Connect
|
198
|
-
|
199
|
-
```ruby
|
200
|
-
# Update client_id, client_secret and redirect_uri
|
201
|
-
PayPal::SDK.configure({
|
202
|
-
:openid_client_id => "client_id",
|
203
|
-
:openid_client_secret => "client_secret",
|
204
|
-
:openid_redirect_uri => "http://google.com"
|
205
|
-
})
|
206
|
-
include PayPal::SDK::OpenIDConnect
|
207
|
-
|
208
|
-
# Generate authorize URL to Get Authorize code
|
209
|
-
puts Tokeninfo.authorize_url( :scope => "openid profile" )
|
210
|
-
|
211
|
-
# Create tokeninfo by using Authorize Code from redirect_uri
|
212
|
-
tokeninfo = Tokeninfo.create("Replace with Authorize Code received on redirect_uri")
|
52
|
+
If you're migrating from v1, check out our [Migration Guide](./docs/Migrating.md) or our [Frequently Asked Questions](./docs/FAQ.md).
|
213
53
|
|
214
|
-
|
215
|
-
tokeninfo.refresh
|
54
|
+
## Building
|
216
55
|
|
217
|
-
|
218
|
-
tokeninfo = Tokeninfo.refresh("Replace with refresh_token")
|
56
|
+
To try this out, update the version of `paypalrestsdk` in your `Gemfile` to `2.0.0.rc2`.
|
219
57
|
|
220
|
-
|
221
|
-
userinfo = tokeninfo.userinfo
|
58
|
+
Please feel free to create an issue in this repo with any feedback, questions, or concerns you have.
|
222
59
|
|
223
|
-
|
224
|
-
userinfo = Userinfo.get("Replace with access_token")
|
60
|
+
## Running tests
|
225
61
|
|
226
|
-
|
227
|
-
|
62
|
+
To run integration tests using your client id and secret, clone this repository and run the following command:
|
63
|
+
```sh
|
64
|
+
$ bundle install
|
65
|
+
$ rspec spec/integration
|
228
66
|
```
|
229
|
-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/paypal/rest-api-sdk-ruby/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
230
|
-
|
231
|
-
|
232
|
-
## Payouts
|
233
67
|
|
234
|
-
|
68
|
+
*NOTE*: This API is still in beta, is subject to change, and should not be used in production.
|
235
69
|
|
236
|
-
|
237
|
-
@payout = Payout.new(
|
238
|
-
{
|
239
|
-
:sender_batch_header => {
|
240
|
-
:sender_batch_id => SecureRandom.hex(8),
|
241
|
-
:email_subject => 'You have a Payout!',
|
242
|
-
},
|
243
|
-
:items => [
|
244
|
-
{
|
245
|
-
:recipient_type => 'EMAIL',
|
246
|
-
:amount => {
|
247
|
-
:value => '1.0',
|
248
|
-
:currency => 'USD'
|
249
|
-
},
|
250
|
-
:note => 'Thanks for your patronage!',
|
251
|
-
:receiver => 'shirt-supplier-one@mail.com',
|
252
|
-
:sender_item_id => "2014031400023",
|
253
|
-
}
|
254
|
-
]
|
255
|
-
}
|
256
|
-
)
|
257
|
-
|
258
|
-
begin
|
259
|
-
@payout_batch = @payout.create
|
260
|
-
logger.info "Created Payout with [#{@payout_batch.batch_header.payout_batch_id}]"
|
261
|
-
rescue ResourceNotFound => err
|
262
|
-
logger.error @payout.error.inspect
|
263
|
-
end
|
264
|
-
```
|
70
|
+
## Feedback
|
265
71
|
|
266
|
-
|
267
|
-
[Braintree Direct](https://www.braintreepayments.com/products/braintree-direct) is PayPal's preferred integration solution for accepting direct credit card payments in your mobile app or website. Braintree, a PayPal service, is the easiest way to accept credit cards, PayPal, and many other payment methods.
|
72
|
+
If you have any suggestions/remarks/feedback related to SDK 2.0.0, feel free to create an issue.
|
268
73
|
|
269
74
|
## License
|
270
|
-
|
75
|
+
PayPal-Ruby-SDK is open source. See the [LICENSE](./LICENSE) file for more info.
|
271
76
|
|
272
|
-
## Contributions
|
273
|
-
|
77
|
+
## Contributions
|
78
|
+
Pull requests and new issues are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
data/lib/lib.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
|
2
|
+
require_relative './paypal/core/access_token'
|
3
|
+
require_relative './paypal/core/paypal_environment'
|
4
|
+
require_relative './paypal/core/paypal_http_client'
|
5
|
+
require_relative './paypal/core/token_requests'
|
6
|
+
require_relative './paypal/core/version'
|
7
|
+
require_relative './v1/billing_agreements/agreement_bill_balance_request'
|
8
|
+
require_relative './v1/billing_agreements/agreement_cancel_request'
|
9
|
+
require_relative './v1/billing_agreements/agreement_create_request'
|
10
|
+
require_relative './v1/billing_agreements/agreement_execute_request'
|
11
|
+
require_relative './v1/billing_agreements/agreement_get_request'
|
12
|
+
require_relative './v1/billing_agreements/agreement_re_activate_request'
|
13
|
+
require_relative './v1/billing_agreements/agreement_set_balance_request'
|
14
|
+
require_relative './v1/billing_agreements/agreement_suspend_request'
|
15
|
+
require_relative './v1/billing_agreements/agreement_transactions_request'
|
16
|
+
require_relative './v1/billing_agreements/agreement_update_request'
|
17
|
+
require_relative './v1/billing_plans/plan_create_request'
|
18
|
+
require_relative './v1/billing_plans/plan_get_request'
|
19
|
+
require_relative './v1/billing_plans/plan_list_request'
|
20
|
+
require_relative './v1/billing_plans/plan_update_request'
|
21
|
+
require_relative './v1/customer_disputes/dispute_accept_claim_request'
|
22
|
+
require_relative './v1/customer_disputes/dispute_adjudicate_request'
|
23
|
+
require_relative './v1/customer_disputes/dispute_appeal_request'
|
24
|
+
require_relative './v1/customer_disputes/dispute_get_request'
|
25
|
+
require_relative './v1/customer_disputes/dispute_list_request'
|
26
|
+
require_relative './v1/customer_disputes/dispute_provide_evidence_request'
|
27
|
+
require_relative './v1/customer_disputes/dispute_require_evidence_request'
|
28
|
+
require_relative './v1/identity/userinfo_get_request'
|
29
|
+
require_relative './v1/identity/user_consent'
|
30
|
+
require_relative './v1/invoices/invoice_cancel_request'
|
31
|
+
require_relative './v1/invoices/invoice_create_request'
|
32
|
+
require_relative './v1/invoices/invoice_delete_external_payment_request'
|
33
|
+
require_relative './v1/invoices/invoice_delete_external_refund_request'
|
34
|
+
require_relative './v1/invoices/invoice_delete_request'
|
35
|
+
require_relative './v1/invoices/invoice_get_request'
|
36
|
+
require_relative './v1/invoices/invoice_list_request'
|
37
|
+
require_relative './v1/invoices/invoice_next_invoice_number_request'
|
38
|
+
require_relative './v1/invoices/invoice_qr_code_request'
|
39
|
+
require_relative './v1/invoices/invoice_record_payment_request'
|
40
|
+
require_relative './v1/invoices/invoice_record_refund_request'
|
41
|
+
require_relative './v1/invoices/invoice_remind_request'
|
42
|
+
require_relative './v1/invoices/invoice_search_request'
|
43
|
+
require_relative './v1/invoices/invoice_send_request'
|
44
|
+
require_relative './v1/invoices/invoice_update_request'
|
45
|
+
require_relative './v1/invoices/template_create_request'
|
46
|
+
require_relative './v1/invoices/template_delete_request'
|
47
|
+
require_relative './v1/invoices/template_get_request'
|
48
|
+
require_relative './v1/invoices/template_list_request'
|
49
|
+
require_relative './v1/invoices/template_update_request'
|
50
|
+
require_relative './v1/orders/orders_cancel_request'
|
51
|
+
require_relative './v1/orders/orders_create_request'
|
52
|
+
require_relative './v1/orders/orders_get_request'
|
53
|
+
require_relative './v1/orders/orders_pay_request'
|
54
|
+
require_relative './v1/payment_experience/web_profile_create_request'
|
55
|
+
require_relative './v1/payment_experience/web_profile_delete_request'
|
56
|
+
require_relative './v1/payment_experience/web_profile_get_request'
|
57
|
+
require_relative './v1/payment_experience/web_profile_list_request'
|
58
|
+
require_relative './v1/payment_experience/web_profile_partial_update_request'
|
59
|
+
require_relative './v1/payment_experience/web_profile_update_request'
|
60
|
+
require_relative './v1/payments/authorization_capture_request'
|
61
|
+
require_relative './v1/payments/authorization_get_request'
|
62
|
+
require_relative './v1/payments/authorization_reauthorize_request'
|
63
|
+
require_relative './v1/payments/authorization_void_request'
|
64
|
+
require_relative './v1/payments/capture_get_request'
|
65
|
+
require_relative './v1/payments/capture_refund_request'
|
66
|
+
require_relative './v1/payments/order_authorize_request'
|
67
|
+
require_relative './v1/payments/order_capture_request'
|
68
|
+
require_relative './v1/payments/order_get_request'
|
69
|
+
require_relative './v1/payments/order_void_request'
|
70
|
+
require_relative './v1/payments/payment_create_request'
|
71
|
+
require_relative './v1/payments/payment_execute_request'
|
72
|
+
require_relative './v1/payments/payment_get_request'
|
73
|
+
require_relative './v1/payments/payment_list_request'
|
74
|
+
require_relative './v1/payments/payment_update_request'
|
75
|
+
require_relative './v1/payments/refund_get_request'
|
76
|
+
require_relative './v1/payments/sale_get_request'
|
77
|
+
require_relative './v1/payments/sale_refund_request'
|
78
|
+
require_relative './v1/sync/search_get_request'
|
79
|
+
require_relative './v1/vault/credit_card_create_request'
|
80
|
+
require_relative './v1/vault/credit_card_delete_request'
|
81
|
+
require_relative './v1/vault/credit_card_get_request'
|
82
|
+
require_relative './v1/vault/credit_card_list_request'
|
83
|
+
require_relative './v1/vault/credit_card_update_request'
|
84
|
+
require_relative './v1/webhooks/available_event_type_list_request'
|
85
|
+
require_relative './v1/webhooks/event_get_request'
|
86
|
+
require_relative './v1/webhooks/event_list_request'
|
87
|
+
require_relative './v1/webhooks/event_resend_request'
|
88
|
+
require_relative './v1/webhooks/simulate_event_request'
|
89
|
+
require_relative './v1/webhooks/webhook_create_request'
|
90
|
+
require_relative './v1/webhooks/webhook_delete_request'
|
91
|
+
require_relative './v1/webhooks/webhook_get_request'
|
92
|
+
require_relative './v1/webhooks/webhook_list_event_subscriptions_request'
|
93
|
+
require_relative './v1/webhooks/webhook_list_request'
|
94
|
+
require_relative './v1/webhooks/webhook_update_request'
|
95
|
+
require_relative './v1/webhooks/webhook_verify_signature_request'
|