Skip to content

Commit

Permalink
Release 1.2.0 (#147)
Browse files Browse the repository at this point in the history
- Merchant-specific DNS names Support
- Adds reverse_payment
- Updates Payment Components
  • Loading branch information
armando-rodriguez-cko authored Aug 28, 2024
1 parent 04e02bc commit 9fa2793
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 37 deletions.
2 changes: 1 addition & 1 deletion lib/checkout_sdk/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module CheckoutSdk
VERSION = '1.1.8'
VERSION = '1.2.0'
end
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,29 @@
end
end

context 'when requesting Giropay source payment' do
it 'requests payment correctly' do
source = CheckoutSdk::Previous::Payments::GiropaySource.new
source.purpose = 'test purpose'

request = CheckoutSdk::Previous::Payments::PaymentRequest.new
request.source = source
request.reference = Helpers::DataFactory::REFERENCE
request.currency = CheckoutSdk::Common::Currency::EUR
request.amount = 100
request.capture = true
request.success_url = 'https://testing.checkout.com/sucess'
request.failure_url = 'https://testing.checkout.com/failure'

response = previous_sdk.payments.request_payment(request)

assert_response response, %w[id
skip 'unavailable' do
context 'when requesting Giropay source payment' do
it 'requests payment correctly' do
source = CheckoutSdk::Previous::Payments::GiropaySource.new
source.purpose = 'test purpose'

request = CheckoutSdk::Previous::Payments::PaymentRequest.new
request.source = source
request.reference = Helpers::DataFactory::REFERENCE
request.currency = CheckoutSdk::Common::Currency::EUR
request.amount = 100
request.capture = true
request.success_url = 'https://testing.checkout.com/sucess'
request.failure_url = 'https://testing.checkout.com/failure'

response = previous_sdk.payments.request_payment(request)

assert_response response, %w[id
status
reference
customer
_links]
end
end
end

Expand Down
40 changes: 21 additions & 19 deletions spec/checkout_sdk/payments/reverse_payments_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
RSpec.describe CheckoutSdk::Payments do
include PaymentsHelper

describe '.reverse_payment' do
context 'when attempt payment' do
it 'reverse payment' do
payment_response = make_card_payment
skip 'unavailable' do
describe '.reverse_payment' do
context 'when attempt payment' do
it 'reverse payment' do
payment_response = make_card_payment

request = CheckoutSdk::Payments::ReverseRequest.new
request.reference = SecureRandom.uuid
request = CheckoutSdk::Payments::ReverseRequest.new
request.reference = SecureRandom.uuid

response = default_sdk.payments.reverse_payment(payment_response.id, request)
assert_response(response, %w[reference
response = default_sdk.payments.reverse_payment(payment_response.id, request)
assert_response(response, %w[reference
action_id
_links])
end
end

it 'reverse payment idempotent' do
payment_response = make_card_payment
it 'reverse payment idempotent' do
payment_response = make_card_payment

request = CheckoutSdk::Payments::ReverseRequest.new
request = CheckoutSdk::Payments::ReverseRequest.new

request.reference = SecureRandom.uuid
idempotency_key = new_idempotency_key
request.reference = SecureRandom.uuid
idempotency_key = new_idempotency_key

proc = lambda { default_sdk.payments.reverse_payment(payment_response.id, request, idempotency_key) }
proc2 = lambda { default_sdk.payments.reverse_payment(payment_response.id, request, idempotency_key) }
proc = lambda { default_sdk.payments.reverse_payment(payment_response.id, request, idempotency_key) }
proc2 = lambda { default_sdk.payments.reverse_payment(payment_response.id, request, idempotency_key) }

reverse_response_1 = retriable(proc)
reverse_response_2 = retriable(proc2)
expect(reverse_response_1.action_id).to eq(reverse_response_2.action_id)
reverse_response_1 = retriable(proc)
reverse_response_2 = retriable(proc2)
expect(reverse_response_1.action_id).to eq(reverse_response_2.action_id)
end
end
end
end
Expand Down

0 comments on commit 9fa2793

Please sign in to comment.