Skip to content

Commit

Permalink
Merge pull request #248 from Mangopay/feature/pay-pal-new-params
Browse files Browse the repository at this point in the history
add endpoint for add tracking info
  • Loading branch information
iulian03 authored Apr 2, 2024
2 parents ae86da9 + ca0ddf7 commit 2968072
Showing 1 changed file with 16 additions and 0 deletions.
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

0 comments on commit 2968072

Please sign in to comment.