solidus_paypal_commerce_platform 0.5.0 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +21 -9
  3. data/.github/stale.yml +1 -17
  4. data/.gitignore +1 -0
  5. data/.rspec +0 -1
  6. data/.rubocop.yml +3 -2
  7. data/CHANGELOG.md +42 -9
  8. data/Gemfile +0 -41
  9. data/README.md +9 -12
  10. data/Rakefile +6 -1
  11. data/app/models/solidus_paypal_commerce_platform/payment_method.rb +6 -5
  12. data/app/models/solidus_paypal_commerce_platform/paypal_address.rb +6 -2
  13. data/app/models/solidus_paypal_commerce_platform/paypal_order.rb +22 -15
  14. data/bin/dummy-app +37 -0
  15. data/bin/rails-dummy-app +17 -0
  16. data/bin/rspec +11 -0
  17. data/bin/sandbox +3 -29
  18. data/lib/generators/solidus_paypal_commerce_platform/install/install_generator.rb +62 -23
  19. data/lib/generators/solidus_paypal_commerce_platform/install/templates/app/assets/javascripts/spree/frontend/solidus_paypal_commerce_platform/button_actions.js +272 -0
  20. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/assets/javascripts/spree/frontend/solidus_paypal_commerce_platform/buttons.js +0 -0
  21. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/assets/javascripts/spree/frontend/solidus_paypal_commerce_platform/namespace.js +0 -0
  22. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/assets/javascripts/spree/frontend/solidus_paypal_commerce_platform.js +7 -0
  23. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/assets/stylesheets/spree/frontend/solidus_paypal_commerce_platform.css +0 -0
  24. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/controllers/solidus_paypal_commerce_platform/orders_controller.rb +2 -1
  25. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/controllers/solidus_paypal_commerce_platform/payments_controller.rb +0 -0
  26. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb +1 -1
  27. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/controllers/solidus_paypal_commerce_platform/shipping_rates_controller.rb +0 -0
  28. data/{app → lib/generators/solidus_paypal_commerce_platform/install/templates/app}/controllers/solidus_paypal_commerce_platform/wizard_controller.rb +0 -0
  29. data/lib/{views/frontend/spree/checkout → generators/solidus_paypal_commerce_platform/install/templates/app/views/checkouts}/payment/_paypal_commerce_platform.html.erb +5 -4
  30. data/lib/{views/frontend/spree → generators/solidus_paypal_commerce_platform/install/templates/app/views}/orders/payment/_paypal_commerce_platform.html.erb +4 -3
  31. data/lib/{views/frontend/spree → generators/solidus_paypal_commerce_platform/install/templates/app/views}/products/payment/_paypal_commerce_platform.html.erb +1 -1
  32. data/lib/{views/frontend → generators/solidus_paypal_commerce_platform/install/templates/app/views}/solidus_paypal_commerce_platform/cart/_cart_buttons.html.erb +0 -0
  33. data/lib/{views/frontend → generators/solidus_paypal_commerce_platform/install/templates/app/views}/solidus_paypal_commerce_platform/payments/_payment.html.erb +0 -0
  34. data/lib/{views/frontend → generators/solidus_paypal_commerce_platform/install/templates/app/views}/solidus_paypal_commerce_platform/product/_product_buttons.html.erb +0 -0
  35. data/lib/{views/frontend → generators/solidus_paypal_commerce_platform/install/templates/app/views}/solidus_paypal_commerce_platform/shared/_javascript_sdk_tag.html.erb +4 -2
  36. data/lib/generators/solidus_paypal_commerce_platform/install/templates/{initializer.rb → config/initializers/solidus_paypal_commerce_platform.rb} +0 -0
  37. data/lib/paypal/paypal_checkout_sdk/orders/orders_authorize_request.rb +0 -2
  38. data/lib/paypal/paypal_checkout_sdk/orders/orders_capture_request.rb +0 -2
  39. data/lib/paypal/paypal_checkout_sdk/orders/orders_create_request.rb +0 -2
  40. data/lib/paypal/paypal_checkout_sdk/orders/orders_get_request.rb +0 -2
  41. data/lib/paypal/paypal_checkout_sdk/orders/orders_patch_request.rb +0 -52
  42. data/lib/paypal/paypal_checkout_sdk/orders/orders_validate_request.rb +0 -2
  43. data/lib/paypal/paypal_checkout_sdk/payments/authorizations_capture_request.rb +0 -2
  44. data/lib/paypal/paypal_checkout_sdk/payments/authorizations_get_request.rb +0 -2
  45. data/lib/paypal/paypal_checkout_sdk/payments/authorizations_reauthorize_request.rb +0 -2
  46. data/lib/paypal/paypal_checkout_sdk/payments/authorizations_void_request.rb +0 -2
  47. data/lib/paypal/paypal_checkout_sdk/payments/captures_get_request.rb +0 -2
  48. data/lib/paypal/paypal_checkout_sdk/payments/captures_refund_request.rb +0 -2
  49. data/lib/paypal/paypal_checkout_sdk/payments/refunds_get_request.rb +0 -2
  50. data/lib/paypal/paypal_http_client.rb +4 -4
  51. data/lib/solidus_paypal_commerce_platform/client.rb +6 -3
  52. data/lib/solidus_paypal_commerce_platform/paypal_checkout_sdk/orders/orders_patch_request.rb +1 -54
  53. data/lib/solidus_paypal_commerce_platform/version.rb +1 -1
  54. data/solidus_paypal_commerce_platform.gemspec +1 -2
  55. data/spec/jobs/solidus_paypal_commerce_platform/fixtures/CHECKOUT.ORDER.COMPLETED.v2.json +121 -0
  56. data/spec/jobs/solidus_paypal_commerce_platform/fixtures/CHECKOUT.ORDER.PROCESSED.v2.json +121 -0
  57. data/spec/jobs/solidus_paypal_commerce_platform/fixtures/PAYMENT.CAPTURE.COMPLETED.v1.json +50 -0
  58. data/spec/jobs/solidus_paypal_commerce_platform/fixtures/PAYMENT.CAPTURE.COMPLETED.v2.json +72 -0
  59. data/spec/jobs/solidus_paypal_commerce_platform/fixtures/PAYMENT.CAPTURE.DENIED.v1.json +50 -0
  60. data/spec/jobs/solidus_paypal_commerce_platform/fixtures/PAYMENT.CAPTURE.DENIED.v2.json +68 -0
  61. data/spec/jobs/solidus_paypal_commerce_platform/fixtures/PAYMENT.CAPTURE.REFUNDED.v1.json +51 -0
  62. data/spec/jobs/solidus_paypal_commerce_platform/fixtures/PAYMENT.CAPTURE.REFUNDED.v2.json +63 -0
  63. data/spec/jobs/solidus_paypal_commerce_platform/webhook_job_spec.rb +44 -0
  64. data/spec/lib/solidus_paypal_commerce_platform/client_spec.rb +21 -0
  65. data/spec/lib/solidus_paypal_commerce_platform/configuration_spec.rb +91 -0
  66. data/spec/models/solidus_paypal_commerce_platform/payment_method_spec.rb +200 -0
  67. data/spec/models/solidus_paypal_commerce_platform/payment_source_spec.rb +119 -0
  68. data/spec/models/solidus_paypal_commerce_platform/paypal_address_spec.rb +67 -0
  69. data/spec/models/solidus_paypal_commerce_platform/paypal_order_spec.rb +80 -0
  70. data/spec/models/solidus_paypal_commerce_platform/state_guesser_spec.rb +38 -0
  71. data/spec/models/solidus_paypal_commerce_platform/wizard_spec.rb +9 -0
  72. data/spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb +36 -0
  73. data/spec/requests/solidus_paypal_commerce_platform/shipping_rates_controller_spec.rb +44 -0
  74. data/spec/requests/solidus_paypal_commerce_platform/wizard_controller_spec.rb +59 -0
  75. data/spec/solidus_paypal_commerce_platform_spec_helper.rb +5 -0
  76. data/spec/support/solidus_paypal_commerce_platform/factories.rb +5 -0
  77. data/spec/support/solidus_paypal_commerce_platform/paypal_sdk_script_tag_helper.rb +13 -0
  78. data/spec/system/backend/new_payment_method_spec.rb +40 -0
  79. data/spec/system/frontend/cart_spec.rb +53 -0
  80. data/spec/system/frontend/checkout_spec.rb +104 -0
  81. data/spec/system/frontend/product_spec.rb +98 -0
  82. metadata +53 -37
  83. data/app/assets/javascripts/spree/frontend/solidus_paypal_commerce_platform/button_actions.js +0 -203
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # This class was generated on Mon, 27 Aug 2018 13:52:18 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator
4
-
5
3
  require 'cgi'
6
4
 
7
5
  module PayPalCheckoutSdk
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # This class was generated on Mon, 27 Aug 2018 13:52:18 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator
4
-
5
3
  require 'cgi'
6
4
 
7
5
  module PayPalCheckoutSdk
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # This class was generated on Mon, 27 Aug 2018 13:52:18 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator
4
-
5
3
  require 'cgi'
6
4
 
7
5
  module PayPalCheckoutSdk
@@ -11,8 +11,8 @@ module PayPal
11
11
  super(environment)
12
12
  @refresh_token = refresh_token
13
13
 
14
- add_injector(&:_sign_request)
15
- add_injector(&:_add_headers)
14
+ add_injector { |r| _sign_request(r) }
15
+ add_injector { |r| _add_headers(r) }
16
16
  end
17
17
 
18
18
  def user_agent
@@ -27,10 +27,10 @@ module PayPal
27
27
  end
28
28
 
29
29
  def _sign_request(request)
30
- return if !_has_auth_header(request) && !_is_auth_request(request)
30
+ return if _has_auth_header(request) || _is_auth_request(request)
31
31
 
32
32
  if !@access_token || @access_token.expired?
33
- access_token_request = PayPal.access_token_request.new(@environment, @refresh_token)
33
+ access_token_request = PayPal::AccessTokenRequest.new(@environment, @refresh_token)
34
34
  token_response = execute(access_token_request)
35
35
  @access_token = PayPal::AccessToken.new(token_response.result)
36
36
  end
@@ -13,7 +13,7 @@ module SolidusPaypalCommercePlatform
13
13
  request.headers["PayPal-Partner-Attribution-Id"] = SolidusPaypalCommercePlatform.config.partner_code
14
14
  }.freeze
15
15
 
16
- Response = Struct.new(:status_code, :error)
16
+ Response = Struct.new(:status_code, :error, keyword_init: true)
17
17
 
18
18
  attr_reader :environment
19
19
 
@@ -28,9 +28,12 @@ module SolidusPaypalCommercePlatform
28
28
  end
29
29
 
30
30
  def execute(request)
31
- @paypal_client.execute(request)
31
+ Rails.logger.info "[SolidusPaypalCommercePlatform::Client#execute] #{request.inspect}"
32
+ @paypal_client.execute(request).tap do |response|
33
+ Rails.logger.info "[SolidusPaypalCommercePlatform::Client#execute] #{response.inspect}"
34
+ end
32
35
  rescue PayPalHttp::HttpError => e
33
- Rails.logger.error e.result
36
+ Rails.logger.error "[SolidusPaypalCommercePlatform::Client#execute] #{e.result.inspect}"
34
37
  Response.new(status_code: 422, error: e.result)
35
38
  end
36
39
 
@@ -1,63 +1,10 @@
1
- # frozen_string_literal: true
1
+ # frozen_string_literal: false
2
2
 
3
- # frozen_string_literal :true
4
-
5
- # This module was automatically generated from paypal_checkout_sdk 1.0.1
6
3
  require 'cgi'
7
4
 
8
5
  module SolidusPaypalCommercePlatform
9
6
  module PayPalCheckoutSdk
10
7
  module Orders
11
- #
12
- # Updates an order that has the `CREATED` or `APPROVED` status. You cannot update
13
- # an order with `COMPLETED` status. You can patch these attributes and objects:
14
- # <table>
15
- # <thead>
16
- # <tr>
17
- # <th align="left">Attribute or object</th>
18
- # <th align="left">Operations</th>
19
- # </tr>
20
- # </thead>
21
- # <tbody>
22
- # <tr>
23
- # <td><code>intent</code></td>
24
- # <td align="left">Replace</td>
25
- # </tr>
26
- # <tr>
27
- # <td><code>purchase_units</code></td>
28
- # <td align="left">Replace, add</td>
29
- # </tr>
30
- # <tr>
31
- # <td><code>purchase_units[].custom_id</code></td>
32
- # <td align="left">Replace, add, remove</td>
33
- # </tr>
34
- # <tr>
35
- # <td><code>purchase_units[].description</code></td>
36
- # <td align="left">Replace, add, remove</td>
37
- # </tr>
38
- # <tr>
39
- # <td><code>purchase_units[].payee.email</code></td>
40
- # <td align="left">Replace, add</td>
41
- # </tr>
42
- # <tr>
43
- # <td><code>purchase_units[].shipping</code></td>
44
- # <td align="left">Replace, add, remove</td>
45
- # </tr>
46
- # <tr>
47
- # <td><code>purchase_units[].soft_descriptor</code></td>
48
- # <td align="left">Replace, add, remove</td>
49
- # </tr>
50
- # <tr>
51
- # <td><code>purchase_units[].amount</code></td>
52
- # <td align="left">Replace</td>
53
- # </tr>
54
- # <tr>
55
- # <td><code>purchase_units[].invoice_id</code></td>
56
- # <td align="left">Replace, add, remove</td>
57
- # </tr>
58
- # </tbody>
59
- # </table>
60
- #
61
8
  class OrdersPatchRequest
62
9
  attr_accessor :path, :body, :headers, :verb
63
10
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusPaypalCommercePlatform
4
- VERSION = '0.5.0'
4
+ VERSION = '1.0.0.beta1'
5
5
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
24
  files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
25
25
 
26
- spec.files = files.grep_v(%r{^(test|spec|features)/})
26
+ spec.files = files # don't exclude specs, they need to be copied to the target app
27
27
  spec.bindir = "exe"
28
28
  spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
@@ -36,6 +36,5 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.add_dependency 'paypalhttp'
38
38
 
39
- spec.add_development_dependency 'cuprite'
40
39
  spec.add_development_dependency 'solidus_dev_support', '~> 2.5'
41
40
  end
@@ -0,0 +1,121 @@
1
+ {
2
+ "id": "WH-COC11055RA711503B-4YM959094A144403T",
3
+ "create_time": "2018-04-16T21:21:49.000Z",
4
+ "resource_type": "checkout-order",
5
+ "event_type": "CHECKOUT.ORDER.COMPLETED",
6
+ "summary": "Checkout Order Completed",
7
+ "resource": {
8
+ "update_time": "2018-04-01T21:20:49Z",
9
+ "create_time": "2018-04-01T21:18:49Z",
10
+ "purchase_units": [
11
+ {
12
+ "reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
13
+ "amount": {
14
+ "currency_code": "USD",
15
+ "value": "100.00"
16
+ },
17
+ "payee": {
18
+ "email_address": "seller@example.com"
19
+ },
20
+ "shipping": {
21
+ "method": "United States Postal Service",
22
+ "address": {
23
+ "address_line_1": "2211 N First Street",
24
+ "address_line_2": "Building 17",
25
+ "admin_area_2": "San Jose",
26
+ "admin_area_1": "CA",
27
+ "postal_code": "95131",
28
+ "country_code": "US"
29
+ }
30
+ },
31
+ "payments": {
32
+ "captures": [
33
+ {
34
+ "id": "3C679366HH908993F",
35
+ "status": "COMPLETED",
36
+ "amount": {
37
+ "currency_code": "USD",
38
+ "value": "100.00"
39
+ },
40
+ "seller_protection": {
41
+ "status": "ELIGIBLE",
42
+ "dispute_categories": [
43
+ "ITEM_NOT_RECEIVED",
44
+ "UNAUTHORIZED_TRANSACTION"
45
+ ]
46
+ },
47
+ "final_capture": true,
48
+ "seller_receivable_breakdown": {
49
+ "gross_amount": {
50
+ "currency_code": "USD",
51
+ "value": "100.00"
52
+ },
53
+ "paypal_fee": {
54
+ "currency_code": "USD",
55
+ "value": "3.00"
56
+ },
57
+ "net_amount": {
58
+ "currency_code": "USD",
59
+ "value": "97.00"
60
+ }
61
+ },
62
+ "create_time": "2018-04-01T21:20:49Z",
63
+ "update_time": "2018-04-01T21:20:49Z",
64
+ "links": [
65
+ {
66
+ "href": "https://api.paypal.com/v2/payments/captures/3C679366HH908993F",
67
+ "rel": "self",
68
+ "method": "GET"
69
+ },
70
+ {
71
+ "href": "https://api.paypal.com/v2/payments/captures/3C679366HH908993F/refund",
72
+ "rel": "refund",
73
+ "method": "POST"
74
+ }
75
+ ]
76
+ }
77
+ ]
78
+ }
79
+ }
80
+ ],
81
+ "links": [
82
+ {
83
+ "href": "https://api.paypal.com/v2/checkout/orders/5O190127TN364715T",
84
+ "rel": "self",
85
+ "method": "GET"
86
+ }
87
+ ],
88
+ "id": "5O190127TN364715T",
89
+ "gross_amount": {
90
+ "currency_code": "USD",
91
+ "value": "100.00"
92
+ },
93
+ "intent": "CAPTURE",
94
+ "payer": {
95
+ "name": {
96
+ "given_name": "John",
97
+ "surname": "Doe"
98
+ },
99
+ "email_address": "buyer@example.com",
100
+ "payer_id": "QYR5Z8XDVJNXQ"
101
+ },
102
+ "status": "COMPLETED"
103
+ },
104
+ "links": [
105
+ {
106
+ "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-COC11055RA711503B-4YM959094A144403T",
107
+ "rel": "self",
108
+ "method": "GET",
109
+ "encType": "application/json"
110
+ },
111
+ {
112
+ "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-COC11055RA711503B-4YM959094A144403T/resend",
113
+ "rel": "resend",
114
+ "method": "POST",
115
+ "encType": "application/json"
116
+ }
117
+ ],
118
+ "event_version": "1.0",
119
+ "zts": 1494957670,
120
+ "resource_version": "2.0"
121
+ }
@@ -0,0 +1,121 @@
1
+ {
2
+ "id": "WH-COC11055RA711503B-4YM959094A144403T",
3
+ "create_time": "2018-04-16T21:21:49.000Z",
4
+ "resource_type": "checkout-order",
5
+ "event_type": "CHECKOUT.ORDER.COMPLETED",
6
+ "summary": "Checkout Order Completed",
7
+ "resource": {
8
+ "update_time": "2018-04-01T21:20:49Z",
9
+ "create_time": "2018-04-01T21:18:49Z",
10
+ "purchase_units": [
11
+ {
12
+ "reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
13
+ "amount": {
14
+ "currency_code": "USD",
15
+ "value": "100.00"
16
+ },
17
+ "payee": {
18
+ "email_address": "seller@example.com"
19
+ },
20
+ "shipping": {
21
+ "method": "United States Postal Service",
22
+ "address": {
23
+ "address_line_1": "2211 N First Street",
24
+ "address_line_2": "Building 17",
25
+ "admin_area_2": "San Jose",
26
+ "admin_area_1": "CA",
27
+ "postal_code": "95131",
28
+ "country_code": "US"
29
+ }
30
+ },
31
+ "payments": {
32
+ "captures": [
33
+ {
34
+ "id": "3C679366HH908993F",
35
+ "status": "COMPLETED",
36
+ "amount": {
37
+ "currency_code": "USD",
38
+ "value": "100.00"
39
+ },
40
+ "seller_protection": {
41
+ "status": "ELIGIBLE",
42
+ "dispute_categories": [
43
+ "ITEM_NOT_RECEIVED",
44
+ "UNAUTHORIZED_TRANSACTION"
45
+ ]
46
+ },
47
+ "final_capture": true,
48
+ "seller_receivable_breakdown": {
49
+ "gross_amount": {
50
+ "currency_code": "USD",
51
+ "value": "100.00"
52
+ },
53
+ "paypal_fee": {
54
+ "currency_code": "USD",
55
+ "value": "3.00"
56
+ },
57
+ "net_amount": {
58
+ "currency_code": "USD",
59
+ "value": "97.00"
60
+ }
61
+ },
62
+ "create_time": "2018-04-01T21:20:49Z",
63
+ "update_time": "2018-04-01T21:20:49Z",
64
+ "links": [
65
+ {
66
+ "href": "https://api.paypal.com/v2/payments/captures/3C679366HH908993F",
67
+ "rel": "self",
68
+ "method": "GET"
69
+ },
70
+ {
71
+ "href": "https://api.paypal.com/v2/payments/captures/3C679366HH908993F/refund",
72
+ "rel": "refund",
73
+ "method": "POST"
74
+ }
75
+ ]
76
+ }
77
+ ]
78
+ }
79
+ }
80
+ ],
81
+ "links": [
82
+ {
83
+ "href": "https://api.paypal.com/v2/checkout/orders/5O190127TN364715T",
84
+ "rel": "self",
85
+ "method": "GET"
86
+ }
87
+ ],
88
+ "id": "5O190127TN364715T",
89
+ "gross_amount": {
90
+ "currency_code": "USD",
91
+ "value": "100.00"
92
+ },
93
+ "intent": "CAPTURE",
94
+ "payer": {
95
+ "name": {
96
+ "given_name": "John",
97
+ "surname": "Doe"
98
+ },
99
+ "email_address": "buyer@example.com",
100
+ "payer_id": "QYR5Z8XDVJNXQ"
101
+ },
102
+ "status": "COMPLETED"
103
+ },
104
+ "links": [
105
+ {
106
+ "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-COC11055RA711503B-4YM959094A144403T",
107
+ "rel": "self",
108
+ "method": "GET",
109
+ "encType": "application/json"
110
+ },
111
+ {
112
+ "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-COC11055RA711503B-4YM959094A144403T/resend",
113
+ "rel": "resend",
114
+ "method": "POST",
115
+ "encType": "application/json"
116
+ }
117
+ ],
118
+ "event_version": "1.0",
119
+ "zts": 1494957670,
120
+ "resource_version": "2.0"
121
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "id": "WH-7Y7254563A4550640-11V2185806837105M",
3
+ "create_time": "2015-02-17T18:51:33Z",
4
+ "resource_type": "capture",
5
+ "event_type": "PAYMENT.CAPTURE.COMPLETED",
6
+ "summary": "Payment completed for $ 7.47 USD",
7
+ "resource": {
8
+ "parent_payment": "PAY-3YE025760C441402AKTRY2PQ",
9
+ "update_time": "2015-02-17T18:50:45Z",
10
+ "amount": {
11
+ "total": "7.47",
12
+ "currency": "USD"
13
+ },
14
+ "create_time": "2015-02-17T18:50:44Z",
15
+ "links": [
16
+ {
17
+ "href": "https://api.paypal.com/v1/payments/capture/42311647XV020574X",
18
+ "rel": "self",
19
+ "method": "GET"
20
+ },
21
+ {
22
+ "href": "https://api.paypal.com/v1/payments/capture/42311647XV020574X/refund",
23
+ "rel": "refund",
24
+ "method": "POST"
25
+ },
26
+ {
27
+ "href": "https://api.paypal.com/v1/payments/payment/PAY-3YE025760C441402AKTRY2PQ",
28
+ "rel": "parent_payment",
29
+ "method": "GET"
30
+ }
31
+ ],
32
+ "id": "42311647XV020574X",
33
+ "state": "completed"
34
+ },
35
+ "links": [
36
+ {
37
+ "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-7Y7254563A4550640-11V2185806837105M",
38
+ "rel": "self",
39
+ "method": "GET",
40
+ "encType": "application/json"
41
+ },
42
+ {
43
+ "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-7Y7254563A4550640-11V2185806837105M/resend",
44
+ "rel": "resend",
45
+ "method": "POST",
46
+ "encType": "application/json"
47
+ }
48
+ ],
49
+ "event_version": "1.0"
50
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "id": "WH-58D329510W468432D-8HN650336L201105X",
3
+ "create_time": "2019-02-14T21:50:07.940Z",
4
+ "resource_type": "capture",
5
+ "event_type": "PAYMENT.CAPTURE.COMPLETED",
6
+ "summary": "Payment completed for $ 2.51 USD",
7
+ "resource": {
8
+ "amount": {
9
+ "currency_code": "USD",
10
+ "value": "2.51"
11
+ },
12
+ "seller_protection": {
13
+ "status": "ELIGIBLE",
14
+ "dispute_categories": [
15
+ "ITEM_NOT_RECEIVED",
16
+ "UNAUTHORIZED_TRANSACTION"
17
+ ]
18
+ },
19
+ "update_time": "2019-02-14T21:49:58Z",
20
+ "create_time": "2019-02-14T21:49:58Z",
21
+ "final_capture": true,
22
+ "seller_receivable_breakdown": {
23
+ "gross_amount": {
24
+ "currency_code": "USD",
25
+ "value": "2.51"
26
+ },
27
+ "paypal_fee": {
28
+ "currency_code": "USD",
29
+ "value": "0.37"
30
+ },
31
+ "net_amount": {
32
+ "currency_code": "USD",
33
+ "value": "2.14"
34
+ }
35
+ },
36
+ "links": [
37
+ {
38
+ "href": "https://api.paypal.com/v2/payments/captures/27M47624FP291604U",
39
+ "rel": "self",
40
+ "method": "GET"
41
+ },
42
+ {
43
+ "href": "https://api.paypal.com/v2/payments/captures/27M47624FP291604U/refund",
44
+ "rel": "refund",
45
+ "method": "POST"
46
+ },
47
+ {
48
+ "href": "https://api.paypal.com/v2/payments/authorizations/7W5147081L658180V",
49
+ "rel": "up",
50
+ "method": "GET"
51
+ }
52
+ ],
53
+ "id": "27M47624FP291604U",
54
+ "status": "COMPLETED"
55
+ },
56
+ "links": [
57
+ {
58
+ "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-58D329510W468432D-8HN650336L201105X",
59
+ "rel": "self",
60
+ "method": "GET",
61
+ "encType": "application/json"
62
+ },
63
+ {
64
+ "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-58D329510W468432D-8HN650336L201105X/resend",
65
+ "rel": "resend",
66
+ "method": "POST",
67
+ "encType": "application/json"
68
+ }
69
+ ],
70
+ "event_version": "1.0",
71
+ "resource_version": "2.0"
72
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "id": "WH-8Y6524781B2662740-6BA13970S75831204",
3
+ "create_time": "2015-10-07T16:58:15Z",
4
+ "resource_type": "capture",
5
+ "event_type": "PAYMENT.CAPTURE.DENIED",
6
+ "summary": "A EUR 0.5 EUR capture payment was denied",
7
+ "resource": {
8
+ "parent_payment": "PAY-6AG64245W53716013KYKUWNI",
9
+ "update_time": "2015-10-07T16:42:57Z",
10
+ "amount": {
11
+ "total": "0.50",
12
+ "currency": "EUR"
13
+ },
14
+ "create_time": "2015-10-07T16:42:50Z",
15
+ "links": [
16
+ {
17
+ "href": "https://api.paypal.com/v1/payments/capture/1YH34677BD7819356",
18
+ "rel": "self",
19
+ "method": "GET"
20
+ },
21
+ {
22
+ "href": "https://api.paypal.com/v1/payments/capture/1YH34677BD7819356/refund",
23
+ "rel": "refund",
24
+ "method": "POST"
25
+ },
26
+ {
27
+ "href": "https://api.paypal.com/v1/payments/payment/PAY-6AG64245W53716013KYKUWNI",
28
+ "rel": "parent_payment",
29
+ "method": "GET"
30
+ }
31
+ ],
32
+ "id": "1YH34677BD7819356",
33
+ "state": "denied"
34
+ },
35
+ "links": [
36
+ {
37
+ "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-8Y6524781B2662740-6BA13970S75831204",
38
+ "rel": "self",
39
+ "method": "GET",
40
+ "encType": "application/json"
41
+ },
42
+ {
43
+ "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-8Y6524781B2662740-6BA13970S75831204/resend",
44
+ "rel": "resend",
45
+ "method": "POST",
46
+ "encType": "application/json"
47
+ }
48
+ ],
49
+ "event_version": "1.0"
50
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "id": "WH-4SW78779LY2325805-07E03580SX1414828",
3
+ "create_time": "2019-02-14T22:20:08.370Z",
4
+ "resource_type": "capture",
5
+ "event_type": "PAYMENT.CAPTURE.DENIED",
6
+ "summary": "A AUD 2.51 AUD capture payment was denied",
7
+ "resource": {
8
+ "amount": {
9
+ "currency_code": "AUD",
10
+ "value": "2.51"
11
+ },
12
+ "seller_protection": {
13
+ "status": "ELIGIBLE",
14
+ "dispute_categories": [
15
+ "ITEM_NOT_RECEIVED",
16
+ "UNAUTHORIZED_TRANSACTION"
17
+ ]
18
+ },
19
+ "update_time": "2019-02-14T22:20:01Z",
20
+ "create_time": "2019-02-14T22:18:14Z",
21
+ "final_capture": true,
22
+ "seller_receivable_breakdown": {
23
+ "gross_amount": {
24
+ "currency_code": "AUD",
25
+ "value": "2.51"
26
+ },
27
+ "net_amount": {
28
+ "currency_code": "AUD",
29
+ "value": "2.51"
30
+ }
31
+ },
32
+ "links": [
33
+ {
34
+ "href": "https://api.paypal.com/v2/payments/captures/7NW873794T343360M",
35
+ "rel": "self",
36
+ "method": "GET"
37
+ },
38
+ {
39
+ "href": "https://api.paypal.com/v2/payments/captures/7NW873794T343360M/refund",
40
+ "rel": "refund",
41
+ "method": "POST"
42
+ },
43
+ {
44
+ "href": "https://api.paypal.com/v2/payments/authorizations/2W543679LP5841156",
45
+ "rel": "up",
46
+ "method": "GET"
47
+ }
48
+ ],
49
+ "id": "7NW873794T343360M",
50
+ "status": "DECLINED"
51
+ },
52
+ "links": [
53
+ {
54
+ "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-4SW78779LY2325805-07E03580SX1414828",
55
+ "rel": "self",
56
+ "method": "GET",
57
+ "encType": "application/json"
58
+ },
59
+ {
60
+ "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-4SW78779LY2325805-07E03580SX1414828/resend",
61
+ "rel": "resend",
62
+ "method": "POST",
63
+ "encType": "application/json"
64
+ }
65
+ ],
66
+ "event_version": "1.0",
67
+ "resource_version": "2.0"
68
+ }