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

Fixed method post_subscription() w.r.t checking ref of $subscription #68

Closed
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@manwar
Contributor

manwar commented Dec 6, 2015

Hi Luke, please review the above change.

Many Thanks.
Best Regards,
Mohammad S Anwar

@andrewsolomon

This comment has been minimized.

Show comment
Hide comment
@andrewsolomon

andrewsolomon Apr 29, 2017

Collaborator

Well spotted @manwar! To make sure the code is now doing exactly what we expect and doesn't go missing through a clumsy merge, could you please write a unit test exploiting this fix?

Thanks

Andrew

Collaborator

andrewsolomon commented Apr 29, 2017

Well spotted @manwar! To make sure the code is now doing exactly what we expect and doesn't go missing through a clumsy merge, could you please write a unit test exploiting this fix?

Thanks

Andrew

@andrewsolomon

please add a unit test

@manwar

This comment has been minimized.

Show comment
Hide comment
@manwar

manwar Apr 30, 2017

Contributor

Hi @andrewsolomon

Please review the proposed changes.

Many Thanks.
Best Regards,
Mohammad S Anwar

Contributor

manwar commented Apr 30, 2017

Hi @andrewsolomon

Please review the proposed changes.

Many Thanks.
Best Regards,
Mohammad S Anwar

return $self->_post("customers/$customer/subscriptions/" . $subscription->id, $subscription);
} elsif (defined($subscription) && !ref($subscription)) {
return $self->_post("customers/$customer/subscriptions/" . $subscription, _defined_arguments(\%args));
if (defined($subscription)) {

This comment has been minimized.

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

👍 That's nice and clear!

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

👍 That's nice and clear!

@@ -201,7 +201,7 @@ Charges: {
);
} 'Created a charge object with metadata';
isa_ok $charge, 'Net::Stripe::Charge';
ok defined($charge->metadata), "charge has metadata";
ok defined($charge->metadata), "charge has metadata";

This comment has been minimized.

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

Thanks for white space clean-up, but in the future please do that as a separate commit so that reverting this change (in case of unexpected problems) won't collide with other code making logical changes in this area.

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

Thanks for white space clean-up, but in the future please do that as a separate commit so that reverting this change (in case of unexpected problems) won't collide with other code making logical changes in this area.

return $self->_post("customers/$customer/subscriptions/" . $subscription->id, $subscription);
}
else {
die 'subscription should be of type Net::Stripe::Subscription';

This comment has been minimized.

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

This is tested! 👍

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

This is tested! 👍

if (defined($subscription)) {
if (ref($subscription)) {
if (ref($subscription) eq 'Net::Stripe::Subscription') {
return $self->_post("customers/$customer/subscriptions/" . $subscription->id, $subscription);

This comment has been minimized.

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

This isn't tested 👎

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

This isn't tested 👎

}
}
else {
return $self->_post("customers/$customer/subscriptions/" . $subscription, _defined_arguments(\%args));

This comment has been minimized.

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

This isn't tested 👎

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

This isn't tested 👎

subscription => $subs_list
);
};
ok $@, "subscription should be of type Net::Stripe::Subscription";

This comment has been minimized.

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

This is a good test, but only of the failure case. Would it be possible to add tests for the two cases with the 👎 above?

@andrewsolomon

andrewsolomon Apr 30, 2017

Collaborator

This is a good test, but only of the failure case. Would it be possible to add tests for the two cases with the 👎 above?

@manwar

This comment has been minimized.

Show comment
Hide comment
@manwar

manwar Apr 30, 2017

Contributor

Hi @andrewsolomon

Added two more test cases as requested.
Please review the changes.

Many Thanks.
Best Regards,
Mohammad S Anwar

Contributor

manwar commented Apr 30, 2017

Hi @andrewsolomon

Added two more test cases as requested.
Please review the changes.

Many Thanks.
Best Regards,
Mohammad S Anwar

@andrewsolomon

This comment has been minimized.

Show comment
Hide comment
@andrewsolomon

andrewsolomon May 1, 2017

Collaborator

Thanks @manwar but for some reason this test is failing when I apply your change to master

ok 140 - subscription should be of type Net::Stripe::Subscription
Error: invalid_request_error - Received unknown parameters: id, amount, currency, interval, interval_count, name On parameter: id
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 140.
Error: invalid_request_error - Received unknown parameters: id, amount, currency, interval, interval_count, name On parameter: id
Dubious, test returned 255 (wstat 65280, 0xff00)

Would you be so kind as to create a pull request from a new fork of this repo?

Many thanks,

Andrew

Collaborator

andrewsolomon commented May 1, 2017

Thanks @manwar but for some reason this test is failing when I apply your change to master

ok 140 - subscription should be of type Net::Stripe::Subscription
Error: invalid_request_error - Received unknown parameters: id, amount, currency, interval, interval_count, name On parameter: id
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 140.
Error: invalid_request_error - Received unknown parameters: id, amount, currency, interval, interval_count, name On parameter: id
Dubious, test returned 255 (wstat 65280, 0xff00)

Would you be so kind as to create a pull request from a new fork of this repo?

Many thanks,

Andrew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment