Class: Paysafe::Api::CustomerVaultApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/paysafe/api/customer_vault_api.rb

Constant Summary

Constants inherited from BaseApi

BaseApi::HEADERS

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize

Constructor Details

This class inherits a constructor from Paysafe::Api::BaseApi

Instance Method Details

#create_address(profile_id:, country:, zip:, **args) ⇒ Object



5
6
7
8
# File 'lib/paysafe/api/customer_vault_api.rb', line 5

def create_address(profile_id:, country:, zip:, **args)
  data = args.merge({ country: country, zip: zip })
  perform_post_with_object("/customervault/v1/profiles/#{profile_id}/addresses", data, Address)
end

#create_card(profile_id:, **data) ⇒ Object



10
11
12
# File 'lib/paysafe/api/customer_vault_api.rb', line 10

def create_card(profile_id:, **data)
  perform_post_with_object("/customervault/v1/profiles/#{profile_id}/cards", data, Card)
end

#create_profile(merchant_customer_id:, locale:, **args) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/paysafe/api/customer_vault_api.rb', line 14

def create_profile(merchant_customer_id:, locale:, **args)
  data = args.merge({
    merchant_customer_id: merchant_customer_id,
    locale: locale
  })

  perform_post_with_object("/customervault/v1/profiles", data, Profile)
end

#create_single_use_token(**data) ⇒ Object



23
24
25
# File 'lib/paysafe/api/customer_vault_api.rb', line 23

def create_single_use_token(**data)
  perform_post_with_object("/customervault/v1/singleusetokens", data, SingleUseToken)
end

#delete_address(profile_id:, id:) ⇒ Object



27
28
29
# File 'lib/paysafe/api/customer_vault_api.rb', line 27

def delete_address(profile_id:, id:)
  perform_delete("/customervault/v1/profiles/#{profile_id}/addresses/#{id}")
end

#delete_card(profile_id:, id:) ⇒ Object



31
32
33
# File 'lib/paysafe/api/customer_vault_api.rb', line 31

def delete_card(profile_id:, id:)
  perform_delete("/customervault/v1/profiles/#{profile_id}/cards/#{id}")
end

#delete_profile(id:) ⇒ Object



35
36
37
# File 'lib/paysafe/api/customer_vault_api.rb', line 35

def delete_profile(id:)
  perform_delete("/customervault/v1/profiles/#{id}")
end

#get_address(profile_id:, id:) ⇒ Object



39
40
41
# File 'lib/paysafe/api/customer_vault_api.rb', line 39

def get_address(profile_id:, id:)
  perform_get_with_object("/customervault/v1/profiles/#{profile_id}/addresses/#{id}", Address)
end

#get_card(profile_id:, id:) ⇒ Object



43
44
45
# File 'lib/paysafe/api/customer_vault_api.rb', line 43

def get_card(profile_id:, id:)
  perform_get_with_object("/customervault/v1/profiles/#{profile_id}/cards/#{id}", Card)
end

#get_profile(id:, fields: []) ⇒ Object



47
48
49
50
51
52
# File 'lib/paysafe/api/customer_vault_api.rb', line 47

def get_profile(id:, fields: [])
  path = "/customervault/v1/profiles/#{id}"
  path += "?fields=#{fields.join(',')}" if !fields.empty?

  perform_get_with_object(path, Profile)
end

#update_address(profile_id:, id:, country:, zip:, **args) ⇒ Object



54
55
56
57
# File 'lib/paysafe/api/customer_vault_api.rb', line 54

def update_address(profile_id:, id:, country:, zip:, **args)
  data = args.merge({ country: country, zip: zip })
  perform_put_with_object("/customervault/v1/profiles/#{profile_id}/addresses/#{id}", data, Address)
end

#update_card(profile_id:, id:, **data) ⇒ Object



59
60
61
# File 'lib/paysafe/api/customer_vault_api.rb', line 59

def update_card(profile_id:, id:, **data)
  perform_put_with_object("/customervault/v1/profiles/#{profile_id}/cards/#{id}", data, Card)
end

#update_profile(id:, merchant_customer_id:, locale:, **args) ⇒ Object



63
64
65
66
67
68
69
70
# File 'lib/paysafe/api/customer_vault_api.rb', line 63

def update_profile(id:, merchant_customer_id:, locale:, **args)
  data = args.merge({
    merchant_customer_id: merchant_customer_id,
    locale: locale
  })

  perform_put_with_object("/customervault/v1/profiles/#{id}", data, Profile)
end