Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add endpoint for add tracking info #248

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/mangopay/pay_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module Card
# See http://docs.mangopay.com/api-references/payins/payins-card-web/
class Web < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/card/#{CGI.escape(class_name.downcase)}"
end
Expand All @@ -40,6 +41,7 @@ def self.extended_url(pay_in_id)
# See http://docs.mangopay.com/api-references/payins/payindirectcard/
class Direct < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/card/#{CGI.escape(class_name.downcase)}"
end
Expand All @@ -52,6 +54,7 @@ module PreAuthorized
# See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
class Direct < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/preauthorized/direct"
end
Expand All @@ -68,6 +71,7 @@ module BankWire
# See http://docs.mangopay.com/api-references/payins/payinbankwire/
class Direct < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/bankwire/direct"
end
Expand All @@ -83,6 +87,7 @@ module DirectDebit
# See http://docs.mangopay.com/api-references/payins/direct-debit-pay-in-web/
class Web < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/directdebit/#{CGI.escape(class_name.downcase)}"
end
Expand All @@ -91,6 +96,7 @@ def self.url(*)
# See https://docs.mangopay.com/api-references/payins/direct-debit-pay-in-direct/
class Direct < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/directdebit/#{CGI.escape(class_name.downcase)}"
end
Expand All @@ -105,13 +111,22 @@ module PayPal
# Please use the 'create_v2' function - MangoPay::PayIn::PayPal::Web.create_new(params)
class Web < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/paypal/#{CGI.escape(class_name.downcase)}"
end

def self.create_v2(params, idempotency_key = nil)
MangoPay.request(:post, "#{MangoPay.api_path}/payins/payment-methods/paypal", params, {}, idempotency_key)
end

# Add tracking information to a PayPal PayIn (add the tracking number and carrier for LineItems shipments.)
# Caution – Tracking information cannot be edited
# You can’t modify the TrackingNumber, Carrier, or NotifyBuyer once added.
# You can only send a unique tracking number once.
def self.add_paypal_tracking_information(pay_in_id, params, idempotency_key = nil)
MangoPay.request(:put, "#{MangoPay.api_path}/payins/#{pay_in_id}/trackings", params, {}, idempotency_key)
end
end

end
Expand All @@ -120,6 +135,7 @@ module Payconiq

class Web < Resource
include HTTPCalls::Create

def self.url(*)
"#{MangoPay.api_path}/payins/payconiq/#{CGI.escape(class_name.downcase)}"
end
Expand Down
Loading