Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

End to end transaction #16

Merged
merged 19 commits into from
Sep 13, 2016
Merged

End to end transaction #16

merged 19 commits into from
Sep 13, 2016

Conversation

cbrunsdon
Copy link
Contributor

Provides javascript and endpoints to execute a `SolidusPaypalBraintree::Transaction".

This Transaction object is intended to model an "external transaction" that takes place between a user in javascript and Braintree, for which we need to import the details of after it is completed.

Clarke Brunsdon added 2 commits September 9, 2016 10:36
Adds the concept of a solidus transaction, representing the users
interaction with braintree's javascript
end

def user
order.user || nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|| nil doesn't make sense

Clarke Brunsdon added 2 commits September 12, 2016 07:10
This is useful for payment methods that largely skip the normal checkout
flow, like apple pay or paypal one touch.

Will be expanded to handle addresses and extra param.
Doesn't exactly map to our addresses, so we'll pick that up in email.
@cbrunsdon cbrunsdon force-pushed the end_to_end_transaction branch from 7d9cc66 to e86dc28 Compare September 12, 2016 14:15
Clarke Brunsdon and others added 8 commits September 12, 2016 16:34
Still need to allow customization of the import
Its pretty reasonable for solidus' use case to expect both and email and
a phone.
This isn't all the javascript required to go through and end-to-end
apple pay, but it provides the heavy-lifting between the frontend and
the backend API's.
Not required to be used if you want to write your own, but this should
get most people what they need in order to enable their payment methods.
Probably covers most peoples use cases, but feel free to override.
These didn't include phone or email, both of which are required.
@stewart stewart force-pushed the end_to_end_transaction branch from cd82825 to 80246fc Compare September 12, 2016 23:47
@cbrunsdon
Copy link
Contributor Author

I'm not sure restricting to display_on :front_end is valid, as that will put the payment method in the "usual checkout flow", even though often we wouldn't want it to be.

@stewart
Copy link
Contributor

stewart commented Sep 13, 2016

I was unsure of that as well - I'll remove that restriction. Scoping it to the gateway will likely be good enough.

@stewart stewart force-pushed the end_to_end_transaction branch from 80246fc to 2e8ce21 Compare September 13, 2016 15:56
last_name: ta.last_name,
city: ta.city,
country: country,
state: country.states.find_by_abbr(ta.state_code),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solidus will do this for us if we simply pass in the state_code to state_name.

@adammathys
Copy link
Member

👍 Just one minor comment. Fine with either approach.


def address
transaction.address.try do |ta|
country = Spree::Country.find_by_iso(ta.country_code)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_by(iso: ta.country_code)

stewart and others added 4 commits September 13, 2016 11:26
Due to the order and payment having new identifiers on each run, we
would never match the body of the request. Since we had VCR configured
to record new episodes by default, it would just keep appending to the
end of the file.

This ensures the body will match by always using the same identifiers
and also removes the global config option to record new episodes.
@cbrunsdon cbrunsdon merged commit dcf35a4 into master Sep 13, 2016
@adammathys adammathys deleted the end_to_end_transaction branch September 19, 2016 21:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants