-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Marketplace: Vendor Accepts Payments (#1031)
* Marketplace: Start sketching out docs for how we Checkout Co-authored-by: Ana <[email protected]> Co-authored-by: Dalton <[email protected]> Co-authored-by: Kelly Hong <[email protected]> * Stripe: Install Stripe Gem Co-authored-by: Dalton <[email protected]> * Marketplace: Buyer checks-out with Stripe Checkout! FUCK YEAAHHHHHHH Co-authored-by: Dalton <[email protected]> * Marketplace: Tidy up generation of Stripe session Co-authored-by: Dalton <[email protected]> Co-authored-by: Naomi Quinones <[email protected]> * Marketplace; Turbo does not like the URL used for Stripe Checkout For whatever reason, it is truncating the urls; and rather than fucking around trying to figure out how to make turbo play nicely, just disable; since we know we will need to redraw the entire DOM anyway, since we are redirecting to a Stripe Checkout page. Co-authored-by: Dalton <[email protected]> Co-authored-by: Naomi Quinones <[email protected]> * Marketplace: Buyer sees Checkout after Checkout It does make me feel like we are using Checkout for too many things, and maybe we want an Order class which is distinct from a Checkout but we didn't want to jump through those hoops in this particual session. Co-authored-by: Dalton <[email protected]> Co-authored-by: Naomi Quinones <[email protected]> * Freeze the Cart and Checkout after a successful payment, and clear out the current cart. Co-authored-by: Zee <[email protected]> Co-authored-by: Kelly <[email protected]> Co-authored-by: Dalton <[email protected]> * Update CheckoutPolicy to match spec expectations (#1044) This PR updates the CheckoutPolicy implementation to satisfy the expectations in the spec. I do not know if this is precisely the behavior we want -- e.g. maybe we want a "marketplace admin" (space owner?) to be able to always see a Checkout -- but we can expand the behavior later. * Handle the "failed to initiate checkout" case and add request specs. * Add guards for the cases when we don't have a cart. * Marketplace: `current_cart` is a lie, it's the shopper! Co-authored-by: Ana <[email protected]> Co-authored-by: Dalton <[email protected]> Co-authored-by: Kelly Hong <[email protected]> * Marketplace: Checking out works again! Co-authored-by: Ana <[email protected]> Co-authored-by: Dalton <[email protected]> Co-authored-by: Kelly Hong <[email protected]> * Marketplace: Test that receiving a Stripe session id Co-authored-by: Ana <[email protected]> Co-authored-by: Dalton <[email protected]> Co-authored-by: Kelly Hong <[email protected]> * Marketplace: Test relationships between Checkout and OrderedProducts Co-authored-by: Ana <[email protected]> Co-authored-by: Dalton <[email protected]> Co-authored-by: Kelly Hong <[email protected]> Co-authored-by: Ana <[email protected]> Co-authored-by: Dalton <[email protected]> Co-authored-by: Kelly Hong <[email protected]> Co-authored-by: Dalton <[email protected]> Co-authored-by: Naomi Quinones <[email protected]> Co-authored-by: Ana Ulin <[email protected]> Co-authored-by: Zee <[email protected]> Co-authored-by: Kelly <[email protected]> Co-authored-by: Dalton P <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
eaee16c
commit e6bf54c
Showing
26 changed files
with
233 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Marketplace | ||
|
||
The Marketplace uses Stripe, we anticipate that we will want to use the "Connect then Transfer" workflow: https://stripe.com/docs/connect/collect-then-transfer-guide | ||
|
||
1. Build the Workflow for connecting a Stripe Account | ||
2. Checkout with Stripe Checkout, and include the payment_intent_data with a transfer_group: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-transfer_group | ||
3. Upon completion of Checkout, we transfer the Money: https://stripe.com/docs/connect/charges-transfers | ||
|
||
## Testing with Stripe | ||
|
||
Stripe provides test API keys and testing credit card numbers, see: | ||
* https://stripe.com/docs/keys#obtain-api-keys | ||
* https://stripe.com/docs/testing |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,9 @@ def create? | |
|
||
checkout.shopper.person == current_person | ||
end | ||
|
||
def show? | ||
create? | ||
end | ||
end | ||
end |
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
2 changes: 1 addition & 1 deletion
2
...niture/marketplace/checkouts/new.html.erb → ...iture/marketplace/checkouts/show.html.erb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<%- breadcrumb :marketplace_checkout, checkout%> | ||
<%= render checkout %> | ||
<%= render checkout %> |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Marketplace | ||
class OrderedProduct < CartProduct | ||
include WithinLocation | ||
self.location_parent = :checkout | ||
|
||
has_one :checkout, through: :cart | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
app/furniture/marketplace/ordered_products/_ordered_product.html.erb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<tr id="<%=dom_id(ordered_product)%>"> | ||
<td class="w-full max-w-0 py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:w-auto sm:max-w-none sm:pl-6"> | ||
<%= ordered_product.name %> | ||
<dl class="font-normal lg:hidden"> | ||
<dt class="sr-only"><%= ordered_product.class.human_attribute_name(:description) %></dt> | ||
<dd class="mt-1 truncate text-gray-700"><%= ordered_product.description %></dd> | ||
</dl> | ||
</td> | ||
<td class="hidden px-3 py-4 text-sm text-gray-500 lg:table-cell"> | ||
<%= ordered_product.description %> | ||
</td> | ||
<td class="hidden px-3 py-4 text-sm text-gray-500 sm:table-cell"> | ||
<%= humanized_money_with_symbol(ordered_product.price) %> | ||
</td> | ||
</tr> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddCheckoutMetadata < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :marketplace_checkouts, :status, :string, default: "pre_checkout", null: false | ||
add_column :marketplace_checkouts, :stripe_session_id, :string | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddStatusToCart < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :marketplace_carts, :status, :string, default: "pre_checkout", null: false | ||
end | ||
end |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
Oops, something went wrong.