Class: UnivapayClientSdk::CustomsDeclarationCreateRequest

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

Overview

Request body for creating a customs declaration. Backend currently accepts this shape only for WeChat Online and WeChat MPM charges.

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(customs:, merchant_customs_no:, certificate_id:, certificate_name:, additional_properties: nil) ⇒ CustomsDeclarationCreateRequest

Returns a new instance of CustomsDeclarationCreateRequest.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 49

def initialize(customs:, merchant_customs_no:, certificate_id:,
               certificate_name:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @customs = customs
  @merchant_customs_no = merchant_customs_no
  @certificate_id = certificate_id
  @certificate_name = certificate_name
  @additional_properties = additional_properties
end

Instance Attribute Details

#certificate_idString

Customer certificate or passport identifier used by customs.

Returns:

  • (String)


23
24
25
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 23

def certificate_id
  @certificate_id
end

#certificate_nameString

Customer name exactly as shown on the certificate.

Returns:

  • (String)


27
28
29
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 27

def certificate_name
  @certificate_name
end

#customsString

WeChat customs authority code used for the declaration.

Returns:

  • (String)


15
16
17
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 15

def customs
  @customs
end

#merchant_customs_noString

Merchant customs registration number.

Returns:

  • (String)


19
20
21
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 19

def merchant_customs_no
  @merchant_customs_no
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  customs = hash.key?('customs') ? hash['customs'] : nil
  merchant_customs_no =
    hash.key?('merchant_customs_no') ? hash['merchant_customs_no'] : nil
  certificate_id =
    hash.key?('certificate_id') ? hash['certificate_id'] : nil
  certificate_name =
    hash.key?('certificate_name') ? hash['certificate_name'] : nil

  # 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.
  CustomsDeclarationCreateRequest.new(customs: customs,
                                      merchant_customs_no: merchant_customs_no,
                                      certificate_id: certificate_id,
                                      certificate_name: certificate_name,
                                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['customs'] = 'customs'
  @_hash['merchant_customs_no'] = 'merchant_customs_no'
  @_hash['certificate_id'] = 'certificate_id'
  @_hash['certificate_name'] = 'certificate_name'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 40

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



98
99
100
101
102
103
104
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 98

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} customs: #{@customs.inspect}, merchant_customs_no:"\
  " #{@merchant_customs_no.inspect}, certificate_id: #{@certificate_id.inspect},"\
  " certificate_name: #{@certificate_name.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



90
91
92
93
94
95
# File 'lib/univapay_client_sdk/models/customs_declaration_create_request.rb', line 90

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} customs: #{@customs}, merchant_customs_no: #{@merchant_customs_no},"\
  " certificate_id: #{@certificate_id}, certificate_name: #{@certificate_name},"\
  " additional_properties: #{@additional_properties}>"
end