Class: CyberSourceMergedSpec::DigitalCurrency

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/digital_currency.rb

Overview

Digital currency information for the order.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(type: SKIP, ramp_provider_country: SKIP, conversion_affiliate: SKIP, additional_properties: nil) ⇒ DigitalCurrency

Returns a new instance of DigitalCurrency.



56
57
58
59
60
61
62
63
64
65
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 56

def initialize(type: SKIP, ramp_provider_country: SKIP,
               conversion_affiliate: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @ramp_provider_country = ramp_provider_country unless ramp_provider_country == SKIP
  @conversion_affiliate = conversion_affiliate unless conversion_affiliate == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#conversion_affiliateString

Affiliate is the platform for the digital currency transactions. The merchant provides the Affiliate country for transaction processing. The combination of affiliate country and ramp country helps to derive the foreign retail indicator.

Returns:

  • (String)


31
32
33
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 31

def conversion_affiliate
  @conversion_affiliate
end

#ramp_provider_countryString

Ramp is a platform where we can buy Digital currency, for example Coinbase. This value identifies the country where the Ramp provider is registered.

Returns:

  • (String)


24
25
26
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 24

def ramp_provider_country
  @ramp_provider_country
end

#typeString

Currently, Visa uses a broad "cryptocurrency" indicator. The enhancement will introduce specific values to identify the type of digital currency or coin involved, such as Central Bank Digital Currency (CBDC), stable coins, blockchain-native tokens, and Non-Fungible Tokens (NFTs). Values: - 1: CBDC_TOKENDEPOSIT - 2: STABLE_COIN - 3: BLOCKCHAIN_NATIVE_TOKEN - 4: NFT

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 18

def type
  @type
end

Class Method Details

.from_element(root) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 92

def self.from_element(root)
  type = XmlUtilities.from_element(root, 'type', String)
  ramp_provider_country = XmlUtilities.from_element(root,
                                                    'rampProviderCountry',
                                                    String)
  conversion_affiliate = XmlUtilities.from_element(root,
                                                   'conversionAffiliate',
                                                   String)

  new(type: type,
      ramp_provider_country: ramp_provider_country,
      conversion_affiliate: conversion_affiliate,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  ramp_provider_country =
    hash.key?('rampProviderCountry') ? hash['rampProviderCountry'] : SKIP
  conversion_affiliate =
    hash.key?('conversionAffiliate') ? hash['conversionAffiliate'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  DigitalCurrency.new(type: type,
                      ramp_provider_country: ramp_provider_country,
                      conversion_affiliate: conversion_affiliate,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['ramp_provider_country'] = 'rampProviderCountry'
  @_hash['conversion_affiliate'] = 'conversionAffiliate'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
48
49
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 43

def self.optionals
  %w[
    type
    ramp_provider_country
    conversion_affiliate
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 130

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, ramp_provider_country:"\
  " #{@ramp_provider_country.inspect}, conversion_affiliate: #{@conversion_affiliate.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



122
123
124
125
126
127
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 122

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, ramp_provider_country: #{@ramp_provider_country},"\
  " conversion_affiliate: #{@conversion_affiliate}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/cyber_source_merged_spec/models/digital_currency.rb', line 107

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'type', type)
  XmlUtilities.add_as_subelement(doc, root, 'rampProviderCountry',
                                 ramp_provider_country)
  XmlUtilities.add_as_subelement(doc, root, 'conversionAffiliate',
                                 conversion_affiliate)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end