Class: PaypalServerSdk::Level3CardProcessingData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/level3_card_processing_data.rb

Overview

The level 3 card processing data collections, If your merchant account has been configured for Level 3 processing this field will be passed to the processor on your behalf. Please contact your PayPal Technical Account Manager to define level 3 data for your business.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(shipping_amount: SKIP, duty_amount: SKIP, discount_amount: SKIP, shipping_address: SKIP, ships_from_postal_code: SKIP, line_items: SKIP) ⇒ Level3CardProcessingData

Returns a new instance of Level3CardProcessingData.



78
79
80
81
82
83
84
85
86
87
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 78

def initialize(shipping_amount: SKIP, duty_amount: SKIP,
               discount_amount: SKIP, shipping_address: SKIP,
               ships_from_postal_code: SKIP, line_items: SKIP)
  @shipping_amount = shipping_amount unless shipping_amount == SKIP
  @duty_amount = duty_amount unless duty_amount == SKIP
  @discount_amount = discount_amount unless discount_amount == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @ships_from_postal_code = ships_from_postal_code unless ships_from_postal_code == SKIP
  @line_items = line_items unless line_items == SKIP
end

Instance Attribute Details

#discount_amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



28
29
30
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 28

def discount_amount
  @discount_amount
end

#duty_amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



23
24
25
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 23

def duty_amount
  @duty_amount
end

#line_itemsArray[LineItem]

A list of the items that were purchased with this payment. If your merchant account has been configured for Level 3 processing this field will be passed to the processor on your behalf.

Returns:



47
48
49
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 47

def line_items
  @line_items
end

#shipping_addressAddress

The portable international postal address. Maps to [AddressValidationMetadata](github.com/googlei18n/libaddressinput/ wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](www.w3.org/TR/html51/sec-forms.html#autofilling-form-co ntrols-the-autocomplete-attribute).

Returns:



37
38
39
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 37

def shipping_address
  @shipping_address
end

#shipping_amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



18
19
20
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 18

def shipping_amount
  @shipping_amount
end

#ships_from_postal_codeString

Use this field to specify the postal code of the shipping location.

Returns:

  • (String)


41
42
43
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 41

def ships_from_postal_code
  @ships_from_postal_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  shipping_amount = Money.from_hash(hash['shipping_amount']) if hash['shipping_amount']
  duty_amount = Money.from_hash(hash['duty_amount']) if hash['duty_amount']
  discount_amount = Money.from_hash(hash['discount_amount']) if hash['discount_amount']
  shipping_address = Address.from_hash(hash['shipping_address']) if hash['shipping_address']
  ships_from_postal_code =
    hash.key?('ships_from_postal_code') ? hash['ships_from_postal_code'] : SKIP
  # Parameter is an array, so we need to iterate through it
  line_items = nil
  unless hash['line_items'].nil?
    line_items = []
    hash['line_items'].each do |structure|
      line_items << (LineItem.from_hash(structure) if structure)
    end
  end

  line_items = SKIP unless hash.key?('line_items')

  # Create object from extracted values.
  Level3CardProcessingData.new(shipping_amount: shipping_amount,
                               duty_amount: duty_amount,
                               discount_amount: discount_amount,
                               shipping_address: shipping_address,
                               ships_from_postal_code: ships_from_postal_code,
                               line_items: line_items)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['shipping_amount'] = 'shipping_amount'
  @_hash['duty_amount'] = 'duty_amount'
  @_hash['discount_amount'] = 'discount_amount'
  @_hash['shipping_address'] = 'shipping_address'
  @_hash['ships_from_postal_code'] = 'ships_from_postal_code'
  @_hash['line_items'] = 'line_items'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
70
71
# File 'lib/paypal_server_sdk/models/level3_card_processing_data.rb', line 62

def self.optionals
  %w[
    shipping_amount
    duty_amount
    discount_amount
    shipping_address
    ships_from_postal_code
    line_items
  ]
end