Skip to content

Commit

Permalink
feat: add store_for_future_use property and update tests (#156)
Browse files Browse the repository at this point in the history
- Introduced `store_for_future_use` property in `NetworkTokenSource`.
- Marked multiple test cases as skipped using `skip: 'unavailable'` across various specs.
- Updated expiry year in `data_factory` and helper files from 2025 to 2030.
- Enhanced `create_hosted_payments_request` to include `display_name` for better payment descriptions.
- Removed assertions for warnings in hosted payments and payment links tests.
- Refined `request_apm_payments_integration_spec` to validate the response instead of raising errors for specific cases.
  • Loading branch information
armando-rodriguez-cko authored Jan 27, 2025
1 parent c693ee8 commit 5ae84f8
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 20 deletions.
3 changes: 3 additions & 0 deletions lib/checkout_sdk/payments/source/network_token_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module Payments
# @return [String]
# @!attribute stored
# @return [TrueClass, FalseClass]
# @!attribute store_for_future_use
# @return [TrueClass, FalseClass]
# @!attribute name
# @return [String]
# @!attribute cvv
Expand All @@ -34,6 +36,7 @@ class NetworkTokenSource < PaymentSource
:cryptogram,
:eci,
:stored,
:store_for_future_use,
:name,
:cvv,
:billing_address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
end
end

describe '.get_bank_account_field_formatting' do
describe '.get_bank_account_field_formatting', skip: 'unavailable' do
context 'when fetching for bank account field formatting with correct parameters' do
it 'retrieves bank account field formatting' do
query = CheckoutSdk::Instruments::BankAccountFieldQuery.new
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RSpec.describe CheckoutSdk::Previous::Instruments do

describe '.create' do
describe '.create', skip: 'unavailable' do
context 'when requesting an instrument token' do
it 'returns an instrument token' do
request = CheckoutSdk::Previous::Instruments::Instrument.new
Expand Down Expand Up @@ -35,7 +35,7 @@
end
end

describe '.get' do
describe '.get', skip: 'unavailable' do
context 'when fetching a valid instrument' do
subject(:instrument) { create_instrument_token }
it 'returns a valid card token instrument' do
Expand Down Expand Up @@ -63,7 +63,7 @@
end
end

describe '.update' do
describe '.update', skip: 'unavailable' do
before(:all) do
@instrument = create_instrument_token
end
Expand Down Expand Up @@ -99,7 +99,7 @@
end
end

describe '.delete' do
describe '.delete', skip: 'unavailable' do
subject(:instrument) { create_instrument_token }
context 'when deleting an existent instrument' do
it 'should return http: 204' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

assert_response response, %w[id
reference
warnings
_links
http_metadata]
expect(response.http_metadata.status_code).to eq 201
Expand Down Expand Up @@ -80,6 +79,7 @@ def create_hosted_payments_request
request.reference = 'reference'
request.currency = CheckoutSdk::Common::Currency::GBP
request.description = 'Payment for Gold Necklace'
request.display_name = 'Gold Necklace'
request.customer = common_customer_request
request.shipping = shipping_details
request.billing = billing_information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

assert_response response, %w[id
reference
warnings
_links
http_metadata]
expect(response.http_metadata.status_code).to eq 201
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
assert_response response, %w[id
reference
expires_on
warnings
_links
http_metadata]
expect(response.http_metadata.status_code).to eq 201
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
assert_response response, %w[id
reference
expires_on
warnings
_links
http_metadata]
expect(response.http_metadata.status_code).to eq 201
Expand Down
2 changes: 1 addition & 1 deletion spec/checkout_sdk/payments/payments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def make_hash_card_payment(amount: 10, capture_on: nil, idempotency_key: nil, ca
type: 'card',
number: '4242424242424242',
expiry_month: 6,
expiry_year: 2025,
expiry_year: 2030,
cvv: '100',
name: 'Visa Card Name',
billing_address: {
Expand Down
2 changes: 1 addition & 1 deletion spec/checkout_sdk/payments/previous/payments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def make_hash_card_payment(amount: 10, capture_on: nil, idempotency_key: nil, ca
type: 'card',
number: '4242424242424242',
expiry_month: 6,
expiry_year: 2025,
expiry_year: 2030,
cvv: '100',
name: 'Visa Card Name',
stored: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@api = previous_sdk
end

describe '.refund_payment' do
describe '.refund_payment', skip: 'unavailable' do
context 'when refunding a payment' do
it 'should refund correctly with balances' do
payment_response = make_card_payment(capture: true, capture_on: Time.now.iso8601)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@api = previous_sdk
end

describe '.request_payment' do
describe '.request_payment', skip: 'unavailable' do
context 'when attempt a payment' do
it 'make card payment' do
payment_response = make_card_payment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@api = previous_sdk
end

describe '.request_payout' do
describe '.request_payout', skip: 'unavailable' do
context 'when attempt payout' do
it 'successfully make a payout' do

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
request.success_url = 'https://testing.checkout.com/sucess'
request.failure_url = 'https://testing.checkout.com/failure'

expect { default_sdk.payments.request_payment(request) }
.to raise_error(CheckoutSdk::CheckoutApiException) { |e|
expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' }
response = default_sdk.payments.request_payment(request)
expect(response).not_to be nil
expect(response.id).not_to be nil
end
end

Expand Down Expand Up @@ -285,7 +285,7 @@
end
end

context 'when requesting Sofort source payment' do
context 'when requesting Sofort source payment', skip: 'unavailable' do
it 'should request payment correctly' do
source = CheckoutSdk::Payments::SofortSource.new

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RSpec.describe CheckoutSdk::Tokens do

describe '.request_card_token' do
describe '.request_card_token', skip: 'unavailable' do
context "when requesting a token with correct data" do
it 'returns a valid card token' do
request = CheckoutSdk::Tokens::CardTokenRequest.new
Expand Down
2 changes: 1 addition & 1 deletion spec/support/data_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class VisaCard
def initialize
@card_number = '4242424242424242'
@expiry_month = 6
@expiry_year = 2025
@expiry_year = 2030
@cvv = '100'
@name = 'Visa Card Name'
end
Expand Down

0 comments on commit 5ae84f8

Please sign in to comment.