lib/mp_api/payment.rb in mp_api-0.1.9 vs lib/mp_api/payment.rb in mp_api-0.2.0
- old
+ new
@@ -8,12 +8,12 @@
e.message == 'Too many retries' ? raise(TooManyRequestsError) : raise(e)
end
new(**build_hash(response))
end
- attr_reader :status_detail, :three_ds_info_creq, :three_ds_info_external_resource_url, :three_d_secure_mode, :id, :description, :date_approved, :date_created, :money_release_date, :payer_email, :payer_identification_type, :payer_identification_number, :payment_method, :payment_type, :qr_code, :qr_code_base_64, :transaction_id, :ticket_url, :status, :amount, :token, :issuer_id, :installments
- def initialize(status_detail:nil, three_ds_info_creq:nil, three_ds_info_external_resource_url:nil, three_d_secure_mode:nil, id:nil, description:nil, date_approved:nil, date_created:nil, money_release_date:nil, payer_email:, payer_identification_type:, payer_identification_number:, payment_method:, payment_type:nil, qr_code:nil, qr_code_base_64:nil, transaction_id:nil, ticket_url:nil, status:nil, amount:, token:nil, issuer_id:nil, installments:nil)
+ attr_reader :status_detail, :three_ds_info_creq, :three_ds_info_external_resource_url, :three_d_secure_mode, :id, :description, :date_approved, :date_created, :money_release_date, :payer_email, :payer_identification_type, :payer_identification_number, :payment_method, :payment_type, :qr_code, :qr_code_base_64, :transaction_id, :ticket_url, :status, :amount, :token, :issuer_id, :installments, :statement_descriptor, :items
+ def initialize(status_detail:nil, three_ds_info_creq:nil, three_ds_info_external_resource_url:nil, three_d_secure_mode:nil, id:nil, description:nil, date_approved:nil, date_created:nil, money_release_date:nil, payer_email:, payer_identification_type:, payer_identification_number:, payment_method:, payment_type:nil, qr_code:nil, qr_code_base_64:nil, transaction_id:nil, ticket_url:nil, status:nil, amount:, token:nil, issuer_id:nil, installments:nil, items:nil, statement_descriptor:nil)
@id = id
@description = description
@date_approved = date_approved
@date_created = date_created
@money_release_date = money_release_date
@@ -33,19 +33,33 @@
@installments = installments
@three_d_secure_mode = three_d_secure_mode
@three_ds_info_external_resource_url = three_ds_info_external_resource_url
@three_ds_info_creq = three_ds_info_creq
@status_detail = status_detail
+ @statement_descriptor = statement_descriptor
+ @items = items
+ # Array example:
+ # {
+ # id: "100002",
+ # title: "Retrovisor Jeep",
+ # picture_url: "https://http2.mlstatic.com/D_NQ_NP_2X_754724-MLB73109764910_122023-F.webp",
+ # quantity: 4,
+ # unit_price: 3
+ # }
end
def build_json
send("build_json_#{payment_method == 'pix' ? 'pix' : 'credit_card'}").except(:description)
end
def build_json_pix
{
transaction_amount: amount,
description: description,
+ statement_descriptor: statement_descriptor,
+ additional_info: {
+ items: @items
+ },
payment_method_id: payment_method,
payer: {
email: payer_email,
identification: {
type: payer_identification_type,