Class: DPay::ApplePayRequest
- Inherits:
-
Object
- Object
- DPay::ApplePayRequest
- Defined in:
- lib/dpay/card/apple_pay_request.rb,
sig/dpay/card/apple_pay_request.rbs
Constant Summary collapse
- INIT =
"APPLE_PAY_INIT"- PAY =
"APPLE_PAY"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x_pay_type, token, device_info) ⇒ ApplePayRequest
constructor
A new instance of ApplePayRequest.
- #to_body ⇒ Hash[String, untyped]
- #with_channel_id(channel_id) ⇒ self
Constructor Details
#initialize(x_pay_type, token, device_info) ⇒ ApplePayRequest
Returns a new instance of ApplePayRequest.
16 17 18 19 20 21 |
# File 'lib/dpay/card/apple_pay_request.rb', line 16 def initialize(x_pay_type, token, device_info) @x_pay_type = x_pay_type @token = token @device_info = device_info @channel_id = nil end |
Class Method Details
.init(device_info) ⇒ ApplePayRequest
8 9 10 |
# File 'lib/dpay/card/apple_pay_request.rb', line 8 def self.init(device_info) new(INIT, nil, device_info) end |
.pay(token, device_info) ⇒ ApplePayRequest
12 13 14 |
# File 'lib/dpay/card/apple_pay_request.rb', line 12 def self.pay(token, device_info) new(PAY, token, device_info) end |
Instance Method Details
#to_body ⇒ Hash[String, untyped]
28 29 30 31 32 33 34 35 36 |
# File 'lib/dpay/card/apple_pay_request.rb', line 28 def to_body body = {} body["channelId"] = @channel_id unless @channel_id.nil? body["xPayType"] = @x_pay_type body["xPayToken"] = @token unless @token.nil? body["deviceInfo"] = @device_info.to_h body end |
#with_channel_id(channel_id) ⇒ self
23 24 25 26 |
# File 'lib/dpay/card/apple_pay_request.rb', line 23 def with_channel_id(channel_id) @channel_id = channel_id self end |