Class: Vpago::PayoutProfiles::Payway::PayoutProfileRequestParamsBuilder
- Inherits:
-
Object
- Object
- Vpago::PayoutProfiles::Payway::PayoutProfileRequestParamsBuilder
- Defined in:
- app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb
Instance Attribute Summary collapse
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#request_time ⇒ Object
readonly
Returns the value of attribute request_time.
Instance Method Summary collapse
- #api_key ⇒ Object
- #encoded_hash ⇒ Object
- #formatted_request_time ⇒ Object
- #hash_data ⇒ Object
-
#initialize(request_time, profile) ⇒ PayoutProfileRequestParamsBuilder
constructor
A new instance of PayoutProfileRequestParamsBuilder.
- #merchant_auth ⇒ Object
- #merchant_auth_data ⇒ Object
- #merchant_id ⇒ Object
- #payee ⇒ Object
- #request_params ⇒ Object
- #rsa_public_key ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(request_time, profile) ⇒ PayoutProfileRequestParamsBuilder
Returns a new instance of PayoutProfileRequestParamsBuilder.
7 8 9 10 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 7 def initialize(request_time, profile) @request_time = request_time @profile = profile end |
Instance Attribute Details
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
5 6 7 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 5 def profile @profile end |
#request_time ⇒ Object (readonly)
Returns the value of attribute request_time.
5 6 7 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 5 def request_time @request_time end |
Instance Method Details
#api_key ⇒ Object
12 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 12 def api_key = profile.preferred_api_key |
#encoded_hash ⇒ Object
41 42 43 44 45 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 41 def encoded_hash digest_name = OpenSSL::Digest.new('sha512') hash = OpenSSL::HMAC.digest(digest_name, api_key, hash_data) Base64.strict_encode64(hash) end |
#formatted_request_time ⇒ Object
18 19 20 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 18 def formatted_request_time request_time.strftime('%Y%m%d%H%M%S') end |
#hash_data ⇒ Object
37 38 39 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 37 def hash_data "#{formatted_request_time}#{merchant_auth}" end |
#merchant_auth ⇒ Object
30 31 32 33 34 35 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 30 def merchant_auth @merchant_auth ||= OpenSslEncrypter.new( content: merchant_auth_data, rsa_public_key: rsa_public_key ).call end |
#merchant_auth_data ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 22 def merchant_auth_data { 'mc_id' => merchant_id, 'payee' => payee, 'status' => status }.to_json end |
#merchant_id ⇒ Object
14 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 14 def merchant_id = profile.preferred_merchant_id |
#payee ⇒ Object
15 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 15 def payee = profile.preferred_payee |
#request_params ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 47 def request_params { request_time: formatted_request_time, merchant_id: merchant_id, merchant_auth: merchant_auth, hash: encoded_hash } end |
#rsa_public_key ⇒ Object
13 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 13 def rsa_public_key = profile.preferred_rsa_public_key |
#status ⇒ Object
16 |
# File 'app/services/vpago/payout_profiles/payway/payout_profile_request_params_builder.rb', line 16 def status = profile.active ? '1' : '0' |