reward_station-gilman 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/.gitignore +5 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +9 -0
  5. data/LICENSE +0 -0
  6. data/README.md +228 -0
  7. data/Rakefile +5 -0
  8. data/lib/reward_station.rb +9 -0
  9. data/lib/reward_station/client.rb +210 -0
  10. data/lib/reward_station/errors.rb +33 -0
  11. data/lib/reward_station/responses/award_points.xml +12 -0
  12. data/lib/reward_station/responses/award_points_invalid_token.xml +12 -0
  13. data/lib/reward_station/responses/create_user.xml +34 -0
  14. data/lib/reward_station/responses/create_user_exists.xml +9 -0
  15. data/lib/reward_station/responses/create_user_missing_info.xml +9 -0
  16. data/lib/reward_station/responses/return_point_summary.xml +22 -0
  17. data/lib/reward_station/responses/return_point_summary_invalid_token.xml +12 -0
  18. data/lib/reward_station/responses/return_popular_products.xml +362 -0
  19. data/lib/reward_station/responses/return_popular_products_invalid_token.xml +10 -0
  20. data/lib/reward_station/responses/return_token.xml +10 -0
  21. data/lib/reward_station/responses/return_token_invalid.xml +10 -0
  22. data/lib/reward_station/responses/return_user.xml +35 -0
  23. data/lib/reward_station/responses/return_user_invalid_token.xml +10 -0
  24. data/lib/reward_station/responses/return_user_invalid_user.xml +10 -0
  25. data/lib/reward_station/stub_client.rb +22 -0
  26. data/lib/reward_station/stub_response.rb +45 -0
  27. data/lib/reward_station/version.rb +3 -0
  28. data/lib/saml/auth_response.rb +176 -0
  29. data/lib/wsdl/reward_services.xml +511 -0
  30. data/reward_station.gemspec +25 -0
  31. data/spec/reward_station/service_spec.rb +351 -0
  32. data/spec/savon_helper.rb +82 -0
  33. data/spec/spec_helper.rb +13 -0
  34. metadata +132 -0
@@ -0,0 +1,10 @@
1
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2
+ <soap:Body>
3
+ <ReturnPopularProductsResponse xmlns="http://rswebservices.rewardstation.com/">
4
+ <ReturnPopularProductsResult>
5
+ <UserID>534347</UserID>
6
+ <ErrorMessage>Invalid Token</ErrorMessage>
7
+ </ReturnPopularProductsResult>
8
+ </ReturnPopularProductsResponse>
9
+ </soap:Body>
10
+ </soap:Envelope>
@@ -0,0 +1,10 @@
1
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2
+ <soap:Body>
3
+ <ReturnTokenResponse xmlns="http://rswebservices.rewardstation.com/">
4
+ <ReturnTokenResult>
5
+ <Token>e285e1ed-2356-4676-a554-99d79e6284b0</Token>
6
+ <ErrorMessage/>
7
+ </ReturnTokenResult>
8
+ </ReturnTokenResponse>
9
+ </soap:Body>
10
+ </soap:Envelope>
@@ -0,0 +1,10 @@
1
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2
+ <soap:Body>
3
+ <ReturnTokenResponse xmlns="http://rswebservices.rewardstation.com/">
4
+ <ReturnTokenResult>
5
+ <Token/>
6
+ <ErrorMessage>Invalid Account Number and/or Account Code. Please contact Xceleration.</ErrorMessage>
7
+ </ReturnTokenResult>
8
+ </ReturnTokenResponse>
9
+ </soap:Body>
10
+ </soap:Envelope>
@@ -0,0 +1,35 @@
1
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2
+ <soap:Body>
3
+ <ReturnUserResponse xmlns="http://rswebservices.rewardstation.com/">
4
+ <ReturnUserResult>
5
+ <UserID>6725</UserID>
6
+ <UserProfile>
7
+ <UserID>6725</UserID>
8
+ <ClientID>100080</ClientID>
9
+ <UserName>john3@company.com</UserName>
10
+ <EncryptedPassword/>
11
+ <FirstName>John</FirstName>
12
+ <LastName>Smith</LastName>
13
+ <AddressOne/>
14
+ <AddressTwo/>
15
+ <City/>
16
+ <StateCode/>
17
+ <Province/>
18
+ <PostalCode/>
19
+ <CountryCode>USA</CountryCode>
20
+ <Phone/>
21
+ <Email>john@company.com</Email>
22
+ <OrganizationID>0</OrganizationID>
23
+ <OrganizationName/>
24
+ <RepTypeID>0</RepTypeID>
25
+ <ClientRegionID>0</ClientRegionID>
26
+ <IsActive>true</IsActive>
27
+ <PointBalance>10</PointBalance>
28
+ <ManagerID>0</ManagerID>
29
+ <ErrorMessage/>
30
+ </UserProfile>
31
+ <ErrorMessage/>
32
+ </ReturnUserResult>
33
+ </ReturnUserResponse>
34
+ </soap:Body>
35
+ </soap:Envelope>
@@ -0,0 +1,10 @@
1
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2
+ <soap:Body>
3
+ <ReturnUserResponse xmlns="http://rswebservices.rewardstation.com/">
4
+ <ReturnUserResult>
5
+ <UserID>672</UserID>
6
+ <ErrorMessage>Invalid Token</ErrorMessage>
7
+ </ReturnUserResult>
8
+ </ReturnUserResponse>
9
+ </soap:Body>
10
+ </soap:Envelope>
@@ -0,0 +1,10 @@
1
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2
+ <soap:Body>
3
+ <ReturnUserResponse xmlns="http://rswebservices.rewardstation.com/">
4
+ <ReturnUserResult>
5
+ <UserID>672</UserID>
6
+ <ErrorMessage>Invalid User ID</ErrorMessage>
7
+ </ReturnUserResult>
8
+ </ReturnUserResponse>
9
+ </soap:Body>
10
+ </soap:Envelope>
@@ -0,0 +1,22 @@
1
+ module RewardStation
2
+ class StubClient < Client
3
+
4
+ def initialize responses = {}
5
+ @responses = {}
6
+ end
7
+
8
+ protected
9
+
10
+ def get_response method_name, params
11
+ response = StubResponse[method_name, method_name]
12
+
13
+ raise ArgumentError, "Missing stub file for '#{method_name}' request" unless response
14
+
15
+ hash = Nori.parse(response)
16
+
17
+ raise ArgumentError, "Stub file for '#{method_name}' has incorrect format" unless hash.key?(:envelope) || hash[:envelope].key?(:body)
18
+
19
+ hash[:envelope][:body]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,45 @@
1
+ module RewardStation
2
+ class StubResponse
3
+ class << self
4
+
5
+ def gem_responses_path
6
+ File.join(File.dirname(__FILE__), "responses")
7
+ end
8
+
9
+ def local_responses_path
10
+ File.expand_path('config/reward_station/responses') rescue nil
11
+ end
12
+
13
+ def load(*args)
14
+ file_name = args.last
15
+ responses[file_name] ||= load_response_file file_name
16
+ end
17
+
18
+ alias_method :[], :load
19
+
20
+ private
21
+
22
+ def responses
23
+ @responses ||= {}
24
+ end
25
+
26
+ def load_response_file file_name
27
+ file_path = nil
28
+
29
+ if local_responses_path
30
+ local_path = File.join(local_responses_path, "#{file_name}.xml")
31
+ file_path = local_path if File.exist?(local_path)
32
+ end
33
+
34
+ unless file_path
35
+ gem_path = File.join(gem_responses_path, "#{file_name}.xml")
36
+ file_path = gem_path if File.exist?(gem_path)
37
+ end
38
+
39
+ raise ArgumentError, "Unable to load: #{file_name}" unless file_path
40
+
41
+ File.read file_path
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module RewardStation
2
+ VERSION = "0.0.7"
3
+ end
@@ -0,0 +1,176 @@
1
+ require 'ruby-saml'
2
+
3
+ module SAML
4
+ class AuthResponse
5
+
6
+ attr_accessor :request, :document, :logger
7
+ include Onelogin::Saml::Codeing
8
+
9
+ def initialize(request, logger = nil)
10
+ raise ArgumentError.new("Response cannot be nil") if request.nil?
11
+ self.logger = logger || ActiveRecord::Base.logger
12
+ self.request = inflate(decode(request))
13
+ self.document = Nokogiri::XML(self.request)
14
+ end
15
+
16
+ def get_sp_response_to
17
+ document.xpath("//samlp:AuthnRequest").first["ID"]
18
+ end
19
+
20
+ def get_sp_destination
21
+ Settings.sso.sp_destination
22
+ end
23
+
24
+ def get_idp_issuer
25
+ Settings.host
26
+ end
27
+
28
+ # def get_sp_audience
29
+ # Settings.sso.sp_audience
30
+ # end
31
+
32
+
33
+ #
34
+ def xml_time_format time
35
+ time.strftime("%Y-%m-%dT%H:%M:%SZ")
36
+ end
37
+
38
+
39
+ def response_url(name_id, params={})
40
+ prepared_result = create(name_id)
41
+ base64_request = encode(prepared_result)
42
+ # deflated_request = deflate(create(name_id))
43
+ # base64_request = encode(deflated_request)
44
+ base64_request.gsub!(/\s/,"")
45
+ # encoded_response = escape(base64_request)
46
+ #
47
+ # encoded_response
48
+ ## request_params = "?SAMLResponse=" + encoded_response
49
+ #
50
+ # params.each_pair do |key, value|
51
+ # request_params << "&#{key}=#{escape(value.to_s)}"
52
+ # end
53
+ # Settings.sso.sp_destination+ request_params
54
+ end
55
+
56
+ def create(name_id)
57
+ time_line = Time.now.utc
58
+ request_id = UUID.new.generate
59
+ assert_id = UUID.new.generate
60
+
61
+ time = xml_time_format(time_line)
62
+ assertion = build_assertion_content(name_id, assert_id, time_line)
63
+
64
+ # assertion_parsed = Nokogiri::XML(assertion)
65
+ # assertion_parsed.xpath("//saml:Assertion//saml:Issuer").first.add_next_sibling(make_signature(assertion, assert_id))
66
+
67
+ response = Builder::XmlMarkup.new
68
+ response.tag!('samlp:Response', {"xmlns:samlp" => "urn:oasis:names:tc:SAML:2.0:protocol",
69
+ "xmlns:saml" => "urn:oasis:names:tc:SAML:2.0:assertion",
70
+ "xmlns:ds" => "http://www.w3.org/2000/09/xmldsig#",
71
+ "ID" => request_id,
72
+ "Version" => "2.0",
73
+ "InResponseTo" => get_sp_response_to,
74
+ "IssueInstant" => time,
75
+ "Destination" => get_sp_destination}) do
76
+ response.tag!("saml:Issuer", get_idp_issuer)
77
+ response.tag!("samlp:Status") do
78
+ response.tag!("samlp:StatusCode", "Value" => "urn:oasis:names:tc:SAML:2.0:status:Success")
79
+ end
80
+ response << build_assertion_content(name_id, assert_id, time_line, make_signature(assertion, assert_id))
81
+ #todo if insert node this way - need to canonicalize. nokogiri 1.4.4 has no possibility to do it. only it's branch can do it:(
82
+ # response << assertion_parsed.xpath("//saml:Assertion").canonicalize.to_s
83
+ end
84
+ response.target!
85
+ end
86
+
87
+
88
+ def build_assertion_content(name_id, assert_id, time_line, sign =nil)
89
+ time_and_ten = xml_time_format(time_line + 10.minutes)
90
+ time = xml_time_format(time_line)
91
+
92
+ xml = Builder::XmlMarkup.new
93
+
94
+ xml.tag!('saml:Assertion', {"xmlns:saml"=>"urn:oasis:names:tc:SAML:2.0:assertion", "ID"=>assert_id, "Version"=>"2.0", "IssueInstant"=> time}) do
95
+ xml.tag!("saml:Issuer", get_idp_issuer)
96
+
97
+ xml << sign if sign.present?
98
+
99
+ xml.tag! "saml:Subject" do
100
+ xml.tag!("saml:NameID", {"Format"=>"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"}, name_id)
101
+ xml.tag!("saml:SubjectConfirmation", {"Method" => "urn:oasis:names:tc:SAML:2.0:cm:bearer"}) do
102
+ xml.tag!("saml:SubjectConfirmationData", {"InResponseTo" => get_sp_response_to, "Recipient" => get_sp_destination, "NotOnOrAfter" => time_and_ten})
103
+ end
104
+ end
105
+
106
+ # xml.tag!("saml:Conditions", {"NotBefore" => time, "NotOnOrAfter" => time_and_ten}) do
107
+ # xml.tag!("saml:AudienceRestriction") do
108
+ # xml.tag!("saml:Audience", get_sp_audience)
109
+ # end
110
+ # end
111
+
112
+ xml.tag!("saml:AuthnStatement", {"AuthnInstant" => time, "SessionIndex" => assert_id}) do
113
+ xml.tag!("saml:AuthnContext") do
114
+ xml.tag!("saml:AuthnContextClassRef", "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport")
115
+ end
116
+ end
117
+ end
118
+ xml.target!
119
+ end
120
+
121
+ def make_signature(assertion, assert_id)
122
+ certificate = File.read("#{Rails.root}/config/cert/#{Rails.env}/idp.ignite.com.crt")
123
+ # certificate = File.read("#{Rails.root}/config/cert/development/IdpCertificate.cer")
124
+ certificate.gsub!("-----BEGIN CERTIFICATE-----", "")
125
+ certificate.gsub!("-----END CERTIFICATE-----", "")
126
+
127
+ sign_info_xml_builder = Builder::XmlMarkup.new
128
+ sign_info_xml_builder.tag!("ds:SignedInfo", {"xmlns:ds"=>"http://www.w3.org/2000/09/xmldsig#"}) do
129
+ sign_info_xml_builder.tag!("ds:CanonicalizationMethod", {"Algorithm"=>"http://www.w3.org/2001/10/xml-exc-c14n#"})
130
+ sign_info_xml_builder.tag!("ds:SignatureMethod", {"Algorithm"=>"http://www.w3.org/2000/09/xmldsig#rsa-sha1"})
131
+ sign_info_xml_builder.tag!("ds:Reference", {"URI" => "##{assert_id}"}) do
132
+ sign_info_xml_builder.tag!("ds:Transforms") do
133
+ sign_info_xml_builder.tag!("ds:Transform", {"Algorithm"=>"http://www.w3.org/2000/09/xmldsig#enveloped-signature"})
134
+ sign_info_xml_builder.tag!("ds:Transform", {"Algorithm"=>"http://www.w3.org/2001/10/xml-exc-c14n#"})
135
+ end
136
+ sign_info_xml_builder.tag!("ds:DigestMethod", {"Algorithm"=>"http://www.w3.org/2000/09/xmldsig#sha1"})
137
+ sign_info_xml_builder.tag!("ds:DigestValue", {"URI" => assert_id}, signature_digest_value(assertion))
138
+ end
139
+ end
140
+ sign_info_xml = sign_info_xml_builder.target!
141
+ s_value = signature_sign_value(sign_info_xml)
142
+ xml = Builder::XmlMarkup.new
143
+ xml.tag!('ds:Signature', {"xmlns:ds" => "http://www.w3.org/2000/09/xmldsig#"}) do
144
+ xml << sign_info_xml
145
+ xml.tag!("ds:SignatureValue", {"xmlns:ds" => "http://www.w3.org/2000/09/xmldsig#"}, s_value)
146
+ xml.tag!('ds:KeyInfo') do
147
+ xml.tag!('ds:X509Data') do
148
+ xml.tag!('ds:X509Certificate', certificate)
149
+ end
150
+ end
151
+ end
152
+ xml.target!
153
+ end
154
+
155
+
156
+ def signature_sign_value(xml)
157
+ document = XMLSecurity::SignedDocument.new(xml)
158
+ canoner = XML::Util::XmlCanonicalizer.new(false, true)
159
+ signed_info_element = REXML::XPath.first(document, "//ds:SignedInfo", {"ds"=>"http://www.w3.org/2000/09/xmldsig#"})
160
+ canon_string = canoner.canonicalize(signed_info_element)
161
+ # private_key = OpenSSL::PKey::RSA.new(File.read("#{Rails.root}/config/cert/#{Rails.env}/idp.ignite.com.key"))
162
+ #private_key = OpenSSL::PKey::RSA.new(File.read("#{Rails.root}/config/cert/development/SPkey.key"))
163
+ private_key = OpenSSL::PKey::RSA.new(File.read("#{Rails.root}/config/cert/development/IgniteKeyDecrypted.key"))
164
+
165
+ sig = private_key.sign(OpenSSL::Digest::SHA1.new, canon_string)
166
+ Base64.encode64(sig).chomp
167
+ end
168
+
169
+ def signature_digest_value(xml)
170
+ document = XMLSecurity::SignedDocument.new(xml)
171
+ canoner = XML::Util::XmlCanonicalizer.new(false, true)
172
+ canon_hashed_element = canoner.canonicalize(document)
173
+ Base64.encode64(Digest::SHA1.digest(canon_hashed_element)).chomp
174
+ end
175
+ end
176
+ end
@@ -0,0 +1,511 @@
1
+ <wsdl:definitions targetNamespace="http://rswebservices.rewardstation.com/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://rswebservices.rewardstation.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
2
+ <wsdl:types>
3
+ <s:schema elementFormDefault="qualified" targetNamespace="http://rswebservices.rewardstation.com/">
4
+ <s:element name="ReturnToken">
5
+ <s:complexType>
6
+ <s:sequence>
7
+ <s:element minOccurs="1" maxOccurs="1" name="AccountNumber" type="s:int"/>
8
+ <s:element minOccurs="0" maxOccurs="1" name="AccountCode" type="s:string"/>
9
+ </s:sequence>
10
+ </s:complexType>
11
+ </s:element>
12
+ <s:element name="ReturnTokenResponse">
13
+ <s:complexType>
14
+ <s:sequence>
15
+ <s:element minOccurs="0" maxOccurs="1" name="ReturnTokenResult" type="tns:WebServiceToken"/>
16
+ </s:sequence>
17
+ </s:complexType>
18
+ </s:element>
19
+ <s:complexType name="WebServiceToken">
20
+ <s:sequence>
21
+ <s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
22
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
23
+ </s:sequence>
24
+ </s:complexType>
25
+ <s:element name="AuthenticateUser">
26
+ <s:complexType>
27
+ <s:sequence>
28
+ <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string"/>
29
+ <s:element minOccurs="0" maxOccurs="1" name="EncryptedPassword" type="s:string"/>
30
+ <s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
31
+ </s:sequence>
32
+ </s:complexType>
33
+ </s:element>
34
+ <s:element name="AuthenticateUserResponse">
35
+ <s:complexType>
36
+ <s:sequence>
37
+ <s:element minOccurs="0" maxOccurs="1" name="AuthenticateUserResult" type="tns:AuthenticateUserResult"/>
38
+ </s:sequence>
39
+ </s:complexType>
40
+ </s:element>
41
+ <s:complexType name="AuthenticateUserResult">
42
+ <s:sequence>
43
+ <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string"/>
44
+ <s:element minOccurs="0" maxOccurs="1" name="EncryptedPassword" type="s:string"/>
45
+ <s:element minOccurs="0" maxOccurs="1" name="UserProfile" type="tns:User"/>
46
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
47
+ </s:sequence>
48
+ </s:complexType>
49
+ <s:complexType name="User">
50
+ <s:sequence>
51
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
52
+ <s:element minOccurs="1" maxOccurs="1" name="ClientID" type="s:int"/>
53
+ <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string"/>
54
+ <s:element minOccurs="0" maxOccurs="1" name="EncryptedPassword" type="s:string"/>
55
+ <s:element minOccurs="0" maxOccurs="1" name="FirstName" type="s:string"/>
56
+ <s:element minOccurs="0" maxOccurs="1" name="LastName" type="s:string"/>
57
+ <s:element minOccurs="0" maxOccurs="1" name="AddressOne" type="s:string"/>
58
+ <s:element minOccurs="0" maxOccurs="1" name="AddressTwo" type="s:string"/>
59
+ <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string"/>
60
+ <s:element minOccurs="0" maxOccurs="1" name="StateCode" type="s:string"/>
61
+ <s:element minOccurs="0" maxOccurs="1" name="Province" type="s:string"/>
62
+ <s:element minOccurs="0" maxOccurs="1" name="PostalCode" type="s:string"/>
63
+ <s:element minOccurs="0" maxOccurs="1" name="CountryCode" type="s:string"/>
64
+ <s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string"/>
65
+ <s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string"/>
66
+ <s:element minOccurs="1" maxOccurs="1" name="OrganizationID" type="s:int"/>
67
+ <s:element minOccurs="0" maxOccurs="1" name="OrganizationName" type="s:string"/>
68
+ <s:element minOccurs="1" maxOccurs="1" name="RepTypeID" type="s:int"/>
69
+ <s:element minOccurs="1" maxOccurs="1" name="ClientRegionID" type="s:int"/>
70
+ <s:element minOccurs="1" maxOccurs="1" name="IsActive" type="s:boolean"/>
71
+ <s:element minOccurs="1" maxOccurs="1" name="PointBalance" type="s:int"/>
72
+ <s:element minOccurs="1" maxOccurs="1" name="ManagerID" type="s:int"/>
73
+ <s:element minOccurs="0" maxOccurs="1" name="ManagerName" type="s:string"/>
74
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
75
+ </s:sequence>
76
+ </s:complexType>
77
+ <s:element name="ReturnUser">
78
+ <s:complexType>
79
+ <s:sequence>
80
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
81
+ <s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
82
+ </s:sequence>
83
+ </s:complexType>
84
+ </s:element>
85
+ <s:element name="ReturnUserResponse">
86
+ <s:complexType>
87
+ <s:sequence>
88
+ <s:element minOccurs="0" maxOccurs="1" name="ReturnUserResult" type="tns:ReturnUserResult"/>
89
+ </s:sequence>
90
+ </s:complexType>
91
+ </s:element>
92
+ <s:complexType name="ReturnUserResult">
93
+ <s:sequence>
94
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
95
+ <s:element minOccurs="0" maxOccurs="1" name="UserProfile" type="tns:User"/>
96
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
97
+ </s:sequence>
98
+ </s:complexType>
99
+ <s:element name="UpdateUser">
100
+ <s:complexType>
101
+ <s:sequence>
102
+ <s:element minOccurs="0" maxOccurs="1" name="updateUser" type="tns:User"/>
103
+ <s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
104
+ </s:sequence>
105
+ </s:complexType>
106
+ </s:element>
107
+ <s:element name="UpdateUserResponse">
108
+ <s:complexType>
109
+ <s:sequence>
110
+ <s:element minOccurs="0" maxOccurs="1" name="UpdateUserResult" type="tns:UpdateUserResult"/>
111
+ </s:sequence>
112
+ </s:complexType>
113
+ </s:element>
114
+ <s:complexType name="UpdateUserResult">
115
+ <s:sequence>
116
+ <s:element minOccurs="0" maxOccurs="1" name="UpdateUser" type="tns:User"/>
117
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
118
+ </s:sequence>
119
+ </s:complexType>
120
+ <s:element name="AwardPoints">
121
+ <s:complexType>
122
+ <s:sequence>
123
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
124
+ <s:element minOccurs="1" maxOccurs="1" name="Points" type="s:int"/>
125
+ <s:element minOccurs="1" maxOccurs="1" name="ProgramID" type="s:int"/>
126
+ <s:element minOccurs="1" maxOccurs="1" name="PointReasonCodeID" type="s:int"/>
127
+ <s:element minOccurs="0" maxOccurs="1" name="Description" type="s:string"/>
128
+ <s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
129
+ </s:sequence>
130
+ </s:complexType>
131
+ </s:element>
132
+ <s:element name="AwardPointsResponse">
133
+ <s:complexType>
134
+ <s:sequence>
135
+ <s:element minOccurs="0" maxOccurs="1" name="AwardPointsResult" type="tns:AwardPointsResult"/>
136
+ </s:sequence>
137
+ </s:complexType>
138
+ </s:element>
139
+ <s:complexType name="AwardPointsResult">
140
+ <s:sequence>
141
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
142
+ <s:element minOccurs="1" maxOccurs="1" name="Points" type="s:int"/>
143
+ <s:element minOccurs="0" maxOccurs="1" name="ConfirmationNumber" type="s:string"/>
144
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
145
+ </s:sequence>
146
+ </s:complexType>
147
+ <s:element name="ReturnPointSummary">
148
+ <s:complexType>
149
+ <s:sequence>
150
+ <s:element minOccurs="1" maxOccurs="1" name="clientId" type="s:int"/>
151
+ <s:element minOccurs="1" maxOccurs="1" name="activeOnly" type="s:boolean"/>
152
+ <s:element minOccurs="1" maxOccurs="1" name="userId" type="s:int"/>
153
+ <s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
154
+ </s:sequence>
155
+ </s:complexType>
156
+ </s:element>
157
+ <s:element name="ReturnPointSummaryResponse">
158
+ <s:complexType>
159
+ <s:sequence>
160
+ <s:element minOccurs="0" maxOccurs="1" name="ReturnPointSummaryResult" type="tns:PointSummaryResult"/>
161
+ </s:sequence>
162
+ </s:complexType>
163
+ </s:element>
164
+ <s:complexType name="PointSummaryResult">
165
+ <s:sequence>
166
+ <s:element minOccurs="1" maxOccurs="1" name="ClientID" type="s:int"/>
167
+ <s:element minOccurs="1" maxOccurs="1" name="ActiveOnly" type="s:boolean"/>
168
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
169
+ <s:element minOccurs="0" maxOccurs="1" name="PointSummaryCollection" type="tns:ArrayOfPointSummary"/>
170
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
171
+ </s:sequence>
172
+ </s:complexType>
173
+ <s:complexType name="ArrayOfPointSummary">
174
+ <s:sequence>
175
+ <s:element minOccurs="0" maxOccurs="unbounded" name="PointSummary" nillable="true" type="tns:PointSummary"/>
176
+ </s:sequence>
177
+ </s:complexType>
178
+ <s:complexType name="PointSummary">
179
+ <s:sequence>
180
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
181
+ <s:element minOccurs="1" maxOccurs="1" name="IsActive" type="s:boolean"/>
182
+ <s:element minOccurs="1" maxOccurs="1" name="PointsEarned" type="s:int"/>
183
+ <s:element minOccurs="1" maxOccurs="1" name="PointsRedeemed" type="s:int"/>
184
+ <s:element minOccurs="1" maxOccurs="1" name="PointsCredited" type="s:int"/>
185
+ <s:element minOccurs="1" maxOccurs="1" name="PointsBalance" type="s:int"/>
186
+ </s:sequence>
187
+ </s:complexType>
188
+ <s:element name="ReturnPopularProducts">
189
+ <s:complexType>
190
+ <s:sequence>
191
+ <s:element minOccurs="1" maxOccurs="1" name="userId" type="s:int"/>
192
+ <s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
193
+ </s:sequence>
194
+ </s:complexType>
195
+ </s:element>
196
+ <s:element name="ReturnPopularProductsResponse">
197
+ <s:complexType>
198
+ <s:sequence>
199
+ <s:element minOccurs="0" maxOccurs="1" name="ReturnPopularProductsResult" type="tns:PopularProductsResult"/>
200
+ </s:sequence>
201
+ </s:complexType>
202
+ </s:element>
203
+ <s:complexType name="PopularProductsResult">
204
+ <s:sequence>
205
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
206
+ <s:element minOccurs="0" maxOccurs="1" name="Products" type="tns:ArrayOfProduct"/>
207
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
208
+ </s:sequence>
209
+ </s:complexType>
210
+ <s:complexType name="ArrayOfProduct">
211
+ <s:sequence>
212
+ <s:element minOccurs="0" maxOccurs="unbounded" name="Product" nillable="true" type="tns:Product"/>
213
+ </s:sequence>
214
+ </s:complexType>
215
+ <s:complexType name="Product">
216
+ <s:sequence>
217
+ <s:element minOccurs="0" maxOccurs="1" name="ProductID" type="s:string"/>
218
+ <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string"/>
219
+ <s:element minOccurs="0" maxOccurs="1" name="Description" type="s:string"/>
220
+ <s:element minOccurs="1" maxOccurs="1" name="Points" type="s:int"/>
221
+ <s:element minOccurs="0" maxOccurs="1" name="Category" type="s:string"/>
222
+ <s:element minOccurs="0" maxOccurs="1" name="Manufacturer" type="s:string"/>
223
+ <s:element minOccurs="0" maxOccurs="1" name="SmallImageURL" type="s:string"/>
224
+ <s:element minOccurs="0" maxOccurs="1" name="LargeImageURL" type="s:string"/>
225
+ </s:sequence>
226
+ </s:complexType>
227
+ <s:element name="ReturnUserQuizzes">
228
+ <s:complexType>
229
+ <s:sequence>
230
+ <s:element minOccurs="1" maxOccurs="1" name="clientId" type="s:int"/>
231
+ <s:element minOccurs="1" maxOccurs="1" name="userId" type="s:int"/>
232
+ <s:element minOccurs="0" maxOccurs="1" name="Token" type="s:string"/>
233
+ </s:sequence>
234
+ </s:complexType>
235
+ </s:element>
236
+ <s:element name="ReturnUserQuizzesResponse">
237
+ <s:complexType>
238
+ <s:sequence>
239
+ <s:element minOccurs="0" maxOccurs="1" name="ReturnUserQuizzesResult" type="tns:UserQuizResult"/>
240
+ </s:sequence>
241
+ </s:complexType>
242
+ </s:element>
243
+ <s:complexType name="UserQuizResult">
244
+ <s:sequence>
245
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
246
+ <s:element minOccurs="0" maxOccurs="1" name="UserQuizCollection" type="tns:ArrayOfUserQuiz"/>
247
+ <s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
248
+ </s:sequence>
249
+ </s:complexType>
250
+ <s:complexType name="ArrayOfUserQuiz">
251
+ <s:sequence>
252
+ <s:element minOccurs="0" maxOccurs="unbounded" name="UserQuiz" nillable="true" type="tns:UserQuiz"/>
253
+ </s:sequence>
254
+ </s:complexType>
255
+ <s:complexType name="UserQuiz">
256
+ <s:sequence>
257
+ <s:element minOccurs="1" maxOccurs="1" name="UserID" type="s:int"/>
258
+ <s:element minOccurs="1" maxOccurs="1" name="QuizID" type="s:int"/>
259
+ <s:element minOccurs="0" maxOccurs="1" name="QuizName" type="s:string"/>
260
+ <s:element minOccurs="1" maxOccurs="1" name="StartDate" type="s:dateTime"/>
261
+ <s:element minOccurs="1" maxOccurs="1" name="EndDate" type="s:dateTime"/>
262
+ <s:element minOccurs="1" maxOccurs="1" name="MaximumAttempts" type="s:int"/>
263
+ <s:element minOccurs="1" maxOccurs="1" name="TimesAttempted" type="s:int"/>
264
+ <s:element minOccurs="1" maxOccurs="1" name="QuizPassed" type="s:boolean"/>
265
+ <s:element minOccurs="1" maxOccurs="1" name="PointsEarned" type="s:int"/>
266
+ <s:element minOccurs="1" maxOccurs="1" name="AvailableAttempts" type="s:int"/>
267
+ </s:sequence>
268
+ </s:complexType>
269
+ </s:schema>
270
+ </wsdl:types>
271
+ <wsdl:message name="ReturnTokenSoapIn">
272
+ <wsdl:part name="parameters" element="tns:ReturnToken"/>
273
+ </wsdl:message>
274
+ <wsdl:message name="ReturnTokenSoapOut">
275
+ <wsdl:part name="parameters" element="tns:ReturnTokenResponse"/>
276
+ </wsdl:message>
277
+ <wsdl:message name="AuthenticateUserSoapIn">
278
+ <wsdl:part name="parameters" element="tns:AuthenticateUser"/>
279
+ </wsdl:message>
280
+ <wsdl:message name="AuthenticateUserSoapOut">
281
+ <wsdl:part name="parameters" element="tns:AuthenticateUserResponse"/>
282
+ </wsdl:message>
283
+ <wsdl:message name="ReturnUserSoapIn">
284
+ <wsdl:part name="parameters" element="tns:ReturnUser"/>
285
+ </wsdl:message>
286
+ <wsdl:message name="ReturnUserSoapOut">
287
+ <wsdl:part name="parameters" element="tns:ReturnUserResponse"/>
288
+ </wsdl:message>
289
+ <wsdl:message name="UpdateUserSoapIn">
290
+ <wsdl:part name="parameters" element="tns:UpdateUser"/>
291
+ </wsdl:message>
292
+ <wsdl:message name="UpdateUserSoapOut">
293
+ <wsdl:part name="parameters" element="tns:UpdateUserResponse"/>
294
+ </wsdl:message>
295
+ <wsdl:message name="AwardPointsSoapIn">
296
+ <wsdl:part name="parameters" element="tns:AwardPoints"/>
297
+ </wsdl:message>
298
+ <wsdl:message name="AwardPointsSoapOut">
299
+ <wsdl:part name="parameters" element="tns:AwardPointsResponse"/>
300
+ </wsdl:message>
301
+ <wsdl:message name="ReturnPointSummarySoapIn">
302
+ <wsdl:part name="parameters" element="tns:ReturnPointSummary"/>
303
+ </wsdl:message>
304
+ <wsdl:message name="ReturnPointSummarySoapOut">
305
+ <wsdl:part name="parameters" element="tns:ReturnPointSummaryResponse"/>
306
+ </wsdl:message>
307
+ <wsdl:message name="ReturnPopularProductsSoapIn">
308
+ <wsdl:part name="parameters" element="tns:ReturnPopularProducts"/>
309
+ </wsdl:message>
310
+ <wsdl:message name="ReturnPopularProductsSoapOut">
311
+ <wsdl:part name="parameters" element="tns:ReturnPopularProductsResponse"/>
312
+ </wsdl:message>
313
+ <wsdl:message name="ReturnUserQuizzesSoapIn">
314
+ <wsdl:part name="parameters" element="tns:ReturnUserQuizzes"/>
315
+ </wsdl:message>
316
+ <wsdl:message name="ReturnUserQuizzesSoapOut">
317
+ <wsdl:part name="parameters" element="tns:ReturnUserQuizzesResponse"/>
318
+ </wsdl:message>
319
+ <wsdl:portType name="RewardServicesSoap">
320
+ <wsdl:operation name="ReturnToken">
321
+ <wsdl:input message="tns:ReturnTokenSoapIn"/>
322
+ <wsdl:output message="tns:ReturnTokenSoapOut"/>
323
+ </wsdl:operation>
324
+ <wsdl:operation name="AuthenticateUser">
325
+ <wsdl:input message="tns:AuthenticateUserSoapIn"/>
326
+ <wsdl:output message="tns:AuthenticateUserSoapOut"/>
327
+ </wsdl:operation>
328
+ <wsdl:operation name="ReturnUser">
329
+ <wsdl:input message="tns:ReturnUserSoapIn"/>
330
+ <wsdl:output message="tns:ReturnUserSoapOut"/>
331
+ </wsdl:operation>
332
+ <wsdl:operation name="UpdateUser">
333
+ <wsdl:input message="tns:UpdateUserSoapIn"/>
334
+ <wsdl:output message="tns:UpdateUserSoapOut"/>
335
+ </wsdl:operation>
336
+ <wsdl:operation name="AwardPoints">
337
+ <wsdl:input message="tns:AwardPointsSoapIn"/>
338
+ <wsdl:output message="tns:AwardPointsSoapOut"/>
339
+ </wsdl:operation>
340
+ <wsdl:operation name="ReturnPointSummary">
341
+ <wsdl:input message="tns:ReturnPointSummarySoapIn"/>
342
+ <wsdl:output message="tns:ReturnPointSummarySoapOut"/>
343
+ </wsdl:operation>
344
+ <wsdl:operation name="ReturnPopularProducts">
345
+ <wsdl:input message="tns:ReturnPopularProductsSoapIn"/>
346
+ <wsdl:output message="tns:ReturnPopularProductsSoapOut"/>
347
+ </wsdl:operation>
348
+ <wsdl:operation name="ReturnUserQuizzes">
349
+ <wsdl:input message="tns:ReturnUserQuizzesSoapIn"/>
350
+ <wsdl:output message="tns:ReturnUserQuizzesSoapOut"/>
351
+ </wsdl:operation>
352
+ </wsdl:portType>
353
+ <wsdl:binding name="RewardServicesSoap" type="tns:RewardServicesSoap">
354
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
355
+ <wsdl:operation name="ReturnToken">
356
+ <soap:operation soapAction="http://rswebservices.rewardstation.com/ReturnToken" style="document"/>
357
+ <wsdl:input>
358
+ <soap:body use="literal"/>
359
+ </wsdl:input>
360
+ <wsdl:output>
361
+ <soap:body use="literal"/>
362
+ </wsdl:output>
363
+ </wsdl:operation>
364
+ <wsdl:operation name="AuthenticateUser">
365
+ <soap:operation soapAction="http://rswebservices.rewardstation.com/AuthenticateUser" style="document"/>
366
+ <wsdl:input>
367
+ <soap:body use="literal"/>
368
+ </wsdl:input>
369
+ <wsdl:output>
370
+ <soap:body use="literal"/>
371
+ </wsdl:output>
372
+ </wsdl:operation>
373
+ <wsdl:operation name="ReturnUser">
374
+ <soap:operation soapAction="http://rswebservices.rewardstation.com/ReturnUser" style="document"/>
375
+ <wsdl:input>
376
+ <soap:body use="literal"/>
377
+ </wsdl:input>
378
+ <wsdl:output>
379
+ <soap:body use="literal"/>
380
+ </wsdl:output>
381
+ </wsdl:operation>
382
+ <wsdl:operation name="UpdateUser">
383
+ <soap:operation soapAction="http://rswebservices.rewardstation.com/UpdateUser" style="document"/>
384
+ <wsdl:input>
385
+ <soap:body use="literal"/>
386
+ </wsdl:input>
387
+ <wsdl:output>
388
+ <soap:body use="literal"/>
389
+ </wsdl:output>
390
+ </wsdl:operation>
391
+ <wsdl:operation name="AwardPoints">
392
+ <soap:operation soapAction="http://rswebservices.rewardstation.com/AwardPoints" style="document"/>
393
+ <wsdl:input>
394
+ <soap:body use="literal"/>
395
+ </wsdl:input>
396
+ <wsdl:output>
397
+ <soap:body use="literal"/>
398
+ </wsdl:output>
399
+ </wsdl:operation>
400
+ <wsdl:operation name="ReturnPointSummary">
401
+ <soap:operation soapAction="http://rswebservices.rewardstation.com/ReturnPointSummary" style="document"/>
402
+ <wsdl:input>
403
+ <soap:body use="literal"/>
404
+ </wsdl:input>
405
+ <wsdl:output>
406
+ <soap:body use="literal"/>
407
+ </wsdl:output>
408
+ </wsdl:operation>
409
+ <wsdl:operation name="ReturnPopularProducts">
410
+ <soap:operation soapAction="http://rswebservices.rewardstation.com/ReturnPopularProducts" style="document"/>
411
+ <wsdl:input>
412
+ <soap:body use="literal"/>
413
+ </wsdl:input>
414
+ <wsdl:output>
415
+ <soap:body use="literal"/>
416
+ </wsdl:output>
417
+ </wsdl:operation>
418
+ <wsdl:operation name="ReturnUserQuizzes">
419
+ <soap:operation soapAction="http://rswebservices.rewardstation.com/ReturnUserQuizzes" style="document"/>
420
+ <wsdl:input>
421
+ <soap:body use="literal"/>
422
+ </wsdl:input>
423
+ <wsdl:output>
424
+ <soap:body use="literal"/>
425
+ </wsdl:output>
426
+ </wsdl:operation>
427
+ </wsdl:binding>
428
+ <wsdl:binding name="RewardServicesSoap12" type="tns:RewardServicesSoap">
429
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
430
+ <wsdl:operation name="ReturnToken">
431
+ <soap12:operation soapAction="http://rswebservices.rewardstation.com/ReturnToken" style="document"/>
432
+ <wsdl:input>
433
+ <soap12:body use="literal"/>
434
+ </wsdl:input>
435
+ <wsdl:output>
436
+ <soap12:body use="literal"/>
437
+ </wsdl:output>
438
+ </wsdl:operation>
439
+ <wsdl:operation name="AuthenticateUser">
440
+ <soap12:operation soapAction="http://rswebservices.rewardstation.com/AuthenticateUser" style="document"/>
441
+ <wsdl:input>
442
+ <soap12:body use="literal"/>
443
+ </wsdl:input>
444
+ <wsdl:output>
445
+ <soap12:body use="literal"/>
446
+ </wsdl:output>
447
+ </wsdl:operation>
448
+ <wsdl:operation name="ReturnUser">
449
+ <soap12:operation soapAction="http://rswebservices.rewardstation.com/ReturnUser" style="document"/>
450
+ <wsdl:input>
451
+ <soap12:body use="literal"/>
452
+ </wsdl:input>
453
+ <wsdl:output>
454
+ <soap12:body use="literal"/>
455
+ </wsdl:output>
456
+ </wsdl:operation>
457
+ <wsdl:operation name="UpdateUser">
458
+ <soap12:operation soapAction="http://rswebservices.rewardstation.com/UpdateUser" style="document"/>
459
+ <wsdl:input>
460
+ <soap12:body use="literal"/>
461
+ </wsdl:input>
462
+ <wsdl:output>
463
+ <soap12:body use="literal"/>
464
+ </wsdl:output>
465
+ </wsdl:operation>
466
+ <wsdl:operation name="AwardPoints">
467
+ <soap12:operation soapAction="http://rswebservices.rewardstation.com/AwardPoints" style="document"/>
468
+ <wsdl:input>
469
+ <soap12:body use="literal"/>
470
+ </wsdl:input>
471
+ <wsdl:output>
472
+ <soap12:body use="literal"/>
473
+ </wsdl:output>
474
+ </wsdl:operation>
475
+ <wsdl:operation name="ReturnPointSummary">
476
+ <soap12:operation soapAction="http://rswebservices.rewardstation.com/ReturnPointSummary" style="document"/>
477
+ <wsdl:input>
478
+ <soap12:body use="literal"/>
479
+ </wsdl:input>
480
+ <wsdl:output>
481
+ <soap12:body use="literal"/>
482
+ </wsdl:output>
483
+ </wsdl:operation>
484
+ <wsdl:operation name="ReturnPopularProducts">
485
+ <soap12:operation soapAction="http://rswebservices.rewardstation.com/ReturnPopularProducts" style="document"/>
486
+ <wsdl:input>
487
+ <soap12:body use="literal"/>
488
+ </wsdl:input>
489
+ <wsdl:output>
490
+ <soap12:body use="literal"/>
491
+ </wsdl:output>
492
+ </wsdl:operation>
493
+ <wsdl:operation name="ReturnUserQuizzes">
494
+ <soap12:operation soapAction="http://rswebservices.rewardstation.com/ReturnUserQuizzes" style="document"/>
495
+ <wsdl:input>
496
+ <soap12:body use="literal"/>
497
+ </wsdl:input>
498
+ <wsdl:output>
499
+ <soap12:body use="literal"/>
500
+ </wsdl:output>
501
+ </wsdl:operation>
502
+ </wsdl:binding>
503
+ <wsdl:service name="RewardServices">
504
+ <wsdl:port name="RewardServicesSoap" binding="tns:RewardServicesSoap">
505
+ <soap:address location="http://rswebservices.rewardstation.net/RewardServices.asmx"/>
506
+ </wsdl:port>
507
+ <wsdl:port name="RewardServicesSoap12" binding="tns:RewardServicesSoap12">
508
+ <soap12:address location="http://rswebservices.rewardstation.net/RewardServices.asmx"/>
509
+ </wsdl:port>
510
+ </wsdl:service>
511
+ </wsdl:definitions>