-
Notifications
You must be signed in to change notification settings - Fork 178
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
#219 support rest jsv4 implementation #221
Open
eileenmcnaughton
wants to merge
12
commits into
thephpleague:master
Choose a base branch
from
eileenmcnaughton:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e31317b
to
3ed4d4d
Compare
a72f643
to
2ded7ec
Compare
When setting up a paypal rest Authorize request there are a few possibilities we have a payment token we have a credit card number & cvv & expiry we have neither of the above and should be redirected to paypal for us to log in and authorize the payment. Currently the code understands the difference as cardReference is present 'card' object is present neither of the above. However, the card object also holds other information - email, address, phone etc. Even if these are not used by Paypal Rest the calling code should not need to know that it can't set these under a specific combination of circumstances. This fix looks more deeply into the passed card parameter for the presence of the actual card fields - ie.card number, expiry - and otherwise concludes this is not a card-present transations and allows the redirect to proceed
…ntegrations. In a generic integration the card parameter might exist to hold billing address details even when the card number is not provided. We don't expect the integration to hold knowledge that 'paypal rest won't work if you pass a 'card' paramter when you are pre-authorizing a token' so we should look more deeply into the passed card parameter for the presence of the actual card fields - ie. card number, expiry ,cvv
…nReference. When processing a request with no card present a token is retrieved from paypal which is the used by a paypal browser script to open a paypal popup to approve the token. It's a bit arguable whether this is best retrieved via getTransactionReference or getCardReference. cardReference makes sense in that the token is used in place of a card but it's also the only reference we have for the transaction at this point. Related : thephpleague#219 thephpleague#215
…sent This scenario occurs when the pay with paypal button is clicked and authentication is done offsite
…ew paypal agreement This submits the required paypal requests to complete the authorization of a stored token representing a paypal authorization - ie. like creating a re-usable card but when the card is not presented via the php layer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for Rest jsv4 where the createCard object can create a reference to a billing agreement that can be rebilled when the card is not present. This is similar to the normal createCard in that a token represents the card but the card details have been validated in the Paypal popup rather than by them being passed through this code.
The process is that createCard is called and getTransactionReference then returns a token which is passed back to the paypal js script. The paypal script pops up a modal where the user authorizes the card and then the authorized token can be used like a normal cardReference from then on. Obviously the paypal js script is out of scope for Omnipay but it needs to be able to call some php function via ajax to work
I've been a bit back & forth on whether the token should be retrieved via getTransactionReference & getCardReference - also in #215 - it's the only reference that exists for the transaction prior to it being authorized & it kinda refers to the transaction about to be authorized but it also kinda makes sense as a cardReference. It's a fallback in the getTransactionReference function at the moment & could arguably be a fallback in both.
See #220
Includes #220