Class: Vpago::PaymentUrlConstructor

Inherits:
Object
  • Object
show all
Defined in:
app/services/vpago/payment_url_constructor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payment) ⇒ PaymentUrlConstructor

Returns a new instance of PaymentUrlConstructor.



7
8
9
10
# File 'app/services/vpago/payment_url_constructor.rb', line 7

def initialize(payment)
  @payment = payment
  @order = payment.order
end

Instance Attribute Details

#orderObject

Returns the value of attribute order.



5
6
7
# File 'app/services/vpago/payment_url_constructor.rb', line 5

def order
  @order
end

#paymentObject

Returns the value of attribute payment.



5
6
7
# File 'app/services/vpago/payment_url_constructor.rb', line 5

def payment
  @payment
end

Instance Method Details

#checkout_urlObject



12
# File 'app/services/vpago/payment_url_constructor.rb', line 12

def checkout_url = "#{base_url}/vpago_payments/checkout?#{query}&platform=app"

#offsite_payment?Boolean

true money use case

Returns:

  • (Boolean)


32
33
34
# File 'app/services/vpago/payment_url_constructor.rb', line 32

def offsite_payment?
  payment.payment_method.type_true_money?
end

#process_payment_urlObject



20
# File 'app/services/vpago/payment_url_constructor.rb', line 20

def process_payment_url = "#{base_url}/vpago_payments/process_payment?#{query}"

#processing_urlObject



15
# File 'app/services/vpago/payment_url_constructor.rb', line 15

def processing_url = "#{base_url}/vpago_payments/processing?#{query}"

#queryObject



22
23
24
25
26
27
28
29
# File 'app/services/vpago/payment_url_constructor.rb', line 22

def query
  {
    payment_number: payment.number,
    order_number: order.number,
    order_jwt_token: order_jwt_token,
    offsite_payment: offsite_payment? ? true : nil
  }.compact.to_query
end


18
# File 'app/services/vpago/payment_url_constructor.rb', line 18

def success_deeplink_url = "#{app_scheme}://#{URI(base_url).host}/book/payment?number=#{order.number}&tk=#{order.token}"

#success_urlObject



17
# File 'app/services/vpago/payment_url_constructor.rb', line 17

def success_url = "#{base_url}/vpago_payments/success?#{query}"

#web_checkout_urlObject



13
# File 'app/services/vpago/payment_url_constructor.rb', line 13

def web_checkout_url = "#{base_url}/vpago_payments/checkout?#{query}&platform=web"