Skip to content
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

OCC-63: Separate Stripe payment into a feature so it can be disabled if other payment provider is desired. #373

Merged
merged 171 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 162 commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
a263c9e
Adding Product List base architecture
barthamark Oct 16, 2023
4f94476
Improving boolean attribute display in cart
porgabi Oct 16, 2023
a0725a4
Handling attributes on checkout in ProductAttributeProvider
porgabi Oct 17, 2023
d38b6de
Merge remote-tracking branch 'origin/main' into issue/OCC-195
porgabi Oct 17, 2023
ea5f7cd
Handling attributes during Order creation
porgabi Oct 17, 2023
ac0745f
Fixing Order view
porgabi Oct 17, 2023
0d2698e
Renaming SelectedAttributes property to SelectedTextAttributes
porgabi Oct 18, 2023
4b75d9a
Adding boolean attribute editing capabilities to Order editor
porgabi Oct 18, 2023
2fb6278
Fixing bug with boolean attributes display
porgabi Oct 18, 2023
e156707
Constructing actual boolean attributes as well
porgabi Oct 19, 2023
d7b1162
Fistfighting analyzer
porgabi Oct 19, 2023
d9d1a2c
Adjusting Order editor styling
porgabi Oct 19, 2023
835c985
Adding handling of numeric attributes
porgabi Oct 19, 2023
8e0217a
Improving numeric inputs in Order editor
porgabi Oct 20, 2023
0446f9e
Fixing warning
porgabi Oct 20, 2023
ab4d52e
Potentially fixing test
porgabi Oct 20, 2023
dbddd71
Extending UI test
porgabi Oct 20, 2023
bbd31ce
Merge remote-tracking branch 'origin/main' into issue/OCC-195
porgabi Oct 20, 2023
91ff484
Adding minor improvements
porgabi Oct 20, 2023
d39ad72
Improving JSON parsing
porgabi Oct 20, 2023
f12e19b
Adding minor fixes
porgabi Oct 21, 2023
bc2c82f
Creating navigation extension method
porgabi Oct 21, 2023
85d3127
Fixing string in view
porgabi Oct 21, 2023
20fee84
Replacing SelectedTextAttributes with SelectedAttributes
porgabi Oct 21, 2023
397b385
Create OrchardCore.Commerce.Payment module.
sarahelsaig Oct 22, 2023
6984015
Add separate module to OrchardCore.Commerce.Payment.Stripe.
sarahelsaig Oct 22, 2023
f603d11
Move most Stripe files into its own module.
sarahelsaig Oct 22, 2023
fd2ce5c
Move PaymentIntent too.
sarahelsaig Oct 22, 2023
dcc3e98
Fix some easier errors.
sarahelsaig Oct 22, 2023
3d377b9
Using SelectedAttributes everywhere
porgabi Oct 23, 2023
449f3a2
Moving business logic to service
porgabi Oct 23, 2023
4a4ea09
Warnin't
porgabi Oct 23, 2023
8de65f2
Fixing test
porgabi Oct 23, 2023
a07e1e7
Use _productService.GetProductsAsync in CreateOrderLineItemsAsync.
sarahelsaig Oct 23, 2023
1b73cad
Create RequestOptionsService.
sarahelsaig Oct 23, 2023
67fc6a5
Create OrchardCore.Commerce.Abstraction to store some models and inte…
sarahelsaig Oct 23, 2023
04535ca
Some project organization.
sarahelsaig Oct 23, 2023
1aa6f03
Move two view-models and add SKU holder interfaces.
sarahelsaig Oct 23, 2023
5952734
Move more stuff over to abstractions.
sarahelsaig Oct 24, 2023
16ae7cf
More code reorganization.
sarahelsaig Oct 24, 2023
98b0c25
Move serialization to abstraction.
sarahelsaig Oct 24, 2023
39e104b
Resolve non-Payment related errors except ProductAttributeValueConver…
sarahelsaig Oct 24, 2023
a27355e
Modular deserializers.
sarahelsaig Oct 24, 2023
7996341
Move CreateOrderLineItemsAsync to ShoppingCartHelpers.
sarahelsaig Oct 24, 2023
ec544ea
Working on adding providers
porgabi Oct 24, 2023
f8f8a8f
Fixing Order editor; removing unnecessary code
porgabi Oct 24, 2023
8b62b7f
Moving method to service
porgabi Oct 24, 2023
b354f97
Make GetPaymentAmount private.
sarahelsaig Oct 24, 2023
d48c7ac
Extending providers with new meth
porgabi Oct 24, 2023
fe21c3c
Move WebhookController.
sarahelsaig Oct 24, 2023
2eb1cc3
Create StripeController.
sarahelsaig Oct 24, 2023
3e85541
Move order updating from StripePaymentService to regular PaymentService.
sarahelsaig Oct 24, 2023
6a030c9
Abstract CheckoutViewModel.
sarahelsaig Oct 24, 2023
97af57c
Replace InitializePaymentIntentAsync with CreateClientSecretAsync.
sarahelsaig Oct 24, 2023
dd09ef3
Move assets to the stripe project.
sarahelsaig Oct 25, 2023
9a3245f
Fix NodeJS Extensions references in csproj.
sarahelsaig Oct 25, 2023
678d229
Move payment-form.scss into Add separate module to OrchardCore.Commer…
sarahelsaig Oct 25, 2023
566c7da
Move FieldsOnlyDisplayManager to ContentFields module.
sarahelsaig Oct 26, 2023
e66a6bb
Move PaymentController and PaymentService to the module.
sarahelsaig Oct 26, 2023
839b49b
Move AddressField into ContentFields module.
sarahelsaig Oct 26, 2023
e724b70
Extract the UserAddress stuff into an event handler.
sarahelsaig Oct 26, 2023
fe4def7
Adding ordering options
barthamark Oct 26, 2023
caed1ec
Move commerce-regions.js to ContentFields.
sarahelsaig Oct 26, 2023
231fea6
Externalize OrderContentTypeDefinitionDisplayDriver._excludedShapes.
sarahelsaig Oct 26, 2023
46cfc03
Remove stripe-specific properties from ICheckoutViewModel.
sarahelsaig Oct 26, 2023
3ba1d3b
Adding title filter
barthamark Oct 26, 2023
c82fcb9
Abstract stripe data in CheckoutViewModel.
sarahelsaig Oct 26, 2023
f0e0bda
Replace StripeCheckout shape usages with a list of provider shapes.
sarahelsaig Oct 27, 2023
f06140f
Go back to directly importing PaymentForm after all.
sarahelsaig Oct 27, 2023
f7939d9
Wire OrchardCore.Commerce.Payment into OrchardCore.Commerce.
sarahelsaig Oct 27, 2023
26d03e3
Update excludes.
sarahelsaig Oct 27, 2023
eafee3a
Add "deserializers" to the allow list.
sarahelsaig Oct 27, 2023
89af8a8
unusing
sarahelsaig Oct 27, 2023
4470357
Fix non-Stripe problems with PaymentController.
sarahelsaig Oct 27, 2023
8349358
Add ProductAttributeProvider name constants.
sarahelsaig Oct 28, 2023
3c73e0b
Minor code cleanup.
sarahelsaig Oct 28, 2023
2be5da6
Merge branch 'issue/OCC-195' into issue/OCC-63
sarahelsaig Oct 28, 2023
1dcf5d4
Post merge fix-up.
sarahelsaig Oct 28, 2023
d5e9958
PaymentViewModel
sarahelsaig Oct 28, 2023
2789388
Create shape data in the provider, move Stripe stuff to StripePayment…
sarahelsaig Oct 28, 2023
eec6f65
Make `~/checkout/validate` provider-based.
sarahelsaig Oct 28, 2023
8124d18
Namespace fix.
sarahelsaig Oct 28, 2023
fa4c7ae
Don't assume default shopping cart ID.
sarahelsaig Oct 29, 2023
b7ef8ee
More shopping cart fixes.
sarahelsaig Oct 29, 2023
f025989
Set charges in the outer service.
sarahelsaig Oct 29, 2023
315e289
Turn Payment into a record.
sarahelsaig Oct 29, 2023
2d41060
Resolving applied filters from query string
barthamark Oct 29, 2023
fa6b87c
Adding UI tests
barthamark Oct 29, 2023
b944fc5
Renaming interface and fixing analyzer violations
barthamark Oct 29, 2023
02efae6
Fixing analyzer violation
barthamark Oct 29, 2023
bf6946e
Ignoring pager HTML validation error
barthamark Oct 29, 2023
3dae048
Removing unnecessary ContainedPart from products
barthamark Oct 29, 2023
1596bd2
Some more fixes.
sarahelsaig Oct 29, 2023
36ec42b
Add missing dependency.
sarahelsaig Oct 29, 2023
2069800
Add IPaymentProvider.FinalModificationOfOrderAsync().
sarahelsaig Oct 29, 2023
7b59fc7
Move OrderCreatedEvent workflow event into abstraction.
sarahelsaig Oct 29, 2023
6fe3db9
Update inventories using the OrderedAsync event.
sarahelsaig Oct 29, 2023
eaa79c2
Save user addresses in the FinalizeAsync event.
sarahelsaig Oct 29, 2023
d5b707b
All promotion services should be in the PromotionStartup.
sarahelsaig Oct 29, 2023
b434607
Add PromotionOrderEvents.
sarahelsaig Oct 29, 2023
07a144c
Add UserSettingsCheckoutEvents.
sarahelsaig Oct 29, 2023
33cca67
Make Promotion a dependency of Payment.Stripe.
sarahelsaig Oct 29, 2023
b5016eb
Add missing Node Extensions files.
sarahelsaig Oct 30, 2023
a7bc237
Remove broken project reference.
sarahelsaig Oct 30, 2023
f5658cc
Ensure payment view model's data is never null.
sarahelsaig Oct 30, 2023
1522e4f
Fix CreatedFreeAsync.
sarahelsaig Oct 30, 2023
240eb5f
Add missing Node Extensions files.
sarahelsaig Oct 30, 2023
f944a1a
Fix warnings.
sarahelsaig Oct 30, 2023
ef5b573
Feature setup.
sarahelsaig Oct 30, 2023
509e54e
Don't break with free orders.
sarahelsaig Oct 30, 2023
38ffa71
shoppingCartId nullable
sarahelsaig Oct 30, 2023
b594dbf
Minor refactorings
barthamark Oct 31, 2023
1e0c60b
Accepting only one order by value
barthamark Oct 31, 2023
f2e9420
Fixing failing UI test
barthamark Oct 31, 2023
69fe906
Update src/Modules/OrchardCore.Commerce/Services/ProductListService.cs
sarahelsaig Oct 31, 2023
70529ca
Merge branch 'issue/OCC-192' into issue/OCC-63
sarahelsaig Nov 2, 2023
419b245
Merge remote-tracking branch 'origin/main' into issue/OCC-63
sarahelsaig Nov 2, 2023
ade1d5f
Move Checkout-Stripe to CheckoutStripe.
sarahelsaig Nov 2, 2023
001bfed
Fix wrong data property names.
sarahelsaig Nov 2, 2023
5a55467
Fail early in PaymentConfirmationMiddleware if the payment intent or …
sarahelsaig Nov 2, 2023
da7e14a
Throw notification if there is a total in the free order.
sarahelsaig Nov 2, 2023
adbe29e
Use UpdateOrderToOrderedAsync in OrderController.
sarahelsaig Nov 2, 2023
ad80020
Move IPaymentService to OrchardCore.Commerce.Payment.
sarahelsaig Nov 3, 2023
02a4f01
Return the same way in stripe too.
sarahelsaig Nov 3, 2023
cb57bcf
No need for IOrchardHelper.
sarahelsaig Nov 3, 2023
deb00d4
Turn StripePaymentService.CheckTotals into an extension method.
sarahelsaig Nov 3, 2023
7cbd15e
Extract reusable parts of CreateOrUpdateOrderFromShoppingCartAsync lo…
sarahelsaig Nov 3, 2023
9d892a6
Handle FrontendException.
sarahelsaig Nov 3, 2023
1a5f995
Merge unnecessary single-use private method.
sarahelsaig Nov 3, 2023
bbdabc3
Simplify StripePaymentService constructor.
sarahelsaig Nov 3, 2023
74255fc
Add PaymentIntentPersistence.Remove() method.
sarahelsaig Nov 4, 2023
9b0a7cf
Add dummy provider.
sarahelsaig Nov 4, 2023
859cd3e
Extract payment button into a separate shape.
sarahelsaig Nov 4, 2023
35cb358
Fix PayButton.
sarahelsaig Nov 4, 2023
eb6a1c6
Add "Stripe" to the middleware action's name for consistency.
sarahelsaig Nov 4, 2023
f17d277
Fix spinner on the wrong button.
sarahelsaig Nov 4, 2023
d8427c7
Update payment intent persistence during submit.
sarahelsaig Nov 4, 2023
1654534
Add CreateShoppingCartViewModelAsync extension method.
sarahelsaig Nov 4, 2023
2ba86e7
grammar
sarahelsaig Nov 4, 2023
6031d1d
Add WhereName extension method to payment provider collection.
sarahelsaig Nov 4, 2023
e6db61d
Now working dummy provider.
sarahelsaig Nov 5, 2023
5310d8e
Update recipes.
sarahelsaig Nov 5, 2023
c974e7a
Code cleanup.
sarahelsaig Nov 5, 2023
11a2ce0
Don't break if the Stripe API key is not configured.
sarahelsaig Nov 5, 2023
4c92d07
Update Stripe docs.
sarahelsaig Nov 5, 2023
41ba340
Add general payment provider documentation.
sarahelsaig Nov 5, 2023
f4662ff
Add unit test.
sarahelsaig Nov 5, 2023
5196798
Fix spacing.
sarahelsaig Nov 5, 2023
cf131f0
Update excludes.txt.
sarahelsaig Nov 5, 2023
5fc3e19
Fix CartEventsShouldUpdateTableAndAddLineItem.
sarahelsaig Nov 5, 2023
ae3c3ae
fallbacks
sarahelsaig Nov 5, 2023
bfe87c3
fix paymentRequestUrl
sarahelsaig Nov 5, 2023
e355d14
cshtml unusing
sarahelsaig Nov 6, 2023
deaa218
Move ContentTypes to Abstractions.
sarahelsaig Nov 6, 2023
6bb37fa
Pluralize OrchardCore.Commerce.Abstraction.
sarahelsaig Nov 6, 2023
264e0e6
Fix namespace.
sarahelsaig Nov 6, 2023
478e9c6
Fix missing constant from unit test.
sarahelsaig Nov 6, 2023
fce2334
Fix and DRY ShoppingCartControllerTests.
sarahelsaig Nov 6, 2023
0869c77
Update namespaces.
sarahelsaig Nov 6, 2023
7d0ad36
Early payment intent error handling.
sarahelsaig Nov 6, 2023
fa59a8e
Skip charges if there is no PaymentMethod.
sarahelsaig Nov 6, 2023
637f427
Fix Stripe checkout for real now.
sarahelsaig Nov 6, 2023
7e5df7f
Add error message to PaymentConfirmationMiddleware failure.
sarahelsaig Nov 9, 2023
39b5837
Add const for repeated string.
sarahelsaig Nov 9, 2023
99cbe7b
DRY AddNewItemToCart and AddExistingItemToCart tests.
sarahelsaig Nov 9, 2023
0fc0d72
Add warning when no providers are applicable.
sarahelsaig Nov 9, 2023
a195ff6
Validate that the Stripe order is not empty.
sarahelsaig Nov 9, 2023
b01a686
This didn't work as expected.
sarahelsaig Nov 9, 2023
84f81e5
Fix bug where orderPart.LineItems.SetItems() cleared itself.
sarahelsaig Nov 9, 2023
97e20ca
Fix nuget references.
sarahelsaig Nov 9, 2023
5f34e34
Remove broken usings.
sarahelsaig Nov 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/spelling/allow/occ.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CLA
contentpart
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is related to this PR but, I managed to checkout with a product that is 0 in the inventory.
gif

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not related to this PR, but thanks for catching it!
I created a new issue: #375

CVC
DemeSzabolcs marked this conversation as resolved.
Show resolved Hide resolved
datetimefield
DemeSzabolcs marked this conversation as resolved.
Show resolved Hide resolved
deserializers
disqus
DemeSzabolcs marked this conversation as resolved.
Show resolved Hide resolved
emoji
EUR
Expand All @@ -27,8 +28,8 @@ pricefield
roadmap
shoppingcart
skus
testdiscountedproduct
testproduct
testproductvariant
testdiscountedproduct
unpublish
webhooks
4 changes: 2 additions & 2 deletions .github/actions/spelling/excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ docs/releases
docs/requirements\.txt$
mkdocs\.yml$
src/Libraries/OrchardCore\.Commerce\.MoneyDataType/Currency\.extra\.cs$
src/Modules/OrchardCore\.Commerce/Constants/CurrencyCollectionConstants\.cs$
src/Modules/OrchardCore\.Commerce/Extensions/PaymentExtensions\.cs$
src/Modules/OrchardCore\.Commerce\.Payment/Constants/CurrencyCollectionConstants\.cs$
src/Modules/OrchardCore\.Commerce\.Payment\.Stripe/Extensions/PaymentExtensions\.cs$
test/OrchardCore\.Commerce\.Tests/Fakes/AnkhMorporkCurrencyProvider\.cs$
test/OrchardCore\.Commerce\.Tests/ProductAttributeTests\.cs$
29 changes: 22 additions & 7 deletions OrchardCore.Commerce.sln
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "features", "features", "{9B
docs\features\tiered-price-part.md = docs\features\tiered-price-part.md
docs\features\user-features.md = docs\features\user-features.md
docs\features\workflows.md = docs\features\workflows.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "releases", "releases", "{E4DD8D47-02FA-41F7-8133-CBC4419645F5}"
ProjectSection(SolutionItems) = preProject
docs\releases\0.0.1.md = docs\releases\0.0.1.md
docs\releases\1.0.0.md = docs\releases\1.0.0.md
docs\features\payment-providers.md = docs\features\payment-providers.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "actions", "actions", "{83C01924-6F58-4777-A9EC-07943F7A2E31}"
Expand All @@ -108,6 +103,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libraries", "libraries", "{
docs\resources\libraries\README.md = docs\resources\libraries\README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCore.Commerce.Payment", "src\Modules\OrchardCore.Commerce.Payment\OrchardCore.Commerce.Payment.csproj", "{58DD682C-DA5C-4B51-BCB8-C65D690AAC67}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCore.Commerce.Payment.Stripe", "src\Modules\OrchardCore.Commerce.Payment.Stripe\OrchardCore.Commerce.Payment.Stripe.csproj", "{A4D69733-CDC0-46AE-B46A-163CCC6F77F9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCore.Commerce.Abstractions", "src\Libraries\OrchardCore.Commerce.Abstractions\OrchardCore.Commerce.Abstractions.csproj", "{28DB6CBB-1527-42A1-8EFE-3D95BF185884}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -158,6 +159,18 @@ Global
{3DB5D0DD-1509-40B8-AD1A-47D5672BF484}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DB5D0DD-1509-40B8-AD1A-47D5672BF484}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DB5D0DD-1509-40B8-AD1A-47D5672BF484}.Release|Any CPU.Build.0 = Release|Any CPU
{58DD682C-DA5C-4B51-BCB8-C65D690AAC67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58DD682C-DA5C-4B51-BCB8-C65D690AAC67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58DD682C-DA5C-4B51-BCB8-C65D690AAC67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58DD682C-DA5C-4B51-BCB8-C65D690AAC67}.Release|Any CPU.Build.0 = Release|Any CPU
{A4D69733-CDC0-46AE-B46A-163CCC6F77F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4D69733-CDC0-46AE-B46A-163CCC6F77F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4D69733-CDC0-46AE-B46A-163CCC6F77F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4D69733-CDC0-46AE-B46A-163CCC6F77F9}.Release|Any CPU.Build.0 = Release|Any CPU
{28DB6CBB-1527-42A1-8EFE-3D95BF185884}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28DB6CBB-1527-42A1-8EFE-3D95BF185884}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28DB6CBB-1527-42A1-8EFE-3D95BF185884}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28DB6CBB-1527-42A1-8EFE-3D95BF185884}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -177,13 +190,15 @@ Global
{87C422CA-C6F2-408F-987B-C8418995A331} = {E6C02BDF-EEB0-4ABD-ADEC-9932F60923AE}
{93871E12-0083-4323-BB7B-3CDA6E332D87} = {E6C02BDF-EEB0-4ABD-ADEC-9932F60923AE}
{9B2DB1CD-2B4A-4823-9762-CF4E90661404} = {BEBA1764-178A-4722-A193-4DEF26DCE8D1}
{E4DD8D47-02FA-41F7-8133-CBC4419645F5} = {BEBA1764-178A-4722-A193-4DEF26DCE8D1}
{83C01924-6F58-4777-A9EC-07943F7A2E31} = {4561F321-6E57-484B-950C-AC46798B1F40}
{E32B62B8-D737-4713-87C5-8220C9746643} = {83C01924-6F58-4777-A9EC-07943F7A2E31}
{7FB7940D-EEF4-4355-BCBF-C160080F257A} = {E32B62B8-D737-4713-87C5-8220C9746643}
{3DB5D0DD-1509-40B8-AD1A-47D5672BF484} = {772AFE42-DF1F-49B1-9F64-7C901E588C00}
{62DF9FF9-D2B3-4333-948D-2E405699B47B} = {BEBA1764-178A-4722-A193-4DEF26DCE8D1}
{C788AFFF-F440-4259-9102-5B4C1B91FAFA} = {62DF9FF9-D2B3-4333-948D-2E405699B47B}
{58DD682C-DA5C-4B51-BCB8-C65D690AAC67} = {E6C02BDF-EEB0-4ABD-ADEC-9932F60923AE}
{A4D69733-CDC0-46AE-B46A-163CCC6F77F9} = {E6C02BDF-EEB0-4ABD-ADEC-9932F60923AE}
{28DB6CBB-1527-42A1-8EFE-3D95BF185884} = {90913510-3D7F-4BCC-B55E-56343128F049}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {456CBC78-579D-483F-A4C3-AF5C12AB3324}
Expand Down
5 changes: 3 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ This project uses `Lombiq Node.js Extensions` to compile and lint client-side as
2. Build and run the `OrchardCore.Commerce.Web` project.
3. Thanks to [Auto Setup](https://docs.orchardcore.net/en/latest/docs/reference/modules/AutoSetup/), the site will be set up with the `OrchardCore Commerce - Development` recipe.
4. Go to the dashboard, using the credentials `admin` and `Password1!`.
5. Go to _Configuration_ → _Commerce_ → _Stripe API_. Set the keys to the test keys found [here](docs/features/stripe-payment.md). If the keys are not set, payment won't work.
5. If you want to test Stripe, go to _Configuration_ → _Commerce_ → _Stripe API_. Set the keys to the test keys found [here](docs/features/stripe-payment.md). If the keys are not set, the Stripe payment button won't appear during checkout.
6. Go to _Content_ → _Content Items_, and create your first `Product`.

## Documentation

- [Inventory](docs/features/inventory.md)
- [Products and Prices](docs/features/products-and-prices.md)
- [Promotions](docs/features/promotions.md)
- [Stripe Payment](docs/features/stripe-payment.md)
- [Payment providers](docs/features/payment-providers.md)
- [Stripe Payment](docs/features/stripe-payment.md)
- [Taxation](docs/features/taxation.md)
- [User Features](docs/features/user-features.md)
- [Workflows](docs/features/workflows.md)
Expand Down
20 changes: 20 additions & 0 deletions docs/features/payment-providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Payment Providers

Orchard Core Commerce supports multiple payment providers and allows developers to extend it further with their own.

## Official payment providers

Each provider is a stand-alone feature you can turn on or off.

- [Stripe](stripe-payment.md): A production-ready provider for [stripe.com](https://stripe.com/).
- Dummy: A development-only provider that lets you click through the checkout without going off-site. Mainly used for UI testing.

## Creating your own

To create a custom payment provider your code must contain the following:
- An implementation of `IPaymentProvider` registered as a service.
- A shape type `Checkout{provider.Name}`, such as _CheckoutStripe.cshtml_ and _CheckoutDummy.cshtml_.

The `IPaymentProvider` contains implementable methods used by the `CheckoutController`. To learn more about the individual methods in the interface, check out the individual methods' XML documentation.

The shape has the payment button that will be displayed on the `~/checkout` screen. It's up to you to include the front-end logic that calls out to your payment processor and to provide a callback URL. For the latter you can use the `~/checkout/callback/{providerName}/{orderId?}` action. It handles some basic state checking and redirection, but otherwise lets you resolve the pending order using `IPaymentProvider.UpdateAndRedirectToFinishedOrderAsync()`.
8 changes: 5 additions & 3 deletions docs/features/stripe-payment.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stripe Payment

Orchard Core Commerce [aims to support multiple payment providers](https://github.com/OrchardCMS/OrchardCore.Commerce/issues/149), but at this time [Stripe](https://stripe.com/) is the only supported implementation. This document describes how to set it up for testing, but if you just want to try out the checkout flow you can use the [cards](#cards) listed below without any configuration.
Orchard Core Commerce supports multiple [payment providers](payment-providers.md). [Stripe](https://stripe.com/) was the first implemented. This document describes how to set it up for testing, including hooking your site up to the Stripe dashboard. If you just want to try out the checkout flow you can skip the Webhook sections.

## Test data for Stripe Payment

Expand All @@ -14,13 +14,15 @@ Stripe API uses a secret-publishable key pair. The following API keys are public

**Publishable and secret keys are just publicly available test keys. Don't submit any personally identifiable information in requests made with this key.**

You can obtain your own test keys from the Stripe dashboard. You can find them at _Dashboard → Developers → API keys_.
You can obtain your own test keys from the Stripe dashboard. You can find them in the [developer dashboard's Api keys tab](https://dashboard.stripe.com/test/apikeys).

In your Orchard Core site go to _Admin_ → _Configuration_ → _Commerce_ → _Stripe API_ and provide at least the _Publishable key_ and _Secret key_. Otherwise the feature can't work and the payment button will be hidden during checkout.

### Webhook signing key

It is not needed, but recommended to use webhook. Otherwise, if there is a problem with redirecting the user, the payment confirmation will fail.

There is no publicly available webhook signing key. Use your own API keys and Webhook key. Create your own at _Dashboard → Developers → Webhooks_.
There is no publicly available webhook signing key. Use your own API keys and Webhook key. You can create one in the [developer dashboard's Webhooks tab](https://dashboard.stripe.com/test/webhooks).

Read about webhook status codes [here](https://stripe.com/docs/webhooks/best-practices#pending-webhook-statuses). Our webhook endpoint returns _200_ if the request was received without an exception. It does not mean that it has been processed. It returns _400_ if there was an exception inside the webhook controller. Everything else comes from Stripe itself.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using OrchardCore.Commerce.Abstractions.Models;
using System.Threading.Tasks;

namespace OrchardCore.Commerce.Abstractions.Abstractions;

/// <summary>
/// Extension points for events related to checkout.
/// </summary>
public interface ICheckoutEvents
{
/// <summary>
/// Invoked at the start of a new <see cref="OrderPart"/> creation which is used to create the <see
/// cref="ICheckoutViewModel"/>.
/// </summary>
Task OrderCreatingAsync(OrderPart orderPart, string shoppingCartId) => Task.CompletedTask;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using OrchardCore.Commerce.MoneyDataType;
using OrchardCore.DisplayManagement;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

namespace OrchardCore.Commerce.Abstractions.Abstractions;

[SuppressMessage(
"StyleCop.CSharp.DocumentationRules",
"SA1600:Elements should be documented",
Justification = "Nothing to say besides what's already on the property names.")]
public interface ICheckoutViewModel : IPaymentViewModel, IShape
{
string ShoppingCartId { get; }
Amount GrossTotal { get; }
IEnumerable<SelectListItem> Regions { get; set; }
IDictionary<string, IDictionary<string, string>> Provinces { get; }
string UserEmail { get; }
IEnumerable<IShape> CheckoutShapes { get; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using OrchardCore.Commerce.MoneyDataType;

namespace OrchardCore.Commerce.Abstractions;
namespace OrchardCore.Commerce.Abstractions.Abstractions;

/// <summary>
/// Represents an object that contains some of an order line item's basic info.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using OrchardCore.Commerce.Abstractions.Models;
using OrchardCore.Commerce.Abstractions.ViewModels;
using OrchardCore.ContentManagement;
using System.Threading.Tasks;

namespace OrchardCore.Commerce.Abstractions.Abstractions;

/// <summary>
/// Extension points for events related to orders.
/// </summary>
public interface IOrderEvents
{
/// <summary>
/// Invoked when a new free (non-payment) order is created.
/// </summary>
Task CreatedFreeAsync(OrderPart orderPart, ShoppingCart cart, ShoppingCartViewModel viewModel) => Task.CompletedTask;

/// <summary>
/// Invoked when the <paramref name="order"/> is set to the <c>Ordered</c> state.
/// </summary>
Task OrderedAsync(ContentItem order, string shoppingCartId) => Task.CompletedTask;

/// <summary>
/// Invoked during cleanup after the order has been finalized.
/// </summary>
Task FinalizeAsync(ContentItem order, string shoppingCartId, string paymentProviderName) => Task.CompletedTask;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using OrchardCore.Commerce.MoneyDataType;
using System;

namespace OrchardCore.Commerce.Abstractions;
namespace OrchardCore.Commerce.Abstractions.Abstractions;

/// <summary>
/// Describes a payment transaction's details.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using OrchardCore.Commerce.Abstractions.Models;
using OrchardCore.Commerce.MoneyDataType;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

namespace OrchardCore.Commerce.Abstractions.Abstractions;

[SuppressMessage(
"StyleCop.CSharp.DocumentationRules",
"SA1600:Elements should be documented",
Justification = "Nothing to say besides what's already on the property names.")]
public interface IPaymentViewModel
{
Amount SingleCurrencyTotal { get; }
Amount NetTotal { get; }
IDictionary<string, object> PaymentProviderData { get; }
OrderPart OrderPart { get; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OrchardCore.Commerce.Abstractions;
namespace OrchardCore.Commerce.Abstractions.Abstractions;

/// <summary>
/// Represents a predefined <see cref="IProductAttributeValue"/> with no type specified.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;

namespace OrchardCore.Commerce.Abstractions.Abstractions;

/// <summary>
/// Deserializes the attribute of the type <see cref="AttributeTypeName"/>.
/// </summary>
public interface IProductAttributeDeserializer
{
// Not necessary to document as they are not externally accessible.
#pragma warning disable SA1600 // Elements should be documented.
internal static readonly Dictionary<string, IProductAttributeDeserializer> Deserializers =
new(StringComparer.OrdinalIgnoreCase);

private static readonly object _lock = new();
#pragma warning restore SA1600

/// <summary>
/// Gets the attribute name used to identify this deserializer.
/// </summary>
string AttributeTypeName { get; }

/// <summary>
/// Deserializes using <c>Newtonsoft.Json</c>.
/// </summary>
IProductAttributeValue Deserialize(string attributeName, JObject attribute);

/// <summary>
/// Deserializes using <c>System.Text.Json</c>.
/// </summary>
IProductAttributeValue Deserialize(string attributeName, JsonObject attribute);

/// <summary>
/// Registers serializers used to deserialize product attributes.
/// </summary>
public static void AddSerializers(params IProductAttributeDeserializer[] deserializers)
{
lock (_lock)
{
foreach (var deserializer in deserializers)
{
Deserializers[deserializer.AttributeTypeName] = deserializer;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Newtonsoft.Json;
using OrchardCore.Commerce.Serialization;
using OrchardCore.Commerce.Abstractions.Serialization;
using System;
using System.Globalization;
using System.Linq;

namespace OrchardCore.Commerce.Abstractions;
namespace OrchardCore.Commerce.Abstractions.Abstractions;

/// <summary>
/// A specific value from a product attribute field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Globalization;
using System.Threading.Tasks;

namespace OrchardCore.Commerce.Abstractions;
namespace OrchardCore.Commerce.Abstractions.Abstractions;

/// <summary>
/// A service for accessing and customizing regions.
Expand Down
Loading