Class: SixSaferpay::SixTransaction::Capture

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/api/six_transaction/requests/capture.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_header: nil, transaction_reference:, amount: nil, billpay: nil, pending_notification: nil, marketplace: nil, mastercard_issuer_installments: nil) ⇒ Capture

Returns a new instance of Capture.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 15

def initialize(request_header: nil,
               transaction_reference:,
               amount: nil,
               billpay: nil,
               pending_notification: nil,
               marketplace: nil,
              mastercard_issuer_installments: nil
              )
  @request_header = request_header || SixSaferpay::RequestHeader.new()
  @transaction_reference = SixSaferpay::TransactionReference.new(**transaction_reference.to_h) if transaction_reference
  @amount = SixSaferpay::Amount.new(**amount.to_h) if amount
  @billpay = SixSaferpay::Billpay.new(**billpay.to_h) if billpay
  @pending_notification = SixSaferpay::PendingNotification.new(**pending_notification.to_h) if pending_notification
  @marketplace = SixSaferpay::Marketplace.new(**marketplace.to_h) if marketplace
  if mastercard_issuer_installments
    @mastercard_issuer_installments = SixSaferpay::MastercardIssuerInstallments
      .new(**mastercard_issuer_installments.to_h)
  end
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 5

def amount
  @amount
end

#billpayObject

Returns the value of attribute billpay.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 5

def billpay
  @billpay
end

#marketplaceObject

Returns the value of attribute marketplace.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 5

def marketplace
  @marketplace
end

#mastercard_issuer_installmentsObject

Returns the value of attribute mastercard_issuer_installments.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 5

def mastercard_issuer_installments
  @mastercard_issuer_installments
end

#pending_notificationObject

Returns the value of attribute pending_notification.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 5

def pending_notification
  @pending_notification
end

#request_headerObject

Returns the value of attribute request_header.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 5

def request_header
  @request_header
end

#transaction_referenceObject

Returns the value of attribute transaction_reference.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 5

def transaction_reference
  @transaction_reference
end

Instance Method Details

#response_classObject



58
59
60
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 58

def response_class
  SixSaferpay::SixTransaction::CaptureResponse
end

#to_hashObject Also known as: to_h



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 35

def to_hash
  hash = Hash.new
  hash.merge!(request_header: @request_header.to_h) if @request_header
  hash.merge!(transaction_reference: @transaction_reference.to_h) if @transaction_reference
  hash.merge!(amount: @amount.to_h) if @amount
  hash.merge!(billpay: @billpay.to_h) if @billpay
  hash.merge!(pending_notification: @pending_notification.to_h) if @pending_notification
  hash.merge!(marketplace: @marketplace.to_h) if @marketplace
  if @mastercard_issuer_installments
    hash.merge!(mastercard_issuer_installments: mastercard_issuer_installments.to_h)
  end
  hash
end

#to_jsonObject



50
51
52
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 50

def to_json
  to_hash.to_json
end

#urlObject



54
55
56
# File 'lib/six_saferpay/api/six_transaction/requests/capture.rb', line 54

def url
  '/Payment/v1/Transaction/Capture'
end