lib/bs2_api/entities/payment.rb in bs2_api-0.4.0 vs lib/bs2_api/entities/payment.rb in bs2_api-1.0.0
- old
+ new
@@ -1,37 +1,37 @@
# frozen_string_literal: true
module Bs2Api
module Entities
class Payment
- attr_accessor :id, :merchant_id, :receiver, :payer
+ attr_accessor :payment_id, :end_to_end_id, :receiver, :payer
def initialize(args = {})
- @id = args.fetch(:id, nil)
- @merchant_id = args.fetch(:merchant_id, nil)
- @receiver = args.fetch(:receiver, nil)
- @payer = args.fetch(:payer, nil)
+ @payment_id = args.fetch(:payment_id, nil)
+ @end_to_end_id = args.fetch(:end_to_end_id, nil)
+ @receiver = args.fetch(:receiver, nil)
+ @payer = args.fetch(:payer, nil)
end
def to_hash
ActiveSupport::HashWithIndifferentAccess.new(
{
- "pagamentoId": @id,
- "endToEndId": @merchant_id,
- "recebedor": @receiver.to_hash,
- "pagador": @payer.to_hash
+ "pagamentoId": @payment_id,
+ "endToEndId": @end_to_end_id,
+ "recebedor": @receiver.to_hash,
+ "pagador": @payer.to_hash
}
)
end
def self.from_response(hash_payload)
hash = ActiveSupport::HashWithIndifferentAccess.new(hash_payload)
Bs2Api::Entities::Payment.new(
- id: hash["pagamentoId"],
- merchant_id: hash["endToEndId"],
- receiver: Bs2Api::Entities::Bank.from_response(hash["recebedor"]),
- payer: Bs2Api::Entities::Bank.from_response(hash["pagador"])
+ payment_id: hash["pagamentoId"],
+ end_to_end_id: hash["endToEndId"],
+ receiver: Bs2Api::Entities::Bank.from_response(hash["recebedor"]),
+ payer: Bs2Api::Entities::Bank.from_response(hash["pagador"])
)
end
end
end
end
\ No newline at end of file