Module: Formi9::Client::B2b
- Included in:
- Formi9::Client
- Defined in:
- lib/formi9/client/b2b.rb
Instance Method Summary collapse
-
#b2b_direct_link(options) ⇒ Object
options = { b2b_username: ‘Ryan Lyu’ company_id: ‘workstreamdemo’, request_id: ‘AUniqueId’, result_id: ‘AUniqueId’ }.
- #b2b_encrypt(string) ⇒ Object
Instance Method Details
#b2b_direct_link(options) ⇒ Object
options =
b2b_username: 'Ryan Lyu'
company_id: 'workstreamdemo',
request_id: 'AUniqueId',
result_id: 'AUniqueId'
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/formi9/client/b2b.rb', line 15 def b2b_direct_link() string = "AlliancePartnerID=#{CGI.escape(partner_id)}" string << "&AlliancePartnerLogin=#{CGI.escape(username)}" string << "&AlliancePartnerPassword=#{CGI.escape(password)}" string << "&AlliancePartnerCompanyID=#{CGI.escape([:company_id])}" string << "&Target=DirectLink&B2BUserName=#{CGI.escape([:b2b_username])}" string << "&RequestID=#{CGI.escape([:request_id])}" string << "&ResultID=#{CGI.escape([:result_id])}&" data = b2b_encrypt(string) "https://www.formi9.com/FormI9Verify/FormI9LoginService.aspx?EPID=#{partner_id}&EDATA=#{data}" end |
#b2b_encrypt(string) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/formi9/client/b2b.rb', line 30 def b2b_encrypt(string) cipher = b2b_encryption_algorithm.new(b2b_encryption_cipher_mode) cipher.encrypt cipher.key = b2b_encryption_key cipher.iv = b2b_encryption_iv encrypted_string = cipher.update(string) encrypted_string << cipher.final base64_string = Base64.strict_encode64(encrypted_string) escaped_data = CGI.escape(base64_string) end |