tangocard-raas 1.1.2 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +28 -175
- data/README.md +38 -525
- data/lib/raas.rb +32 -19
- data/lib/raas/api_helper.rb +146 -54
- data/lib/raas/configuration.rb +22 -30
- data/lib/raas/controllers/accounts_controller.rb +146 -92
- data/lib/raas/controllers/base_controller.rb +32 -29
- data/lib/raas/controllers/catalog_controller.rb +31 -14
- data/lib/raas/controllers/customers_controller.rb +113 -72
- data/lib/raas/controllers/exchange_rates_controller.rb +40 -12
- data/lib/raas/controllers/fund_controller.rb +345 -0
- data/lib/raas/controllers/orders_controller.rb +166 -105
- data/lib/raas/controllers/status_controller.rb +31 -14
- data/lib/raas/exceptions/api_exception.rb +4 -2
- data/lib/raas/exceptions/raas_client_exception.rb +14 -12
- data/lib/raas/exceptions/raas_generic_exception.rb +9 -9
- data/lib/raas/exceptions/raas_server_exception.rb +14 -12
- data/lib/raas/http/auth/basic_auth.rb +7 -4
- data/lib/raas/http/faraday_client.rb +19 -7
- data/lib/raas/http/http_call_back.rb +11 -6
- data/lib/raas/http/http_client.rb +50 -32
- data/lib/raas/http/http_context.rb +5 -2
- data/lib/raas/http/http_method_enum.rb +6 -2
- data/lib/raas/http/http_request.rb +7 -3
- data/lib/raas/http/http_response.rb +3 -1
- data/lib/raas/models/account_model.rb +32 -23
- data/lib/raas/models/account_summary_model.rb +26 -17
- data/lib/raas/models/base_model.rb +11 -9
- data/lib/raas/models/billing_address_model.rb +105 -0
- data/lib/raas/models/brand_model.rb +39 -35
- data/lib/raas/models/catalog_model.rb +15 -13
- data/lib/raas/models/create_account_request_model.rb +14 -14
- data/lib/raas/models/create_credit_card_request_model.rb +96 -0
- data/lib/raas/models/create_customer_request_model.rb +12 -12
- data/lib/raas/models/create_order_request_model.rb +45 -35
- data/lib/raas/models/credit_card_model.rb +124 -0
- data/lib/raas/models/currency_breakdown_model.rb +18 -18
- data/lib/raas/models/customer_model.rb +24 -22
- data/lib/raas/models/deposit_request_model.rb +60 -0
- data/lib/raas/models/deposit_response_model.rb +80 -0
- data/lib/raas/models/exchange_rate_model.rb +18 -17
- data/lib/raas/models/exchange_rate_response_model.rb +17 -15
- data/lib/raas/models/full_name_email_model.rb +42 -0
- data/lib/raas/models/get_deposit_response_model.rb +80 -0
- data/lib/raas/models/get_orders_response_model.rb +16 -14
- data/lib/raas/models/item_model.rb +36 -34
- data/lib/raas/models/name_email_model.rb +14 -14
- data/lib/raas/models/new_credit_card_model.rb +51 -0
- data/lib/raas/models/order_model.rb +124 -92
- data/lib/raas/models/order_summary_model.rb +155 -0
- data/lib/raas/models/page_model.rb +16 -16
- data/lib/raas/models/raas_client_error_model.rb +16 -16
- data/lib/raas/models/raas_server_error_model.rb +12 -12
- data/lib/raas/models/resend_order_response_model.rb +11 -11
- data/lib/raas/models/reward_credential_model.rb +14 -14
- data/lib/raas/models/reward_model.rb +16 -14
- data/lib/raas/models/system_status_response_model.rb +10 -10
- data/lib/raas/models/unregister_credit_card_request_model.rb +51 -0
- data/lib/raas/models/unregister_credit_card_response_model.rb +53 -0
- data/lib/raas/raas_client.rb +36 -25
- data/test/controllers/controller_test_base.rb +31 -0
- data/test/controllers/test_accounts_controller.rb +79 -0
- data/test/controllers/test_catalog_controller.rb +65 -0
- data/test/controllers/test_customers_controller.rb +61 -0
- data/test/controllers/test_exchange_rates_controller.rb +35 -0
- data/test/controllers/test_fund_controller.rb +108 -0
- data/test/controllers/test_orders_controller.rb +86 -0
- data/test/controllers/test_status_controller.rb +27 -0
- data/test/http_response_catcher.rb +16 -0
- data/test/test_helper.rb +91 -0
- metadata +32 -10
@@ -1,22 +1,22 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
module Raas
|
5
|
+
# Represents the response from the get orders call
|
4
6
|
class GetOrdersResponseModel < BaseModel
|
5
7
|
# Pagination information
|
6
8
|
# @return [PageModel]
|
7
9
|
attr_accessor :page
|
8
10
|
|
9
11
|
# An array of orders
|
10
|
-
# @return [List of
|
12
|
+
# @return [List of OrderSummaryModel]
|
11
13
|
attr_accessor :orders
|
12
14
|
|
13
|
-
# A mapping from model property names to API property names
|
15
|
+
# A mapping from model property names to API property names.
|
14
16
|
def self.names
|
15
|
-
if @_hash.nil?
|
16
|
-
|
17
|
-
|
18
|
-
@_hash["orders"] = "orders"
|
19
|
-
end
|
17
|
+
@_hash = {} if @_hash.nil?
|
18
|
+
@_hash['page'] = 'page'
|
19
|
+
@_hash['orders'] = 'orders'
|
20
20
|
@_hash
|
21
21
|
end
|
22
22
|
|
@@ -26,20 +26,22 @@ module Raas
|
|
26
26
|
@orders = orders
|
27
27
|
end
|
28
28
|
|
29
|
-
# Creates an instance of the object from a hash
|
29
|
+
# Creates an instance of the object from a hash.
|
30
30
|
def self.from_hash(hash)
|
31
31
|
return nil unless hash
|
32
32
|
|
33
|
-
# Extract variables from the hash
|
33
|
+
# Extract variables from the hash.
|
34
34
|
page = PageModel.from_hash(hash['page']) if hash['page']
|
35
35
|
# Parameter is an array, so we need to iterate through it
|
36
36
|
orders = nil
|
37
|
-
|
38
|
-
orders =
|
39
|
-
hash['orders'].each
|
37
|
+
unless hash['orders'].nil?
|
38
|
+
orders = []
|
39
|
+
hash['orders'].each do |structure|
|
40
|
+
orders << (OrderSummaryModel.from_hash(structure) if structure)
|
41
|
+
end
|
40
42
|
end
|
41
43
|
|
42
|
-
# Create object from extracted values
|
44
|
+
# Create object from extracted values.
|
43
45
|
GetOrdersResponseModel.new(page,
|
44
46
|
orders)
|
45
47
|
end
|
@@ -1,73 +1,73 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
require 'date'
|
4
5
|
module Raas
|
6
|
+
# Represents an item
|
5
7
|
class ItemModel < BaseModel
|
6
|
-
# UTID
|
8
|
+
# The UTID
|
7
9
|
# @return [String]
|
8
10
|
attr_accessor :utid
|
9
11
|
|
10
|
-
#
|
12
|
+
# The reward name
|
11
13
|
# @return [String]
|
12
14
|
attr_accessor :reward_name
|
13
15
|
|
14
|
-
#
|
16
|
+
# The currency code
|
15
17
|
# @return [String]
|
16
18
|
attr_accessor :currency_code
|
17
19
|
|
18
|
-
#
|
20
|
+
# The item's status
|
19
21
|
# @return [String]
|
20
22
|
attr_accessor :status
|
21
23
|
|
22
|
-
#
|
24
|
+
# The item's value type (VARIABLE_VALUE or FIXED_VALUE)
|
23
25
|
# @return [String]
|
24
26
|
attr_accessor :value_type
|
25
27
|
|
26
|
-
#
|
28
|
+
# The reward type
|
27
29
|
# @return [String]
|
28
30
|
attr_accessor :reward_type
|
29
31
|
|
30
|
-
#
|
32
|
+
# The date the item was created
|
31
33
|
# @return [DateTime]
|
32
34
|
attr_accessor :created_date
|
33
35
|
|
34
|
-
#
|
36
|
+
# The date the item was last updated
|
35
37
|
# @return [DateTime]
|
36
38
|
attr_accessor :last_update_date
|
37
39
|
|
38
|
-
#
|
40
|
+
# The countries this item is valid in
|
39
41
|
# @return [List of String]
|
40
42
|
attr_accessor :countries
|
41
43
|
|
42
|
-
#
|
44
|
+
# The minimum orderable value (for variable value items)
|
43
45
|
# @return [Float]
|
44
46
|
attr_accessor :min_value
|
45
47
|
|
46
|
-
#
|
48
|
+
# The maximum orderable value (for variable value items)
|
47
49
|
# @return [Float]
|
48
50
|
attr_accessor :max_value
|
49
51
|
|
50
|
-
#
|
52
|
+
# The face value of the gift card
|
51
53
|
# @return [Float]
|
52
54
|
attr_accessor :face_value
|
53
55
|
|
54
|
-
# A mapping from model property names to API property names
|
56
|
+
# A mapping from model property names to API property names.
|
55
57
|
def self.names
|
56
|
-
if @_hash.nil?
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
@_hash["face_value"] = "faceValue"
|
70
|
-
end
|
58
|
+
@_hash = {} if @_hash.nil?
|
59
|
+
@_hash['utid'] = 'utid'
|
60
|
+
@_hash['reward_name'] = 'rewardName'
|
61
|
+
@_hash['currency_code'] = 'currencyCode'
|
62
|
+
@_hash['status'] = 'status'
|
63
|
+
@_hash['value_type'] = 'valueType'
|
64
|
+
@_hash['reward_type'] = 'rewardType'
|
65
|
+
@_hash['created_date'] = 'createdDate'
|
66
|
+
@_hash['last_update_date'] = 'lastUpdateDate'
|
67
|
+
@_hash['countries'] = 'countries'
|
68
|
+
@_hash['min_value'] = 'minValue'
|
69
|
+
@_hash['max_value'] = 'maxValue'
|
70
|
+
@_hash['face_value'] = 'faceValue'
|
71
71
|
@_hash
|
72
72
|
end
|
73
73
|
|
@@ -97,25 +97,27 @@ module Raas
|
|
97
97
|
@face_value = face_value
|
98
98
|
end
|
99
99
|
|
100
|
-
# Creates an instance of the object from a hash
|
100
|
+
# Creates an instance of the object from a hash.
|
101
101
|
def self.from_hash(hash)
|
102
102
|
return nil unless hash
|
103
103
|
|
104
|
-
# Extract variables from the hash
|
104
|
+
# Extract variables from the hash.
|
105
105
|
utid = hash['utid']
|
106
106
|
reward_name = hash['rewardName']
|
107
107
|
currency_code = hash['currencyCode']
|
108
108
|
status = hash['status']
|
109
109
|
value_type = hash['valueType']
|
110
110
|
reward_type = hash['rewardType']
|
111
|
-
created_date =
|
112
|
-
|
111
|
+
created_date = APIHelper.rfc3339(hash['createdDate']) if
|
112
|
+
hash['createdDate']
|
113
|
+
last_update_date = APIHelper.rfc3339(hash['lastUpdateDate']) if
|
114
|
+
hash['lastUpdateDate']
|
113
115
|
countries = hash['countries']
|
114
116
|
min_value = hash['minValue']
|
115
117
|
max_value = hash['maxValue']
|
116
118
|
face_value = hash['faceValue']
|
117
119
|
|
118
|
-
# Create object from extracted values
|
120
|
+
# Create object from extracted values.
|
119
121
|
ItemModel.new(utid,
|
120
122
|
reward_name,
|
121
123
|
currency_code,
|
@@ -1,27 +1,27 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
module Raas
|
5
|
+
# Represents a name and an email address
|
4
6
|
class NameEmailModel < BaseModel
|
5
|
-
#
|
7
|
+
# An email address
|
6
8
|
# @return [String]
|
7
9
|
attr_accessor :email
|
8
10
|
|
9
|
-
#
|
11
|
+
# A first name
|
10
12
|
# @return [String]
|
11
13
|
attr_accessor :first_name
|
12
14
|
|
13
|
-
#
|
15
|
+
# A last name
|
14
16
|
# @return [String]
|
15
17
|
attr_accessor :last_name
|
16
18
|
|
17
|
-
# A mapping from model property names to API property names
|
19
|
+
# A mapping from model property names to API property names.
|
18
20
|
def self.names
|
19
|
-
if @_hash.nil?
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@_hash["last_name"] = "lastName"
|
24
|
-
end
|
21
|
+
@_hash = {} if @_hash.nil?
|
22
|
+
@_hash['email'] = 'email'
|
23
|
+
@_hash['first_name'] = 'firstName'
|
24
|
+
@_hash['last_name'] = 'lastName'
|
25
25
|
@_hash
|
26
26
|
end
|
27
27
|
|
@@ -33,16 +33,16 @@ module Raas
|
|
33
33
|
@last_name = last_name
|
34
34
|
end
|
35
35
|
|
36
|
-
# Creates an instance of the object from a hash
|
36
|
+
# Creates an instance of the object from a hash.
|
37
37
|
def self.from_hash(hash)
|
38
38
|
return nil unless hash
|
39
39
|
|
40
|
-
# Extract variables from the hash
|
40
|
+
# Extract variables from the hash.
|
41
41
|
email = hash['email']
|
42
42
|
first_name = hash['firstName']
|
43
43
|
last_name = hash['lastName']
|
44
44
|
|
45
|
-
# Create object from extracted values
|
45
|
+
# Create object from extracted values.
|
46
46
|
NameEmailModel.new(email,
|
47
47
|
first_name,
|
48
48
|
last_name)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module Raas
|
5
|
+
# Represents the credit card information required to register a credit card
|
6
|
+
class NewCreditCardModel < BaseModel
|
7
|
+
# The credit card number
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :number
|
10
|
+
|
11
|
+
# The credit card expiration date in YYYY-MM format
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :expiration
|
14
|
+
|
15
|
+
# The 3 or 4 digit card security code on the back of card
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :verification_number
|
18
|
+
|
19
|
+
# A mapping from model property names to API property names.
|
20
|
+
def self.names
|
21
|
+
@_hash = {} if @_hash.nil?
|
22
|
+
@_hash['number'] = 'number'
|
23
|
+
@_hash['expiration'] = 'expiration'
|
24
|
+
@_hash['verification_number'] = 'verificationNumber'
|
25
|
+
@_hash
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(number = nil,
|
29
|
+
expiration = nil,
|
30
|
+
verification_number = nil)
|
31
|
+
@number = number
|
32
|
+
@expiration = expiration
|
33
|
+
@verification_number = verification_number
|
34
|
+
end
|
35
|
+
|
36
|
+
# Creates an instance of the object from a hash.
|
37
|
+
def self.from_hash(hash)
|
38
|
+
return nil unless hash
|
39
|
+
|
40
|
+
# Extract variables from the hash.
|
41
|
+
number = hash['number']
|
42
|
+
expiration = hash['expiration']
|
43
|
+
verification_number = hash['verificationNumber']
|
44
|
+
|
45
|
+
# Create object from extracted values.
|
46
|
+
NewCreditCardModel.new(number,
|
47
|
+
expiration,
|
48
|
+
verification_number)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,187 +1,219 @@
|
|
1
|
-
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
1
|
+
# This file was automatically generated for Tango Card, Inc. by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
2
3
|
|
3
4
|
require 'date'
|
4
5
|
module Raas
|
6
|
+
# Represents the response from a get order call
|
5
7
|
class OrderModel < BaseModel
|
6
|
-
#
|
8
|
+
# The reference order id
|
7
9
|
# @return [String]
|
8
|
-
attr_accessor :
|
10
|
+
attr_accessor :reference_order_id
|
9
11
|
|
10
|
-
#
|
11
|
-
# @return [
|
12
|
-
attr_accessor :
|
12
|
+
# The customer identifier
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :customer_identifier
|
13
15
|
|
14
|
-
#
|
15
|
-
# @return [
|
16
|
-
attr_accessor :
|
16
|
+
# The account identifier
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :account_identifier
|
17
19
|
|
18
|
-
#
|
20
|
+
# The account number
|
19
21
|
# @return [String]
|
20
|
-
attr_accessor :
|
22
|
+
attr_accessor :account_number
|
21
23
|
|
22
|
-
#
|
24
|
+
# The order's amount information
|
25
|
+
# @return [CurrencyBreakdownModel]
|
26
|
+
attr_accessor :amount_charged
|
27
|
+
|
28
|
+
# Information about the gift card amount
|
23
29
|
# @return [CurrencyBreakdownModel]
|
24
30
|
attr_accessor :denomination
|
25
31
|
|
26
|
-
#
|
32
|
+
# The UTID
|
27
33
|
# @return [String]
|
28
|
-
attr_accessor :
|
29
|
-
|
30
|
-
# Reward
|
31
|
-
# @return [RewardModel]
|
32
|
-
attr_accessor :reward
|
34
|
+
attr_accessor :utid
|
33
35
|
|
34
|
-
#
|
36
|
+
# The reward name
|
35
37
|
# @return [String]
|
36
38
|
attr_accessor :reward_name
|
37
39
|
|
38
|
-
#
|
40
|
+
# Indicates if an email was sent to the recipient
|
39
41
|
# @return [Boolean]
|
40
42
|
attr_accessor :send_email
|
41
43
|
|
42
|
-
#
|
44
|
+
# The order's status
|
43
45
|
# @return [String]
|
44
46
|
attr_accessor :status
|
45
47
|
|
46
|
-
#
|
48
|
+
# When the order was placed
|
49
|
+
# @return [DateTime]
|
50
|
+
attr_accessor :created_at
|
51
|
+
|
52
|
+
# Contains the reward credentials
|
53
|
+
# @return [RewardModel]
|
54
|
+
attr_accessor :reward
|
55
|
+
|
56
|
+
# The sender data
|
57
|
+
# @return [NameEmailModel]
|
58
|
+
attr_accessor :sender
|
59
|
+
|
60
|
+
# The recipient data
|
61
|
+
# @return [NameEmailModel]
|
62
|
+
attr_accessor :recipient
|
63
|
+
|
64
|
+
# The email template id
|
47
65
|
# @return [String]
|
48
|
-
attr_accessor :
|
66
|
+
attr_accessor :etid
|
49
67
|
|
50
|
-
#
|
68
|
+
# An optional campaign identifier
|
51
69
|
# @return [String]
|
52
70
|
attr_accessor :campaign
|
53
71
|
|
54
|
-
#
|
72
|
+
# The subject of the email
|
55
73
|
# @return [String]
|
56
74
|
attr_accessor :email_subject
|
57
75
|
|
58
|
-
#
|
76
|
+
# An external reference id
|
59
77
|
# @return [String]
|
60
78
|
attr_accessor :external_ref_id
|
61
79
|
|
62
|
-
#
|
80
|
+
# A message included with the email
|
63
81
|
# @return [String]
|
64
82
|
attr_accessor :message
|
65
83
|
|
66
|
-
#
|
84
|
+
# Optional customer notes
|
67
85
|
# @return [String]
|
68
86
|
attr_accessor :notes
|
69
87
|
|
70
|
-
#
|
71
|
-
# @return [
|
72
|
-
attr_accessor :
|
73
|
-
|
74
|
-
# Sender
|
75
|
-
# @return [NameEmailModel]
|
76
|
-
attr_accessor :sender
|
88
|
+
# Margin share information
|
89
|
+
# @return [CurrencyBreakdownModel]
|
90
|
+
attr_accessor :margin_share
|
77
91
|
|
78
|
-
# A mapping from model property names to API property names
|
92
|
+
# A mapping from model property names to API property names.
|
79
93
|
def self.names
|
80
|
-
if @_hash.nil?
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
94
|
+
@_hash = {} if @_hash.nil?
|
95
|
+
@_hash['reference_order_id'] = 'referenceOrderID'
|
96
|
+
@_hash['customer_identifier'] = 'customerIdentifier'
|
97
|
+
@_hash['account_identifier'] = 'accountIdentifier'
|
98
|
+
@_hash['account_number'] = 'accountNumber'
|
99
|
+
@_hash['amount_charged'] = 'amountCharged'
|
100
|
+
@_hash['denomination'] = 'denomination'
|
101
|
+
@_hash['utid'] = 'utid'
|
102
|
+
@_hash['reward_name'] = 'rewardName'
|
103
|
+
@_hash['send_email'] = 'sendEmail'
|
104
|
+
@_hash['status'] = 'status'
|
105
|
+
@_hash['created_at'] = 'createdAt'
|
106
|
+
@_hash['reward'] = 'reward'
|
107
|
+
@_hash['sender'] = 'sender'
|
108
|
+
@_hash['recipient'] = 'recipient'
|
109
|
+
@_hash['etid'] = 'etid'
|
110
|
+
@_hash['campaign'] = 'campaign'
|
111
|
+
@_hash['email_subject'] = 'emailSubject'
|
112
|
+
@_hash['external_ref_id'] = 'externalRefID'
|
113
|
+
@_hash['message'] = 'message'
|
114
|
+
@_hash['notes'] = 'notes'
|
115
|
+
@_hash['margin_share'] = 'marginShare'
|
101
116
|
@_hash
|
102
117
|
end
|
103
118
|
|
104
|
-
def initialize(
|
105
|
-
amount_charged = nil,
|
106
|
-
created_at = nil,
|
119
|
+
def initialize(reference_order_id = nil,
|
107
120
|
customer_identifier = nil,
|
121
|
+
account_identifier = nil,
|
122
|
+
account_number = nil,
|
123
|
+
amount_charged = nil,
|
108
124
|
denomination = nil,
|
109
|
-
|
110
|
-
reward = nil,
|
125
|
+
utid = nil,
|
111
126
|
reward_name = nil,
|
112
127
|
send_email = nil,
|
113
128
|
status = nil,
|
114
|
-
|
129
|
+
created_at = nil,
|
130
|
+
reward = nil,
|
131
|
+
sender = nil,
|
132
|
+
recipient = nil,
|
133
|
+
etid = nil,
|
115
134
|
campaign = nil,
|
116
135
|
email_subject = nil,
|
117
136
|
external_ref_id = nil,
|
118
137
|
message = nil,
|
119
138
|
notes = nil,
|
120
|
-
|
121
|
-
|
139
|
+
margin_share = nil)
|
140
|
+
@reference_order_id = reference_order_id
|
141
|
+
@customer_identifier = customer_identifier
|
122
142
|
@account_identifier = account_identifier
|
143
|
+
@account_number = account_number
|
123
144
|
@amount_charged = amount_charged
|
124
|
-
@created_at = created_at
|
125
|
-
@customer_identifier = customer_identifier
|
126
145
|
@denomination = denomination
|
127
|
-
@
|
128
|
-
@reward = reward
|
146
|
+
@utid = utid
|
129
147
|
@reward_name = reward_name
|
130
148
|
@send_email = send_email
|
131
149
|
@status = status
|
132
|
-
@
|
150
|
+
@created_at = created_at
|
151
|
+
@reward = reward
|
152
|
+
@sender = sender
|
153
|
+
@recipient = recipient
|
154
|
+
@etid = etid
|
133
155
|
@campaign = campaign
|
134
156
|
@email_subject = email_subject
|
135
157
|
@external_ref_id = external_ref_id
|
136
158
|
@message = message
|
137
159
|
@notes = notes
|
138
|
-
@
|
139
|
-
@sender = sender
|
160
|
+
@margin_share = margin_share
|
140
161
|
end
|
141
162
|
|
142
|
-
# Creates an instance of the object from a hash
|
163
|
+
# Creates an instance of the object from a hash.
|
143
164
|
def self.from_hash(hash)
|
144
165
|
return nil unless hash
|
145
166
|
|
146
|
-
# Extract variables from the hash
|
147
|
-
account_identifier = hash['accountIdentifier']
|
148
|
-
amount_charged = CurrencyBreakdownModel.from_hash(hash['amountCharged']) if hash['amountCharged']
|
149
|
-
created_at = DateTime.rfc3339(hash['createdAt']) if hash['createdAt']
|
150
|
-
customer_identifier = hash['customerIdentifier']
|
151
|
-
denomination = CurrencyBreakdownModel.from_hash(hash['denomination']) if hash['denomination']
|
167
|
+
# Extract variables from the hash.
|
152
168
|
reference_order_id = hash['referenceOrderID']
|
153
|
-
|
169
|
+
customer_identifier = hash['customerIdentifier']
|
170
|
+
account_identifier = hash['accountIdentifier']
|
171
|
+
account_number = hash['accountNumber']
|
172
|
+
if hash['amountCharged']
|
173
|
+
amount_charged = CurrencyBreakdownModel.from_hash(hash['amountCharged'])
|
174
|
+
end
|
175
|
+
denomination = CurrencyBreakdownModel.from_hash(hash['denomination']) if
|
176
|
+
hash['denomination']
|
177
|
+
utid = hash['utid']
|
154
178
|
reward_name = hash['rewardName']
|
155
179
|
send_email = hash['sendEmail']
|
156
180
|
status = hash['status']
|
157
|
-
|
181
|
+
created_at = APIHelper.rfc3339(hash['createdAt']) if hash['createdAt']
|
182
|
+
reward = RewardModel.from_hash(hash['reward']) if hash['reward']
|
183
|
+
sender = NameEmailModel.from_hash(hash['sender']) if hash['sender']
|
184
|
+
recipient = NameEmailModel.from_hash(hash['recipient']) if
|
185
|
+
hash['recipient']
|
186
|
+
etid = hash['etid']
|
158
187
|
campaign = hash['campaign']
|
159
188
|
email_subject = hash['emailSubject']
|
160
189
|
external_ref_id = hash['externalRefID']
|
161
190
|
message = hash['message']
|
162
191
|
notes = hash['notes']
|
163
|
-
|
164
|
-
|
192
|
+
margin_share = CurrencyBreakdownModel.from_hash(hash['marginShare']) if
|
193
|
+
hash['marginShare']
|
165
194
|
|
166
|
-
# Create object from extracted values
|
167
|
-
OrderModel.new(
|
168
|
-
amount_charged,
|
169
|
-
created_at,
|
195
|
+
# Create object from extracted values.
|
196
|
+
OrderModel.new(reference_order_id,
|
170
197
|
customer_identifier,
|
198
|
+
account_identifier,
|
199
|
+
account_number,
|
200
|
+
amount_charged,
|
171
201
|
denomination,
|
172
|
-
|
173
|
-
reward,
|
202
|
+
utid,
|
174
203
|
reward_name,
|
175
204
|
send_email,
|
176
205
|
status,
|
177
|
-
|
206
|
+
created_at,
|
207
|
+
reward,
|
208
|
+
sender,
|
209
|
+
recipient,
|
210
|
+
etid,
|
178
211
|
campaign,
|
179
212
|
email_subject,
|
180
213
|
external_ref_id,
|
181
214
|
message,
|
182
215
|
notes,
|
183
|
-
|
184
|
-
sender)
|
216
|
+
margin_share)
|
185
217
|
end
|
186
218
|
end
|
187
219
|
end
|