Class: Vpago::VattanacMiniApp::Base
- Inherits:
-
Object
- Object
- Vpago::VattanacMiniApp::Base
- Defined in:
- lib/vpago/vattanac_mini_app/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #amount ⇒ Object
- #currency ⇒ Object
- #encrypt_data(payload) ⇒ Object
- #expired_at ⇒ Object
-
#initialize(payment, options = {}) ⇒ Base
constructor
A new instance of Base.
- #partner_code ⇒ Object
- #payload ⇒ Object
- #payment_id ⇒ Object
- #refund_url ⇒ Object
- #transaction_id ⇒ Object
Constructor Details
#initialize(payment, options = {}) ⇒ Base
Returns a new instance of Base.
4 5 6 7 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 4 def initialize(payment, = {}) @options = @payment = payment end |
Instance Method Details
#amount ⇒ Object
22 23 24 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 22 def amount @payment.amount end |
#currency ⇒ Object
30 31 32 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 30 def currency 'USD' end |
#encrypt_data(payload) ⇒ Object
18 19 20 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 18 def encrypt_data(payload) SpreeCmCommissioner::AesEncryptionService.encrypt(payload.to_json, aes_key) end |
#expired_at ⇒ Object
38 39 40 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 38 def expired_at (Time.now + 30.minutes).to_i * 1000 end |
#partner_code ⇒ Object
42 43 44 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 42 def partner_code @payment.payment_method.preferred_partner_code end |
#payload ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 9 def payload { paymentId: payment_id, amount: amount, currency: currency || 'USD', expiredIn: expired_at } end |
#payment_id ⇒ Object
26 27 28 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 26 def payment_id @payment.number end |
#refund_url ⇒ Object
46 47 48 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 46 def refund_url @payment.payment_method.preferred_refund_url end |
#transaction_id ⇒ Object
34 35 36 |
# File 'lib/vpago/vattanac_mini_app/base.rb', line 34 def transaction_id @payment.number end |