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.
Files changed (252) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +5 -14
  3. data/README.md +48 -243
  4. data/lib/lib.rb +95 -0
  5. data/lib/paypal-sdk-rest.rb +1 -2
  6. data/lib/paypal/core/access_token.rb +20 -0
  7. data/lib/paypal/core/paypal_environment.rb +38 -0
  8. data/lib/paypal/core/paypal_http_client.rb +52 -0
  9. data/lib/paypal/core/token_requests.rb +40 -0
  10. data/lib/paypal/core/version.rb +3 -0
  11. data/lib/v1/billing_agreements/agreement_bill_balance_request.rb +35 -0
  12. data/lib/v1/billing_agreements/agreement_cancel_request.rb +35 -0
  13. data/lib/v1/billing_agreements/agreement_create_request.rb +33 -0
  14. data/lib/v1/billing_agreements/agreement_execute_request.rb +31 -0
  15. data/lib/v1/billing_agreements/agreement_get_request.rb +31 -0
  16. data/lib/v1/billing_agreements/agreement_re_activate_request.rb +35 -0
  17. data/lib/v1/billing_agreements/agreement_set_balance_request.rb +35 -0
  18. data/lib/v1/billing_agreements/agreement_suspend_request.rb +35 -0
  19. data/lib/v1/billing_agreements/agreement_transactions_request.rb +41 -0
  20. data/lib/v1/billing_agreements/agreement_update_request.rb +35 -0
  21. data/lib/v1/billing_plans/plan_create_request.rb +33 -0
  22. data/lib/v1/billing_plans/plan_get_request.rb +31 -0
  23. data/lib/v1/billing_plans/plan_list_request.rb +49 -0
  24. data/lib/v1/billing_plans/plan_update_request.rb +35 -0
  25. data/lib/v1/customer_disputes/dispute_accept_claim_request.rb +35 -0
  26. data/lib/v1/customer_disputes/dispute_adjudicate_request.rb +35 -0
  27. data/lib/v1/customer_disputes/dispute_appeal_request.rb +35 -0
  28. data/lib/v1/customer_disputes/dispute_get_request.rb +31 -0
  29. data/lib/v1/customer_disputes/dispute_list_request.rb +59 -0
  30. data/lib/v1/customer_disputes/dispute_provide_evidence_request.rb +35 -0
  31. data/lib/v1/customer_disputes/dispute_require_evidence_request.rb +35 -0
  32. data/lib/v1/identity/user_consent.rb +45 -0
  33. data/lib/v1/identity/userinfo_get_request.rb +33 -0
  34. data/lib/v1/invoices/invoice_cancel_request.rb +35 -0
  35. data/lib/v1/invoices/invoice_create_request.rb +33 -0
  36. data/lib/v1/invoices/invoice_delete_external_payment_request.rb +33 -0
  37. data/lib/v1/invoices/invoice_delete_external_refund_request.rb +33 -0
  38. data/lib/v1/invoices/invoice_delete_request.rb +31 -0
  39. data/lib/v1/invoices/invoice_get_request.rb +31 -0
  40. data/lib/v1/invoices/invoice_list_request.rb +44 -0
  41. data/lib/v1/invoices/invoice_next_invoice_number_request.rb +29 -0
  42. data/lib/v1/invoices/invoice_qr_code_request.rb +46 -0
  43. data/lib/v1/invoices/invoice_record_payment_request.rb +35 -0
  44. data/lib/v1/invoices/invoice_record_refund_request.rb +35 -0
  45. data/lib/v1/invoices/invoice_remind_request.rb +35 -0
  46. data/lib/v1/invoices/invoice_search_request.rb +33 -0
  47. data/lib/v1/invoices/invoice_send_request.rb +36 -0
  48. data/lib/v1/invoices/invoice_update_request.rb +40 -0
  49. data/lib/v1/invoices/template_create_request.rb +33 -0
  50. data/lib/v1/invoices/template_delete_request.rb +31 -0
  51. data/lib/v1/invoices/template_get_request.rb +31 -0
  52. data/lib/v1/invoices/template_list_request.rb +34 -0
  53. data/lib/v1/invoices/template_update_request.rb +35 -0
  54. data/lib/v1/orders/orders_cancel_request.rb +31 -0
  55. data/lib/v1/orders/orders_create_request.rb +33 -0
  56. data/lib/v1/orders/orders_get_request.rb +31 -0
  57. data/lib/v1/orders/orders_pay_request.rb +35 -0
  58. data/lib/v1/payment_experience/web_profile_create_request.rb +33 -0
  59. data/lib/v1/payment_experience/web_profile_delete_request.rb +31 -0
  60. data/lib/v1/payment_experience/web_profile_get_request.rb +31 -0
  61. data/lib/v1/payment_experience/web_profile_list_request.rb +29 -0
  62. data/lib/v1/payment_experience/web_profile_partial_update_request.rb +35 -0
  63. data/lib/v1/payment_experience/web_profile_update_request.rb +35 -0
  64. data/lib/v1/payments/authorization_capture_request.rb +35 -0
  65. data/lib/v1/payments/authorization_get_request.rb +31 -0
  66. data/lib/v1/payments/authorization_reauthorize_request.rb +35 -0
  67. data/lib/v1/payments/authorization_void_request.rb +35 -0
  68. data/lib/v1/payments/capture_get_request.rb +31 -0
  69. data/lib/v1/payments/capture_refund_request.rb +39 -0
  70. data/lib/v1/payments/order_authorize_request.rb +35 -0
  71. data/lib/v1/payments/order_capture_request.rb +35 -0
  72. data/lib/v1/payments/order_get_request.rb +31 -0
  73. data/lib/v1/payments/order_void_request.rb +35 -0
  74. data/lib/v1/payments/payment_create_request.rb +37 -0
  75. data/lib/v1/payments/payment_execute_request.rb +43 -0
  76. data/lib/v1/payments/payment_get_request.rb +31 -0
  77. data/lib/v1/payments/payment_list_request.rb +69 -0
  78. data/lib/v1/payments/payment_update_request.rb +35 -0
  79. data/lib/v1/payments/refund_get_request.rb +31 -0
  80. data/lib/v1/payments/sale_get_request.rb +31 -0
  81. data/lib/v1/payments/sale_refund_request.rb +39 -0
  82. data/lib/v1/sync/search_get_request.rb +99 -0
  83. data/lib/v1/vault/credit_card_create_request.rb +33 -0
  84. data/lib/v1/vault/credit_card_delete_request.rb +31 -0
  85. data/lib/v1/vault/credit_card_get_request.rb +31 -0
  86. data/lib/v1/vault/credit_card_list_request.rb +79 -0
  87. data/lib/v1/vault/credit_card_update_request.rb +35 -0
  88. data/lib/v1/webhooks/available_event_type_list_request.rb +29 -0
  89. data/lib/v1/webhooks/event_get_request.rb +31 -0
  90. data/lib/v1/webhooks/event_list_request.rb +54 -0
  91. data/lib/v1/webhooks/event_resend_request.rb +35 -0
  92. data/lib/v1/webhooks/simulate_event_request.rb +33 -0
  93. data/lib/v1/webhooks/webhook_create_request.rb +33 -0
  94. data/lib/v1/webhooks/webhook_delete_request.rb +31 -0
  95. data/lib/v1/webhooks/webhook_get_request.rb +31 -0
  96. data/lib/v1/webhooks/webhook_list_event_subscriptions_request.rb +31 -0
  97. data/lib/v1/webhooks/webhook_list_request.rb +34 -0
  98. data/lib/v1/webhooks/webhook_update_request.rb +35 -0
  99. data/lib/v1/webhooks/webhook_verify_signature_request.rb +33 -0
  100. data/spec/integration/test_harness.rb +25 -0
  101. data/spec/integration/v1/billing_agreements/agreement_create_spec.rb +69 -0
  102. data/spec/integration/v1/billing_plans/plan_create_spec.rb +12 -0
  103. data/spec/integration/v1/billing_plans/plan_get_spec.rb +16 -0
  104. data/spec/integration/v1/billing_plans/plan_helper.rb +71 -0
  105. data/spec/integration/v1/billing_plans/plan_list_spec.rb +16 -0
  106. data/spec/integration/v1/billing_plans/plan_update_spec.rb +19 -0
  107. data/spec/integration/v1/customer_disputes/dispute_accept_claim_spec.rb +26 -0
  108. data/spec/integration/v1/customer_disputes/dispute_adjudicate_spec.rb +24 -0
  109. data/spec/integration/v1/customer_disputes/dispute_appeal_spec.rb +33 -0
  110. data/spec/integration/v1/customer_disputes/dispute_get_spec.rb +19 -0
  111. data/spec/integration/v1/customer_disputes/dispute_list_spec.rb +17 -0
  112. data/spec/integration/v1/customer_disputes/dispute_provide_evidence_spec.rb +32 -0
  113. data/spec/integration/v1/customer_disputes/dispute_require_evidence_spec.rb +24 -0
  114. data/spec/integration/v1/customer_disputes/test_image.png +0 -0
  115. data/spec/integration/v1/identity/userinfo_get_spec.rb +65 -0
  116. data/spec/integration/v1/invoices/invoice_cancel_spec.rb +23 -0
  117. data/spec/integration/v1/invoices/invoice_create_spec.rb +15 -0
  118. data/spec/integration/v1/invoices/invoice_delete_external_payment_spec.rb +23 -0
  119. data/spec/integration/v1/invoices/invoice_delete_external_refund_spec.rb +21 -0
  120. data/spec/integration/v1/invoices/invoice_delete_spec.rb +16 -0
  121. data/spec/integration/v1/invoices/invoice_get_spec.rb +18 -0
  122. data/spec/integration/v1/invoices/invoice_helper.rb +171 -0
  123. data/spec/integration/v1/invoices/invoice_list_spec.rb +20 -0
  124. data/spec/integration/v1/invoices/invoice_next_invoice_number_spec.rb +14 -0
  125. data/spec/integration/v1/invoices/invoice_qr_code_spec.rb +18 -0
  126. data/spec/integration/v1/invoices/invoice_record_payment_spec.rb +14 -0
  127. data/spec/integration/v1/invoices/invoice_record_refund_spec.rb +14 -0
  128. data/spec/integration/v1/invoices/invoice_remind_spec.rb +22 -0
  129. data/spec/integration/v1/invoices/invoice_search_spec.rb +20 -0
  130. data/spec/integration/v1/invoices/invoice_send_spec.rb +15 -0
  131. data/spec/integration/v1/invoices/invoice_update_spec.rb +26 -0
  132. data/spec/integration/v1/invoices/template_create_spec.rb +14 -0
  133. data/spec/integration/v1/invoices/template_delete_spec.rb +15 -0
  134. data/spec/integration/v1/invoices/template_get_spec.rb +18 -0
  135. data/spec/integration/v1/invoices/template_list_spec.rb +15 -0
  136. data/spec/integration/v1/invoices/template_update_spec.rb +62 -0
  137. data/spec/integration/v1/orders/orders_cancel_spec.rb +15 -0
  138. data/spec/integration/v1/orders/orders_create_spec.rb +17 -0
  139. data/spec/integration/v1/orders/orders_get_spec.rb +18 -0
  140. data/spec/integration/v1/orders/orders_helper.rb +36 -0
  141. data/spec/integration/v1/orders/orders_pay_spec.rb +19 -0
  142. data/spec/integration/v1/payment_experience/pe_helper.rb +35 -0
  143. data/spec/integration/v1/payment_experience/web_profile_create_spec.rb +20 -0
  144. data/spec/integration/v1/payment_experience/web_profile_delete_spec.rb +15 -0
  145. data/spec/integration/v1/payment_experience/web_profile_get_spec.rb +17 -0
  146. data/spec/integration/v1/payment_experience/web_profile_list_spec.rb +18 -0
  147. data/spec/integration/v1/payment_experience/web_profile_partial_update_spec.rb +32 -0
  148. data/spec/integration/v1/payment_experience/web_profile_update_spec.rb +44 -0
  149. data/spec/integration/v1/payments/authorization_capture_spec.rb +17 -0
  150. data/spec/integration/v1/payments/authorization_get_spec.rb +18 -0
  151. data/spec/integration/v1/payments/authorization_reauthorize_spec.rb +26 -0
  152. data/spec/integration/v1/payments/authorization_void_spec.rb +19 -0
  153. data/spec/integration/v1/payments/capture_get_spec.rb +20 -0
  154. data/spec/integration/v1/payments/capture_refund_spec.rb +27 -0
  155. data/spec/integration/v1/payments/order_authorize_spec.rb +20 -0
  156. data/spec/integration/v1/payments/order_capture_spec.rb +21 -0
  157. data/spec/integration/v1/payments/order_get_spec.rb +14 -0
  158. data/spec/integration/v1/payments/order_void_spec.rb +14 -0
  159. data/spec/integration/v1/payments/payment_create_spec.rb +13 -0
  160. data/spec/integration/v1/payments/payment_execute_spec.rb +19 -0
  161. data/spec/integration/v1/payments/payment_get_spec.rb +17 -0
  162. data/spec/integration/v1/payments/payment_list_spec.rb +16 -0
  163. data/spec/integration/v1/payments/payment_update_spec.rb +28 -0
  164. data/spec/integration/v1/payments/payments_helper.rb +78 -0
  165. data/spec/integration/v1/payments/refund_get_spec.rb +19 -0
  166. data/spec/integration/v1/payments/sale_get_spec.rb +18 -0
  167. data/spec/integration/v1/payments/sale_refund_spec.rb +18 -0
  168. data/spec/integration/v1/sync/search_get_spec.rb +34 -0
  169. data/spec/integration/v1/vault/credit_card_create_spec.rb +16 -0
  170. data/spec/integration/v1/vault/credit_card_delete_spec.rb +16 -0
  171. data/spec/integration/v1/vault/credit_card_get_spec.rb +17 -0
  172. data/spec/integration/v1/vault/credit_card_list_spec.rb +18 -0
  173. data/spec/integration/v1/vault/credit_card_update_spec.rb +26 -0
  174. data/spec/integration/v1/vault/vault_helper.rb +28 -0
  175. data/spec/integration/v1/webhooks/available_event_type_list_spec.rb +16 -0
  176. data/spec/integration/v1/webhooks/webhook_create_spec.rb +12 -0
  177. data/spec/integration/v1/webhooks/webhook_delete_spec.rb +13 -0
  178. data/spec/integration/v1/webhooks/webhook_get_spec.rb +16 -0
  179. data/spec/integration/v1/webhooks/webhook_helper.rb +42 -0
  180. data/spec/integration/v1/webhooks/webhook_list_event_subscriptions_spec.rb +16 -0
  181. data/spec/integration/v1/webhooks/webhook_list_spec.rb +15 -0
  182. data/spec/integration/v1/webhooks/webhook_update_spec.rb +29 -0
  183. data/spec/integration/v1/webhooks/webhook_verify_signature_spec.rb +20 -0
  184. data/spec/log/http.log +0 -0
  185. data/spec/log/rest_http.log +0 -0
  186. data/spec/spec_helper.rb +98 -26
  187. data/spec/unit/paypal_http_client_spec.rb +272 -0
  188. metadata +277 -119
  189. data/Rakefile +0 -15
  190. data/data/DigiCertHighAssuranceEVRootCA.pem +0 -23
  191. data/data/DigiCertSHA2ExtendedValidationServerCA.pem +0 -28
  192. data/data/paypal.crt +0 -171
  193. data/lib/generators/paypal/sdk/USAGE +0 -3
  194. data/lib/generators/paypal/sdk/install_generator.rb +0 -17
  195. data/lib/generators/paypal/sdk/templates/paypal.rb +0 -2
  196. data/lib/generators/paypal/sdk/templates/paypal.yml +0 -29
  197. data/lib/paypal-sdk-core.rb +0 -38
  198. data/lib/paypal-sdk/core/api.rb +0 -20
  199. data/lib/paypal-sdk/core/api/base.rb +0 -169
  200. data/lib/paypal-sdk/core/api/data_types/array_with_block.rb +0 -44
  201. data/lib/paypal-sdk/core/api/data_types/base.rb +0 -225
  202. data/lib/paypal-sdk/core/api/data_types/enum.rb +0 -26
  203. data/lib/paypal-sdk/core/api/data_types/simple_types.rb +0 -52
  204. data/lib/paypal-sdk/core/api/ipn.rb +0 -66
  205. data/lib/paypal-sdk/core/api/rest.rb +0 -177
  206. data/lib/paypal-sdk/core/authentication.rb +0 -66
  207. data/lib/paypal-sdk/core/config.rb +0 -253
  208. data/lib/paypal-sdk/core/credential.rb +0 -16
  209. data/lib/paypal-sdk/core/credential/base.rb +0 -27
  210. data/lib/paypal-sdk/core/credential/certificate.rb +0 -32
  211. data/lib/paypal-sdk/core/credential/signature.rb +0 -22
  212. data/lib/paypal-sdk/core/credential/third_party/subject.rb +0 -25
  213. data/lib/paypal-sdk/core/credential/third_party/token.rb +0 -39
  214. data/lib/paypal-sdk/core/exceptions.rb +0 -112
  215. data/lib/paypal-sdk/core/logging.rb +0 -50
  216. data/lib/paypal-sdk/core/openid_connect.rb +0 -140
  217. data/lib/paypal-sdk/core/openid_connect/api.rb +0 -50
  218. data/lib/paypal-sdk/core/openid_connect/data_types.rb +0 -73
  219. data/lib/paypal-sdk/core/openid_connect/get_api.rb +0 -28
  220. data/lib/paypal-sdk/core/openid_connect/request_data_type.rb +0 -52
  221. data/lib/paypal-sdk/core/openid_connect/set_api.rb +0 -36
  222. data/lib/paypal-sdk/core/util.rb +0 -11
  223. data/lib/paypal-sdk/core/util/http_helper.rb +0 -171
  224. data/lib/paypal-sdk/core/util/oauth_signature.rb +0 -64
  225. data/lib/paypal-sdk/core/util/ordered_hash.rb +0 -165
  226. data/lib/paypal-sdk/rest.rb +0 -39
  227. data/lib/paypal-sdk/rest/api.rb +0 -23
  228. data/lib/paypal-sdk/rest/data_types.rb +0 -2596
  229. data/lib/paypal-sdk/rest/error_hash.rb +0 -39
  230. data/lib/paypal-sdk/rest/get_api.rb +0 -20
  231. data/lib/paypal-sdk/rest/request_data_type.rb +0 -53
  232. data/lib/paypal-sdk/rest/set_api.rb +0 -42
  233. data/lib/paypal-sdk/rest/version.rb +0 -7
  234. data/spec/README.md +0 -22
  235. data/spec/config/cacert.pem +0 -171
  236. data/spec/config/cert_key.pem +0 -33
  237. data/spec/config/paypal.yml +0 -35
  238. data/spec/config/sample_data.yml +0 -3
  239. data/spec/core/api/data_type_spec.rb +0 -289
  240. data/spec/core/api/rest_spec.rb +0 -211
  241. data/spec/core/config_spec.rb +0 -192
  242. data/spec/core/logging_spec.rb +0 -28
  243. data/spec/core/openid_connect_spec.rb +0 -153
  244. data/spec/invoice_examples_spec.rb +0 -38
  245. data/spec/payments_examples_spec.rb +0 -437
  246. data/spec/payouts_examples_spec.rb +0 -49
  247. data/spec/rest/data_types_spec.rb +0 -62
  248. data/spec/rest/error_hash_spec.rb +0 -83
  249. data/spec/subscription_examples_spec.rb +0 -227
  250. data/spec/support/sample_data.rb +0 -5
  251. data/spec/web_profile_examples_spec.rb +0 -106
  252. data/spec/webhooks_examples_spec.rb +0 -93
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 2cfaf3280bf9a8f5834cf63a11c11f720792a299a280a8e9488cff71b190f584
4
- data.tar.gz: baf90a20b7ea50d530adba7f2dc0749980985ec750ce097926836de6ec022514
2
+ SHA1:
3
+ metadata.gz: 427c6d4722666af759f0fdef08ffdf13c744ddfd
4
+ data.tar.gz: 568acf30041cb766248d7eb5f07be36c33d68493
5
5
  SHA512:
6
- metadata.gz: a80282311eced59baa9c1d83a84f8e6f259917058c801f2e5f003a430dd8f69a659b1431c3dd42adb9b60bb0793891f86fe0f71124c11e11e93f3288193407c2
7
- data.tar.gz: 1a2ecc8a0e1f904be412cd22c6d690fcda9417f4c666a0846e277d094e78e9214e8ff61948aaa52725eb54761ff352fe0672e3190612c28874301f01abe06e20
6
+ metadata.gz: 508242f3d5d765639f856e0c44eeea940e125bf290369a6ffbdf46a5b8f56a59b81e87d6f5734237b462b7a29de81bad9e9e876538e52b6ef4e92f7d134dcb19
7
+ data.tar.gz: b2fd4bb56102bdcdb8f74202ff25d50ff2c7c5a243c112525883e12dc36b68054d448d866f98743403b61d9305ff7f33cdf3a85afee5ca5ff1339e18ff1009dd
data/Gemfile CHANGED
@@ -1,15 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- gemspec
4
-
5
- #gem 'paypal-sdk-core', :git => "https://github.com/paypal/sdk-core-ruby.git"
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
- ## PayPal REST API Ruby SDK [![Build Status](https://travis-ci.org/paypal/PayPal-Ruby-SDK.svg?branch=master)](https://travis-ci.org/paypal/PayPal-Ruby-SDK) [![Coverage Status](https://coveralls.io/repos/github/paypal/PayPal-Ruby-SDK/badge.svg?branch=master)](https://coveralls.io/github/paypal/PayPal-Ruby-SDK?branch=master)
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
- The PayPal REST SDK provides Ruby APIs to create, process and manage payment.
5
+ ## What's New
5
6
 
7
+ Please see the [CHANGELOG.md](./CHANGELOG.md) for the latest changes.
6
8
 
7
- ## 2.0 Release Candidate!
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
- ## Prerequisites
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
- # Update client_id, client_secret and redirect_uri
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
- # Generate URL to Get Authorize code
106
- puts Tokeninfo.authorize_url( :scope => "openid profile" )
18
+ environment = PayPal::SandboxEnvironment.new('AdV4d6nLHabWLyemrw4BKdO9LjcnioNIOgoz7vD611ObbDUL0kJQfzrdhXEBwnH8QmV-7XZjvjRWn0kg', 'EPKoPC_haZMTq5uM9WXuzoxUVdgzVqHyD5avCyVC1NCIUJeVaNNUZMnzduYIqrdw-carG9LBAizFGMyK')
19
+ client = PayPal::PayPalHttpClient.new(environment)
107
20
 
108
- # Create tokeninfo by using AuthorizeCode from redirect_uri
109
- tokeninfo = Tokeninfo.create("Replace with Authorize Code received on redirect_uri")
110
- puts tokeninfo.to_hash
111
-
112
- # Refresh tokeninfo object
113
- tokeninfo = tokeninfo.refresh
114
- puts tokeninfo.to_hash
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
- :return_url => "http://localhost:3000/payment/execute",
146
- :cancel_url => "http://localhost:3000/" },
147
- :transactions => [{
148
- :item_list => {
149
- :items => [{
150
- :name => "item",
151
- :sku => "item",
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
- ```ruby
181
- payment = Payment.find("PAY-57363176S1057143SKE2HO3A")
39
+ request = PaymentCreateRequest.new
40
+ request.request_body(payment);
182
41
 
183
- if payment.execute( :payer_id => "DUFRQ8GWYMJXC" )
184
- # Success Message
185
- # Note that you'll need to `Payment.find` the payment again to access user info like shipping address
186
- else
187
- payment.error # Error Hash
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
- ## Create Future Payment
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
- # Refresh tokeninfo object
215
- tokeninfo.refresh
54
+ ## Building
216
55
 
217
- # Create tokeninfo by using refresh token
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
- # Get Userinfo
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
- # Get Userinfo by using access token
224
- userinfo = Userinfo.get("Replace with access_token")
60
+ ## Running tests
225
61
 
226
- # Get logout url
227
- logout_url = tokeninfo.logout_url
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
- To make Payouts, you should enable this option in your account at http://developer.paypal.com.
68
+ *NOTE*: This API is still in beta, is subject to change, and should not be used in production.
235
69
 
236
- ```ruby
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
- ## Direct Credit Card Support
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
- Code released under [SDK LICENSE](LICENSE)
75
+ PayPal-Ruby-SDK is open source. See the [LICENSE](./LICENSE) file for more info.
271
76
 
272
- ## Contributions
273
- Pull requests and new issues are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
77
+ ## Contributions
78
+ Pull requests and new issues are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
@@ -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'