Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions lib/fat_zebra/utilities/apple_pay/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ class Domain < APIResource

class << self

##
# List Apple Pay (web) domains
#
# @return [FatZebra::Utilities::ApplePay::Domains] response
def list
response = request(:get, ENDPOINT_URL)
initialize_from(response)
end

##
# Register an Apple Pay (web) domain
#
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions spec/lib/fat_zebra/utilities/apple_pay/domain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

describe FatZebra::Utilities::ApplePay::Domain do

describe '.list', :vcr do
subject(:list) { FatZebra::Utilities::ApplePay::Domain.list }

it "fetches the merchant domains" do
expect(list).to be_accepted
expect(list.data.length).to eq(2)
expect(list.data.first.raw).to eq(
{
"domain" => "example.com",
"status" => "Active"
}
)
expect(list.data.last.raw).to eq(
{
"domain" => "example2.com",
"status" => "Active"
}
)
end
end

describe '.register!', :vcr do
subject(:create) { FatZebra::Utilities::ApplePay::Domain.register!(domain, valid_payload) }

Expand Down