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
Capture transactions via platform #305
Conversation
bd5036f
to
26d6b4f
Compare
'4242424242424242', | ||
'Livia Nascimento', | ||
'0224', | ||
'123' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you put those data hard coded in this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should return a PagarMe\Sdk\Card\Card
object and works well but, during the tests this will break because we can't pass a valid card hash, so, if the card hash informed is invalid AND there's an environment variable PAGARME_DEVELOPMENT=enabled
an object test will be returned.
I don't like this but, thats the way I figured out to automate the test. I'll extract this behavior in another method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good =)
* @return void | ||
* @throws PagarMe_CreditCard_Model_Exception_CantCaptureTransaction | ||
* @throws \Exception | ||
*/ | ||
public function capture(Varien_Object $payment, $amount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you using this method only in the button's click, is it correctly?
5b7b3c2
to
c4c5b0f
Compare
03f956e
to
c2b0260
Compare
Define a workflow to validate that capture from platform will work properly
This trait, it's usefull not only for postbacks context. This trait was used to create orders paid by credit card and boleto, so we should use this in another places. So, it will deprecate this trait and create a new class agnostic from contexts that do the job.
Create a new order by credit card using checkout transparent. To do that, it defines a new environment variable `PAGARME_DEVELOPMENT=enabled` wich will be used to generate a valid `PagarMe\Sdk\Card` on `PagarMe_CreditCard_Model_Creditcard::generateCard` during the e2e tests. The method `generateCard` is responsible to return an `PagarMe\Sdk\Card` and, if the new environment variable is setted to `enabled` it means that we're running magento in development environment, so, it'll return a Card for tests.
Add spin method to `SessionWait` trait
Implement a new method responsible to retrieve the page details url from an order id.
Declares the `session` property, also, remove an unused line
Create a new test to validate that the method responsible to get and instantiate a new Abstract transaction works well
Implement a new method that can retrieve transaction informations through Pagar.me's API. It uses the sdk and instantiate an `AbstractTransaction` object
Implement the capture behavior that will permit to invoice orders online (capture online).
Removes useless steps and change async to capture
During the creation of an order programmatically, we should inform the customer. This changes the assign to set that avoid some treatments and just attribute the object to the correctly property
Fix and implement the capture false steps to validate the feature
The quote data was retrieved from the session. This change to get that value from order to allow an order creation programmatically
The step was expecting that the page should have an element related to "success" to get the message. This change that to a generic one, independent that the operation was executed successfully or not
897afb7
to
1b6c839
Compare
Check if there's an api key setted on magento and, if yes, avoid to create another one
Remove unused pieces of code and set default magento store
Some tests was breaking after the new implementation To-do: refactor capture method to isolate the service model dependency
Since there's no way to inform a valid cardhash in the backend. This will return a card object for e2e tests only if the `PAGARME_DEVELOPMENT` environment variable has the value `enabled`. Otherwise throw an exception
1b6c839
to
e75bdb6
Compare
There's a problem on this scenario and, to deliver a alpha version we'll skip this test for now since manual tests guarantee that this feature works well
Description
It allow ecommerce administrators to capture transactions via platform. To do that, they should create a new invoice to capture the related transaction on Pagar.me.
Tests
Created acceptance and unit tests to validate the behavior