Skip to content

Commit

Permalink
DLocal: Add X-Dlocal-Payment-Source to header
Browse files Browse the repository at this point in the history
Remote
40 tests, 110 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
  • Loading branch information
Alma Malambo committed Oct 16, 2024
1 parent 32b58d6 commit 41b5794
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
* Orbital: Update alternate_ucaf_flow [almalee24] #5282
* Adyen: Remove cryptogram flag [almalee24] #5300
* Cecabank: Include Apple Pay and Google Pay for recurring payments [gasn150] #5295
* DLocal: Add X-Dlocal-Payment-Source to header [almalee24] #5281

== Version 1.137.0 (August 2, 2024)
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).
Expand Down
1 change: 1 addition & 0 deletions lib/active_merchant/billing/gateways/d_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ def headers(post, options = {})
'Authorization' => signature(post, timestamp)
}
headers['X-Idempotency-Key'] = options[:idempotency_key] if options[:idempotency_key]
headers['X-Dlocal-Payment-Source'] = application_id if application_id
headers
end

Expand Down
2 changes: 1 addition & 1 deletion test/remote/gateways/remote_d_local_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'test_helper'

ActiveMerchant::Billing::DLocalGateway.application_id = 'ActiveMerchant'
class RemoteDLocalTest < Test::Unit::TestCase
def setup
@gateway = DLocalGateway.new(fixtures(:d_local))
Expand Down
4 changes: 3 additions & 1 deletion test/unit/gateways/d_local_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def test_successful_purchase
end

def test_purchase_with_save
DLocalGateway.application_id = 'ActiveMerchant'
stub_comms do
@gateway.purchase(@amount, @credit_card, @options.merge(save: true))
end.check_request do |_endpoint, data, _headers|
end.check_request do |_endpoint, data, headers|
assert_equal true, JSON.parse(data)['card']['save']
assert_equal 'ActiveMerchant', headers['X-Dlocal-Payment-Source']
end.respond_with(successful_purchase_response)
end

Expand Down

0 comments on commit 41b5794

Please sign in to comment.