Skip to content

Unable to use the statuses filter on CheckoutSdk::Disputes::DisputesQueryFilter #127

@LucDelmonRailsE

Description

@LucDelmonRailsE

Hello,

I have trouble using the
https://github.com/checkout/checkout-sdk-ruby/blob/master/lib/checkout_sdk/disputes/disputes_query_filter.rb

I have no problem making a filter on the payment_id (as you can see below)

and one dispute is returned with the status: 'evidence_under_review'

however when I try to add a filter on statuses.

a.statuses = CheckoutSdk::Disputes::DisputeStatus::EVIDENCE_UNDER_REVIEW or
a.statuses = [CheckoutSdk::Disputes::DisputeStatus::EVIDENCE_UNDER_REVIEW]

I do not retrieve the dispute anymore.
Even if the generated call : get: /disputes?payment_id=pay_e77yn2wwobeejoybhbnqbvi6d4&statuses=evidence_under_review seems correct.
Maybe I am missing how this filter should be written.

I can see some spec here:
https://github.com/checkout/checkout-sdk-ruby/blob/9f65b92be25eb9854c8c68bf3742b57f21d54b6e/spec/checkout_sdk/disputes/disputes_integration_spec.rb
but none use the statuses params.

pry(main)> a= CheckoutSdk::Disputes::DisputesQueryFilter.new
=> #<CheckoutSdk::Disputes::DisputesQueryFilter:0x00007f6187b5d9d0>
[34] pry(main)> a.payment_id = 'pay_e77yn2wwobeejoybhbnqbvi6d4'
=> "pay_e77yn2wwobeejoybhbnqbvi6d4"
[35] pry(main)> checkout.disputes.query(a).data.count
get: /disputes?payment_id=pay_e77yn2wwobeejoybhbnqbvi6d4
=> 1
[36] pry(main)> checkout.disputes.query(a).data.first.status
get: /disputes?payment_id=pay_e77yn2wwobeejoybhbnqbvi6d4
=> "evidence_under_review"
[37] pry(main)> a.statuses = CheckoutSdk::Disputes::DisputeStatus::EVIDENCE_UNDER_REVIEW
=> "evidence_under_review"
[38] pry(main)> checkout.disputes.query(a).data.count
get: /disputes?payment_id=pay_e77yn2wwobeejoybhbnqbvi6d4&statuses=evidence_under_review
=> 0
[39] pry(main)> a.statuses = [CheckoutSdk::Disputes::DisputeStatus::EVIDENCE_UNDER_REVIEW]
=> ["evidence_under_review"]
[40] pry(main)> checkout.disputes.query(a).data.count
get: /disputes?payment_id=pay_e77yn2wwobeejoybhbnqbvi6d4&statuses=evidence_under_review
=> 0

Additional info

When I use only the statuses filter (without the payment_id) I do get a dispute but on another payment id. So it would seem that the filter works but it might be the API that has a problem (not the gem then).

Only filter on status

pry(main)> a= CheckoutSdk::Disputes::DisputesQueryFilter.new
=> #<CheckoutSdk::Disputes::DisputesQueryFilter:0x00007f6187a493c8>
[55] pry(main)> a.statuses = CheckoutSdk::Disputes::DisputeStatus::EVIDENCE_UNDER_REVIEW
=> "evidence_under_review"
[57] pry(main)> ap checkout.disputes.query(a).data
get: /disputes?statuses=evidence_under_review
[
    [0] OpenStruct {
                        :id => "dsp_e0e89aaee61v70894992",
                 :entity_id => "ent_ul5wwdbk6acebcjxbtgjlguerm",
        :processing_channel => "pc_qp3d3duzg2qeji7eqtakdkvvta",
                  :category => "duplicate",
                    :status => "evidence_under_review",
                    :amount => 7275,
                  :currency => "USD",
               :reason_code => "12.6.1",
                :payment_id => "pay_p66hg2s2kpwujkfgxxlu6jxyaa",
         :payment_action_id => "act_6bjygkf6u3revif36e3f4ru7ae",
         :payment_reference => "7H742K",
            :payment_method => "Visa",
               :payment_arn => "24871153258036782286054",
               :payment_mcc => "4722",
               :received_on => "2023-10-28T16:06:17Z",
               :last_update => "2023-10-30T06:47:18Z",
                    :_links => OpenStruct {
            :self => OpenStruct {
                :href => "https://api.checkout.com/disputes/dsp_e0e89aaee61v70894992"
            }
        }
    }
]
=> nil

Only filter on id

[58] pry(main)> a= CheckoutSdk::Disputes::DisputesQueryFilter.new
=> #<CheckoutSdk::Disputes::DisputesQueryFilter:0x00007f618796bb40>
[59] pry(main)> a.payment_id = 'pay_e77yn2wwobeejoybhbnqbvi6d4'
=> "pay_e77yn2wwobeejoybhbnqbvi6d4"
[60] pry(main)> ap checkout.disputes.query(a).data
get: /disputes?payment_id=pay_e77yn2wwobeejoybhbnqbvi6d4
[
    [0] OpenStruct {
                        :id => "dsp_c31aaaaf678p70af0710",
                 :entity_id => "ent_ul5wwdbk6acebcjxbtgjlguerm",
        :processing_channel => "pc_qp3d3duzg2qeji7eqtakdkvvta",
                  :category => "not_as_described",
                    :status => "evidence_under_review",
                    :amount => 21295,
                  :currency => "USD",
               :reason_code => "13.3",
                :payment_id => "pay_e77yn2wwobeejoybhbnqbvi6d4",
         :payment_action_id => "act_tpgzsutzr66unoqx6awivjtxkm",
         :payment_reference => "49FDNH",
            :payment_method => "Visa",
               :payment_arn => "24871153233033957845954",
               :payment_mcc => "4722",
               :received_on => "2023-09-30T16:25:29Z",
               :last_update => "2023-10-04T06:10:05Z",
                    :_links => OpenStruct {
            :self => OpenStruct {
                :href => "https://api.checkout.com/disputes/dsp_c31aaaaf678p70af0710"
            }
        }
    }
]
=> nil

different result that have a 'evidence_under_review' status but was not present in the first call

Metadata

Metadata

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions