13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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
88
89
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# File 'lib/Helpers/model_parser.rb', line 13
def ParseCustomerObject(objHashed)
buffCustomer = Customer.new(objHashed)
if(buffCustomer.instance_variable_get("@creditCards"))
cardsArr = buffCustomer.instance_variable_get("@creditCards")
cardsList = []
cardsArr.each do |c|
buffCard = CreditCard.new(c)
cardsList << buffCard
end
buffCustomer.CreditCards = cardsList
end
if(buffCustomer.instance_variable_get("@customerEntities"))
accountsArr = buffCustomer.instance_variable_get("@customerEntities")
accountsList = []
accountsArr.each do |acc|
buffAccount = CustomerEntity.new(acc)
benificHashed = buffAccount.instance_variable_get("@entityBeneficiary")
accBeneficiary = ParseCustomerBeneficiary(benificHashed)
buffAccount.EntityBeneficiary = accBeneficiary
entityRespHashed = buffAccount.instance_variable_get("@responseDetails")
custEntResponse = ParseCustomerEntityResponse(entityRespHashed)
buffAccount.ResponseDetails = custEntResponse
accountsList << buffAccount
end
buffCustomer.CustomerEntities = accountsList
end
if(buffCustomer.instance_variable_get("@paymentInstructions"))
instructionsArr = buffCustomer.instance_variable_get("@paymentInstructions")
instructionsList = []
instructionsArr.each do |inst|
buffInstruction = Instruction.new(inst)
instructionsList << buffInstruction
end
buffCustomer.PaymentInstructions = instructionsList
end
if(buffCustomer.instance_variable_get("@aCHs"))
achsArr = buffCustomer.instance_variable_get("@aCHs")
achsList = []
achsArr.each do |ach|
buffAch = ACH.new(ach)
resDetail = buffAch.instance_variable_get("@responseDetails")
instrumentResp = InstrumentResponse.new(resDetail)
valErrs = instrumentResp.instance_variable_get("@validationErrors")
instrumentResp.ValidationErrors = ValidationError.new(valErrs)
buffAch.ResponseDetails = instrumentResp
achsList << buffAch
end
buffCustomer.ACHs = achsList
end
if(buffCustomer.instance_variable_get("@billingAddress"))
billingAddressArr = buffCustomer.instance_variable_get("@billingAddress")
billingAddressArrList = []
billingAddressArr.each do |ba|
buffBillAddr = Address.new(ba)
billingAddressArrList << buffBillAddr
end
buffCustomer.BillingAddress = billingAddressArrList
end
if(buffCustomer.instance_variable_get("@shippingAddress"))
shippingAddressArr = buffCustomer.instance_variable_get("@shippingAddress")
shippingAddressList = []
shippingAddressArr.each do |sa|
buffShipAddr = Address.new(sa)
shippingAddressList << buffShipAddr
end
buffCustomer.ShippingAddress = shippingAddressList
end
if(buffCustomer.instance_variable_get("@responseDetails"))
responseDetails = buffCustomer.instance_variable_get("@responseDetails")
buffResponseDet = CustomerResponse.new(responseDetails)
validationErrors = buffResponseDet.instance_variable_get("@validationErrors")
buffValisationErrors = ValidationError.new(validationErrors)
buffResponseDet.ValidationErrors = buffValisationErrors
buffCustomer.ResponseDetails = buffResponseDet
end
if(buffCustomer.instance_variable_get("@options"))
options = buffCustomer.instance_variable_get("@options")
buffOptions = CustomerResponse.new(options)
validationErrors = buffOptions.instance_variable_get("@validationErrors")
buffValisationErrors = ValidationError.new(validationErrors)
buffOptions.ValidationErrors = buffValisationErrors
buffCustomer.Options = buffOptions
end
return buffCustomer
end
|