Class: UnivapayClientSdk::CustomsDeclarationWebhookResult

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb

Overview

Result payload returned by the customs declaration formatter.

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(approving_authority: SKIP, trade_id: SKIP, transaction_id: SKIP, charge_transaction_id: SKIP, additional_properties: nil) ⇒ CustomsDeclarationWebhookResult

Returns a new instance of CustomsDeclarationWebhookResult.



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 58

def initialize(approving_authority: SKIP, trade_id: SKIP,
               transaction_id: SKIP, charge_transaction_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @approving_authority = approving_authority unless approving_authority == SKIP
  @trade_id = trade_id unless trade_id == SKIP
  @transaction_id = transaction_id unless transaction_id == SKIP
  @charge_transaction_id = charge_transaction_id unless charge_transaction_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#approving_authorityString

Customs authority that approved the declaration.

Returns:

  • (String)


14
15
16
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 14

def approving_authority
  @approving_authority
end

#charge_transaction_idString

Gateway charge transaction identifier linked to the declaration.

Returns:

  • (String)


26
27
28
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 26

def charge_transaction_id
  @charge_transaction_id
end

#trade_idString

Gateway trade identifier.

Returns:

  • (String)


18
19
20
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 18

def trade_id
  @trade_id
end

#transaction_idString

Gateway transaction identifier for customs.

Returns:

  • (String)


22
23
24
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 22

def transaction_id
  @transaction_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  approving_authority =
    hash.key?('approving_authority') ? hash['approving_authority'] : SKIP
  trade_id = hash.key?('trade_id') ? hash['trade_id'] : SKIP
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : SKIP
  charge_transaction_id =
    hash.key?('charge_transaction_id') ? hash['charge_transaction_id'] : 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.
  CustomsDeclarationWebhookResult.new(approving_authority: approving_authority,
                                      trade_id: trade_id,
                                      transaction_id: transaction_id,
                                      charge_transaction_id: charge_transaction_id,
                                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['approving_authority'] = 'approving_authority'
  @_hash['trade_id'] = 'trade_id'
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['charge_transaction_id'] = 'charge_transaction_id'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
52
53
54
55
56
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 49

def self.nullables
  %w[
    approving_authority
    trade_id
    transaction_id
    charge_transaction_id
  ]
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 39

def self.optionals
  %w[
    approving_authority
    trade_id
    transaction_id
    charge_transaction_id
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



101
102
103
104
105
106
107
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 101

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 118

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} approving_authority: #{@approving_authority.inspect}, trade_id:"\
  " #{@trade_id.inspect}, transaction_id: #{@transaction_id.inspect}, charge_transaction_id:"\
  " #{@charge_transaction_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb', line 110

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} approving_authority: #{@approving_authority}, trade_id: #{@trade_id},"\
  " transaction_id: #{@transaction_id}, charge_transaction_id: #{@charge_transaction_id},"\
  " additional_properties: #{@additional_properties}>"
end