lexik / LexikPayboxBundle

LexikPayboxBundle eases the implementation of the Paybox payment system
MIT License
40 stars 47 forks source link

Added Subscription Cancellation #1

Closed fabienpomerol closed 11 years ago

fabienpomerol commented 11 years ago

There is a missing feature on this bundle : a way to cancel a subscription

Paybox offer a way to cancel an existing subscription by a server/server call. (Page 26 of the integration doc).

This PR fix this problem by adding a transport layer based on the PlemiPayboxBundle. For now I just backported the CurlTransport. But we could backport the shell too.

The cgi to call is not really normalized like the normal cgi. He expected variables with different names...

So i created a CancellationRequest and CancellationParameterResolver in order to handle this specific params.

The use case is the following :

$paybox = $this->get('lexik_paybox.request_cancellation_handler');
$response = $paybox->cancel('my_paybox_reference');

This PR is fully tested.

Tell me if there is some enhancement to do.

Olineuve commented 11 years ago

Hi Fabien,

Thanks a lot for this feature :+1:

I'm just a little bit concerned with the way you manage the transport service's configuration :suspect: I discussed about it with my colleagues, it should be interesting to get only a new service "lexik_paybox.transport" in the service.yml with its class specified in the configuration (with a validation) and set in the container by the extension class. That way, any transport class will be usable.

fabienpomerol commented 11 years ago

You'are right. In my implementation if you want to add a new transport layer you just have to add for exemple a shell.yml under config/transport/ and specify

# config.yml
lexik_paybox:
    transport: shell

I see what you mean. Your idea is to easily allow a user to use it's own transport class and not only one provide by the bundle.

Why not ! I'll updated this PR tonight !

fabienpomerol commented 11 years ago

BTW Travis is screaming for a dependency he couldn't download

https://travis-ci.org/lexik/LexikPayboxBundle/jobs/3618625

any idea ?

Olineuve commented 11 years ago

I forced the version of the OptionResolver in this commit https://github.com/lexik/LexikPayboxBundle/commit/59c0a799f6889b843faee8705fa481abea29862c and it seems to causes issues... I'll try to switch back to dev-master and see what happen :p

fabienpomerol commented 11 years ago

Here we are, i updated the transport service's configuration.

Olineuve commented 11 years ago

Nice job, thanks a lot :feelsgood: