Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LucDelmonRailsE opened this issue Oct 30, 2023 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@LucDelmonRailsE
Copy link

LucDelmonRailsE commented Oct 30, 2023

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

@armando-rodriguez-cko armando-rodriguez-cko self-assigned this Oct 31, 2023
@armando-rodriguez-cko
Copy link
Contributor

Hi @LucDelmonRailsE! We will take a look, thank you.

@armando-rodriguez-cko armando-rodriguez-cko added the help wanted Extra attention is needed label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

No branches or pull requests

2 participants