-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from cpfergus1/nebulab/import-paypal-sdk
Fix master, import paypal-checkout-sdk
- Loading branch information
Showing
39 changed files
with
995 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: false | ||
|
||
module PayPal | ||
class AccessToken | ||
attr_accessor :access_token, :token_type, :expires_in, :date_created | ||
|
||
def initialize(options) | ||
@access_token = options.access_token | ||
@token_type = options.token_type | ||
@expires_in = options.expires_in | ||
@date_created = Time.zone.now | ||
end | ||
|
||
def expired? | ||
Time.zone.now > @date_created + @expires_in | ||
end | ||
|
||
def authorization_string | ||
"#{@token_type} #{@access_token}" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: false | ||
|
||
require 'paypal/paypal_environment' | ||
require 'paypal/paypal_http_client' | ||
require 'paypal/token_requests' | ||
require 'paypal/access_token' | ||
require 'paypal/paypal_checkout_sdk/orders/orders_authorize_request' | ||
require 'paypal/paypal_checkout_sdk/orders/orders_capture_request' | ||
require 'paypal/paypal_checkout_sdk/orders/orders_create_request' | ||
require 'paypal/paypal_checkout_sdk/orders/orders_get_request' | ||
require 'paypal/paypal_checkout_sdk/orders/orders_patch_request' | ||
require 'paypal/paypal_checkout_sdk/orders/orders_validate_request' | ||
require 'paypal/paypal_checkout_sdk/payments/authorizations_capture_request' | ||
require 'paypal/paypal_checkout_sdk/payments/authorizations_get_request' | ||
require 'paypal/paypal_checkout_sdk/payments/authorizations_reauthorize_request' | ||
require 'paypal/paypal_checkout_sdk/payments/authorizations_void_request' | ||
require 'paypal/paypal_checkout_sdk/payments/captures_get_request' | ||
require 'paypal/paypal_checkout_sdk/payments/refunds_get_request' | ||
require 'paypal/paypal_checkout_sdk/payments/captures_refund_request' |
44 changes: 44 additions & 0 deletions
44
lib/paypal/paypal_checkout_sdk/orders/orders_authorize_request.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# frozen_string_literal: false | ||
|
||
# This class was generated on Mon, 27 Aug 2018 13:51:59 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator | ||
|
||
require 'cgi' | ||
|
||
module PayPalCheckoutSdk | ||
module Orders | ||
# | ||
# Authorizes payment for an order. The response shows details | ||
# of authorizations. You can make this call only if you specified | ||
# `intent=AUTHORIZE` in the create order call. | ||
# | ||
class OrdersAuthorizeRequest | ||
attr_accessor :path, :body, :headers, :verb | ||
|
||
def initialize(order_id) | ||
@headers = {} | ||
@body = nil | ||
@verb = "POST" | ||
@path = "/v2/checkout/orders/{order_id}/authorize?" | ||
|
||
@path = @path.gsub("{order_id}", CGI.escape(order_id.to_s)) | ||
@headers["Content-Type"] = "application/json" | ||
end | ||
|
||
def pay_pal_client_metadata_id(pay_pal_client_metadata_id) | ||
@headers["PayPal-Client-Metadata-Id"] = pay_pal_client_metadata_id | ||
end | ||
|
||
def pay_pal_request_id(pay_pal_request_id) | ||
@headers["PayPal-Request-Id"] = pay_pal_request_id | ||
end | ||
|
||
def prefer(prefer) | ||
@headers["Prefer"] = prefer | ||
end | ||
|
||
def request_body(order_action_request) | ||
@body = order_action_request | ||
end | ||
end | ||
end | ||
end |
42 changes: 42 additions & 0 deletions
42
lib/paypal/paypal_checkout_sdk/orders/orders_capture_request.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: false | ||
|
||
# This class was generated on Mon, 27 Aug 2018 13:51:59 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator | ||
|
||
require 'cgi' | ||
|
||
module PayPalCheckoutSdk | ||
module Orders | ||
# | ||
# Captures a payment for an order. | ||
# | ||
class OrdersCaptureRequest | ||
attr_accessor :path, :body, :headers, :verb | ||
|
||
def initialize(order_id) | ||
@headers = {} | ||
@body = nil | ||
@verb = "POST" | ||
@path = "/v2/checkout/orders/{order_id}/capture?" | ||
|
||
@path = @path.gsub("{order_id}", CGI.escape(order_id.to_s)) | ||
@headers["Content-Type"] = "application/json" | ||
end | ||
|
||
def pay_pal_client_metadata_id(pay_pal_client_metadata_id) | ||
@headers["PayPal-Client-Metadata-Id"] = pay_pal_client_metadata_id | ||
end | ||
|
||
def pay_pal_request_id(pay_pal_request_id) | ||
@headers["PayPal-Request-Id"] = pay_pal_request_id | ||
end | ||
|
||
def prefer(prefer) | ||
@headers["Prefer"] = prefer | ||
end | ||
|
||
def request_body(order_action_request) | ||
@body = order_action_request | ||
end | ||
end | ||
end | ||
end |
36 changes: 36 additions & 0 deletions
36
lib/paypal/paypal_checkout_sdk/orders/orders_create_request.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: false | ||
|
||
# This class was generated on Mon, 27 Aug 2018 13:51:59 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator | ||
|
||
require 'cgi' | ||
|
||
module PayPalCheckoutSdk | ||
module Orders | ||
# | ||
# Creates an order. Supports only orders with one purchase unit. | ||
# | ||
class OrdersCreateRequest | ||
attr_accessor :path, :body, :headers, :verb | ||
|
||
def initialize | ||
@headers = {} | ||
@body = nil | ||
@verb = "POST" | ||
@path = "/v2/checkout/orders?" | ||
@headers["Content-Type"] = "application/json" | ||
end | ||
|
||
def pay_pal_partner_attribution_id(pay_pal_partner_attribution_id) | ||
@headers["PayPal-Partner-Attribution-Id"] = pay_pal_partner_attribution_id | ||
end | ||
|
||
def prefer(prefer) | ||
@headers["Prefer"] = prefer | ||
end | ||
|
||
def request_body(order) | ||
@body = order | ||
end | ||
end | ||
end | ||
end |
26 changes: 26 additions & 0 deletions
26
lib/paypal/paypal_checkout_sdk/orders/orders_get_request.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: false | ||
|
||
# This class was generated on Mon, 27 Aug 2018 13:51:59 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator | ||
|
||
require 'cgi' | ||
|
||
module PayPalCheckoutSdk | ||
module Orders | ||
# | ||
# Shows details for an order, by ID. | ||
# | ||
class OrdersGetRequest | ||
attr_accessor :path, :body, :headers, :verb | ||
|
||
def initialize(order_id) | ||
@headers = {} | ||
@body = nil | ||
@verb = "GET" | ||
@path = "/v2/checkout/orders/{order_id}?" | ||
|
||
@path = @path.gsub("{order_id}", CGI.escape(order_id.to_s)) | ||
@headers["Content-Type"] = "application/json" | ||
end | ||
end | ||
end | ||
end |
77 changes: 77 additions & 0 deletions
77
lib/paypal/paypal_checkout_sdk/orders/orders_patch_request.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# frozen_string_literal: false | ||
|
||
# This class was generated on Mon, 27 Aug 2018 13:51:59 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator | ||
|
||
require 'cgi' | ||
|
||
module PayPalCheckoutSdk | ||
module Orders | ||
# | ||
# Updates an order that has the `CREATED` or `APPROVED` status. You cannot update an order with `COMPLETED` status. | ||
# You can patch these attributes and objects: | ||
# <table> | ||
# <thead> | ||
# <tr> | ||
# <th align="left">Attribute or object</th> | ||
# <th align="left">Operations</th> | ||
# </tr> | ||
# </thead> | ||
# <tbody> | ||
# <tr> | ||
# <td><code>intent</code></td> | ||
# <td align="left">Replace</td> | ||
# </tr> | ||
# <tr> | ||
# <td><code>purchase_units</code></td> | ||
# <td align="left">Replace, add</td> | ||
# </tr> | ||
# <tr> | ||
# <td><code>purchase_units[].custom_id</code></td> | ||
# <td align="left">Replace, add, remove</td> | ||
# </tr> | ||
# <tr> | ||
# <td><code>purchase_units[].description</code></td> | ||
# <td align="left">Replace, add, remove</td> | ||
# </tr> | ||
# <tr> | ||
# <td><code>purchase_units[].payee.email</code></td> | ||
# <td align="left">Replace, add</td> | ||
# </tr> | ||
# <tr> | ||
# <td><code>purchase_units[].shipping</code></td> | ||
# <td align="left">Replace, add, remove</td> | ||
# </tr> | ||
# <tr> | ||
# <td><code>purchase_units[].soft_descriptor</code></td> | ||
# <td align="left">Replace, add, remove</td> | ||
# </tr> | ||
# <tr> | ||
# <td><code>purchase_units[].amount</code></td> | ||
# <td align="left">Replace</td> | ||
# </tr> | ||
# <tr> | ||
# <td><code>purchase_units[].invoice_id</code></td> | ||
# <td align="left">Replace, add, remove</td> | ||
# </tr> | ||
# </tbody> | ||
# </table> | ||
# | ||
class OrdersPatchRequest | ||
attr_accessor :path, :body, :headers, :verb | ||
|
||
def initialize(order_id) | ||
@headers = {} | ||
@body = nil | ||
@verb = "PATCH" | ||
@path = "/v2/checkout/orders/{order_id}?" | ||
|
||
@path = @path.gsub("{order_id}", CGI.escape(order_id.to_s)) | ||
@headers["Content-Type"] = "application/json" | ||
end | ||
|
||
def request_body(patch_request) | ||
@body = patch_request | ||
end | ||
end | ||
end | ||
end |
34 changes: 34 additions & 0 deletions
34
lib/paypal/paypal_checkout_sdk/orders/orders_validate_request.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: false | ||
|
||
# This class was generated on Mon, 27 Aug 2018 13:51:59 PDT by version 0.1.0-dev+904328-dirty of Braintree SDK Generator | ||
|
||
require 'cgi' | ||
|
||
module PayPalCheckoutSdk | ||
module Orders | ||
# | ||
# Validates a payment method and checks it for contingencies. | ||
# | ||
class OrdersValidateRequest | ||
attr_accessor :path, :body, :headers, :verb | ||
|
||
def initialize(order_id) | ||
@headers = {} | ||
@body = nil | ||
@verb = "POST" | ||
@path = "/v2/checkout/orders/{order_id}/validate-payment-method?" | ||
|
||
@path = @path.gsub("{order_id}", CGI.escape(order_id.to_s)) | ||
@headers["Content-Type"] = "application/json" | ||
end | ||
|
||
def pay_pal_client_metadata_id(pay_pal_client_metadata_id) | ||
@headers["PayPal-Client-Metadata-Id"] = pay_pal_client_metadata_id | ||
end | ||
|
||
def request_body(order_action_request) | ||
@body = order_action_request | ||
end | ||
end | ||
end | ||
end |
38 changes: 38 additions & 0 deletions
38
lib/paypal/paypal_checkout_sdk/payments/authorizations_capture_request.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: false | ||
|
||
# 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 | ||
|
||
require 'cgi' | ||
|
||
module PayPalCheckoutSdk | ||
module Payments | ||
# | ||
# Captures an authorized payment, by ID. | ||
# | ||
class AuthorizationsCaptureRequest | ||
attr_accessor :path, :body, :headers, :verb | ||
|
||
def initialize(authorization_id) | ||
@headers = {} | ||
@body = nil | ||
@verb = "POST" | ||
@path = "/v2/payments/authorizations/{authorization_id}/capture?" | ||
|
||
@path = @path.gsub("{authorization_id}", CGI.escape(authorization_id.to_s)) | ||
@headers["Content-Type"] = "application/json" | ||
end | ||
|
||
def pay_pal_request_id(pay_pal_request_id) | ||
@headers["PayPal-Request-Id"] = pay_pal_request_id | ||
end | ||
|
||
def prefer(prefer) | ||
@headers["Prefer"] = prefer | ||
end | ||
|
||
def request_body(capture) | ||
@body = capture | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.