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

Be able to filter when retrieving a Refund List from a Charge object. #91

Merged
merged 1 commit into from
Nov 30, 2018

Conversation

guzzilar
Copy link
Contributor

Objective

There is a case that user wants to retrieve a Refund List in reverse_chronological order from a Charge Object.

With the current code, it is impossible to achieve the above use case as there is no way to pass those filters when retrieving Refund List object from a Charge object.

$charge  = OmiseCharge::retrieve('chrg_test_xx');
$refunds = $charge->refunds();

Quality Assurance

Execute the following 2 code

$charge  = OmiseCharge::retrieve('chrg_test_xx');
$refunds = $charge->refunds();

and

$charge  = OmiseCharge::retrieve('chrg_test_xx');
$refunds = $charge->refunds(['limit' => 3, 'order' => 'reverse_chronological']);

The second code should alter the result of the Refund List object.

screen_shot_2561-11-20_at_10_22_28

Additional Notes

In the previous, the following code will always fetch a new Refund List object from Omise API.

$charge  = OmiseCharge::retrieve('chrg_test_xx');
$refunds = $charge->refunds();

But after the change, if there is no filter option passing through the $charge->refunds(); method the code will instead, assign $this['refunds'] to OmiseRefundList object (no request to Omise API).

@guzzilar guzzilar merged commit 4a123f0 into master Nov 30, 2018
@guzzilar guzzilar deleted the filterable-refund-list-object branch November 30, 2018 06:33
@guzzilar guzzilar mentioned this pull request Dec 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants