Skip to content

Commit

Permalink
Enhance LineItems providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometee committed Nov 20, 2024
1 parent 311dada commit d162ccf
Show file tree
Hide file tree
Showing 39 changed files with 886 additions and 372 deletions.
150 changes: 3 additions & 147 deletions config/services/providers.yaml
Original file line number Diff line number Diff line change
@@ -1,135 +1,12 @@
imports:
- { resource: 'providers/**/*.yaml' }

parameters:
flux_se.sylius_stripe.factories:
- stripe_checkout
- stripe_web_elements
flux_se.sylius_stripe.checkout.after_urls:
!php/const FluxSE\SyliusStripePlugin\Provider\AfterUrlProviderInterface::CANCEL_URL: ~
!php/const FluxSE\SyliusStripePlugin\Provider\AfterUrlProviderInterface::SUCCESS_URL: ~

services:
# WEB ELEMENTS
flux_se.sylius_stripe.provider.web_elements.create.payment_intent_params:
class: FluxSE\SyliusStripePlugin\Provider\CompositeParamsProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.web_elements.details

flux_se.sylius_stripe.provider.web_elements.amount:
class: FluxSE\SyliusStripePlugin\Provider\WebElements\Create\AmountProvider
tags:
- name: flux_se.sylius_stripe.provider.web_elements.details

flux_se.sylius_stripe.provider.web_elements.currency:
class: FluxSE\SyliusStripePlugin\Provider\WebElements\Create\CurrencyProvider
tags:
- name: flux_se.sylius_stripe.provider.web_elements.details

flux_se.sylius_stripe.provider.web_elements.payment_method_types:
class: FluxSE\SyliusStripePlugin\Provider\PaymentMethodTypesProvider
tags:
- name: flux_se.sylius_stripe.provider.web_elements.details

flux_se.sylius_stripe.provider.web_elements.token_hash_metadata:
class: FluxSE\SyliusStripePlugin\Provider\TokenHashMetadataProvider
tags:
- name: flux_se.sylius_stripe.provider.web_elements.details

flux_se.sylius_stripe.provider.web_elements.capture_method.manual:
class: FluxSE\SyliusStripePlugin\Provider\PaymentIntentCaptureMethodManualProvider
tags:
- name: flux_se.sylius_stripe.provider.web_elements.details

# CHECKOUT

flux_se.sylius_stripe.provider.checkout.after_url.default:
class: FluxSE\SyliusStripePlugin\Provider\DefaultAfterUrlProvider
arguments:
- '%flux_se.sylius_stripe.checkout.after_urls%'

flux_se.sylius_stripe.provider.checkout.create.checkout_session_params:
class: FluxSE\SyliusStripePlugin\Provider\CompositeParamsProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.details

flux_se.sylius_stripe.provider.checkout.after_url:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\AfterUrlProvider
arguments:
- '@flux_se.sylius_stripe.provider.checkout.after_url.default'
tags:
- name: flux_se.sylius_stripe.provider.checkout.details

flux_se.sylius_stripe.provider.checkout.payment_mode:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\ModePaymentProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.details

flux_se.sylius_stripe.provider.checkout.customer_email:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\CustomerEmailProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.details

flux_se.sylius_stripe.provider.checkout.payment_method_types:
class: FluxSE\SyliusStripePlugin\Provider\PaymentMethodTypesProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.details

flux_se.sylius_stripe.provider.checkout.token_hash_metadata:
class: FluxSE\SyliusStripePlugin\Provider\TokenHashMetadataProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.details

flux_se.sylius_stripe.provider.checkout.payment_intent_data:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\PaymentIntentDataProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.payment_intent_data
tags:
- name: flux_se.sylius_stripe.provider.checkout.details

flux_se.sylius_stripe.provider.checkout.payment_intent_data.capture_method.manual:
class: FluxSE\SyliusStripePlugin\Provider\PaymentIntentCaptureMethodManualProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.payment_intent_data

flux_se.sylius_stripe.provider.checkout.line_items:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItemsProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.line_item.order_item
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.line_item.shipment
tags:
- name: flux_se.sylius_stripe.provider.checkout.details

flux_se.sylius_stripe.provider.checkout.line_item.order_item:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\OrderItemLineItemProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.line_item.order_item.inner
tags:
- name: flux_se.sylius_stripe.provider.checkout.line_item.order_item

flux_se.sylius_stripe.provider.checkout.line_item.order_item.product_data.images:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\OrderItemProductDataImagesProvider
arguments:
- '@liip_imagine.cache.manager'
- '%flux_se.sylius_stripe.line_item_image.imagine_filter%'
- '%flux_se.sylius_stripe.line_item_image.fallback_image%'
- '%flux_se.sylius_stripe.line_item_image.localhost_pattern%'
tags:
- name: flux_se.sylius_stripe.provider.checkout.line_item.order_item.inner

flux_se.sylius_stripe.provider.checkout.line_item.order_item.product_data.name:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\OrderItemProductDataNameProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.line_item.order_item.inner

flux_se.sylius_stripe.provider.checkout.line_item.shipment:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\ShipmentLineItemProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.line_item.shipment.inner
tags:
- name: flux_se.sylius_stripe.provider.checkout.line_item.shipment

flux_se.sylius_stripe.provider.checkout.line_item.shipment.product_data.name:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\ShipmentProductDataNameProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.line_item.shipment.inner

FluxSE\SyliusStripePlugin\Provider\StripeNotifyPaymentProvider:
arguments:
Expand All @@ -138,24 +15,3 @@ services:
- '@flux_se.sylius_stripe.stripe.resolver.event_resolver'
tags:
- name: sylius.payment_request.payment_notify_provider

# REFUND
flux_se.sylius_stripe.provider.refund.create:
class: FluxSE\SyliusStripePlugin\Provider\CompositeParamsProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.refund.details

flux_se.sylius_stripe.provider.refund.metadata.amount:
class: FluxSE\SyliusStripePlugin\Provider\Refund\Create\AmountProvider
tags:
- name: flux_se.sylius_stripe.provider.refund.details

flux_se.sylius_stripe.provider.refund.metadata.payment_intent:
class: FluxSE\SyliusStripePlugin\Provider\Refund\Create\PaymentIntentProvider
tags:
- name: flux_se.sylius_stripe.provider.refund.details

flux_se.sylius_stripe.provider.refund.metadata.refund_token_hash:
class: FluxSE\SyliusStripePlugin\Provider\Refund\Create\RefundTokenHashMetadataProvider
tags:
- name: flux_se.sylius_stripe.provider.refund.details
174 changes: 174 additions & 0 deletions config/services/providers/checkout/create_params_providers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
parameters:
flux_se.sylius_stripe.checkout.after_urls:
!php/const FluxSE\SyliusStripePlugin\Provider\AfterUrlProviderInterface::CANCEL_URL: ~
!php/const FluxSE\SyliusStripePlugin\Provider\AfterUrlProviderInterface::SUCCESS_URL: ~

services:

flux_se.sylius_stripe.provider.checkout.after_url.default:
class: FluxSE\SyliusStripePlugin\Provider\DefaultAfterUrlProvider
arguments:
- '%flux_se.sylius_stripe.checkout.after_urls%'

flux_se.sylius_stripe.provider.checkout.create.params:
class: FluxSE\SyliusStripePlugin\Provider\CompositeParamsProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.inner_params

flux_se.sylius_stripe.provider.checkout.create.after_url:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\AfterUrlProvider
arguments:
- '@flux_se.sylius_stripe.provider.checkout.after_url.default'
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.inner_params
priority: -100

flux_se.sylius_stripe.provider.checkout.create.mode.payment:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\ModePaymentProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.inner_params
priority: -200

flux_se.sylius_stripe.provider.checkout.create.customer_email:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\CustomerEmailProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.inner_params
priority: -300

flux_se.sylius_stripe.provider.checkout.create.payment_method_types:
class: FluxSE\SyliusStripePlugin\Provider\PaymentMethodTypesProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.inner_params
priority: -400

flux_se.sylius_stripe.provider.checkout.create.payment_intent_data:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\PaymentIntentDataProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.payment_intent_data
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.inner_params
priority: -500

flux_se.sylius_stripe.provider.checkout.create.payment_intent_data.capture_method.manual:
class: FluxSE\SyliusStripePlugin\Provider\PaymentIntentCaptureMethodManualProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.payment_intent_data
priority: -100

flux_se.sylius_stripe.provider.checkout.create.line_items:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItemsProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.line_item.order_item
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.line_item.shipment
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.inner_params
priority: -600

flux_se.sylius_stripe.provider.checkout.create.line_item.order_item:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\OrderItemLineItemProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.inner
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.order_item
priority: -100

flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.quantity:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\QuantityProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.inner
priority: -100
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.inner
priority: -100

flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\OrderItemPriceDataProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.inner
priority: -200

flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data.product_data:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\PriceData\OrderItemProductDataProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data.product_data
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data
priority: -100

flux_se.sylius_stripe.provider.checkout.create.line_item.price_data.uni_amount:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\PriceData\UnitAmountProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data
priority: -200
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data
priority: -200

flux_se.sylius_stripe.provider.checkout.create.line_item.price_data.currency:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\PriceData\CurrencyProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data
priority: -300
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data
priority: -300

flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data.product_data.images:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\PriceData\ProductData\ProductImagesProvider
arguments:
- '@liip_imagine.cache.manager'
- '%flux_se.sylius_stripe.line_item_image.imagine_filter%'
- '%flux_se.sylius_stripe.line_item_image.fallback_image%'
- '%flux_se.sylius_stripe.line_item_image.localhost_pattern%'
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data.product_data
priority: -100

flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data.product_data.name:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\PriceData\ProductData\ProductNameProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.order_item.price_data.product_data
priority: -200

flux_se.sylius_stripe.provider.checkout.create.line_item.shipment:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\ShipmentLineItemProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.inner
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.shipment
priority: -100

flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\ShipmentPriceDataProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.inner
priority: -200

flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data.product_data:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\PriceData\ShipmentProductDataProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data.product_data
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data
priority: -100

flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data.product_data.name:
class: FluxSE\SyliusStripePlugin\Provider\Checkout\Create\LineItem\PriceData\ProductData\ShipmentNameProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.line_item.shipment.price_data.product_data
priority: -100

flux_se.sylius_stripe.provider.checkout.create.metadata:
class: FluxSE\SyliusStripePlugin\Provider\CompositeMetadataParamsProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.create.metadata
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.inner_params
priority: -700

flux_se.sylius_stripe.provider.checkout.create.metadata.token_hash:
class: FluxSE\SyliusStripePlugin\Provider\TokenHashMetadataProvider
tags:
- name: flux_se.sylius_stripe.provider.checkout.create.metadata
priority: -100
34 changes: 34 additions & 0 deletions config/services/providers/checkout/retrieve_params_providers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
parameters:
flux_se.sylius_stripe.checkout.retrieve.expand_fields:
- 'customer'
- 'line_items'
- 'payment_intent'
- 'payment_intent.latest_charge'
- 'payment_intent.payment_method'
- 'invoice'
- 'invoice.charge'
- 'invoice.payment_intent'
- 'invoice.default_payment_method'
- 'invoice.discounts'
- 'setup_intent'
- 'setup_intent.payment_method'
- 'subscription'
- 'subscription.default_payment_method'
- 'subscription.latest_invoice'
- 'subscription.default_source'
- 'subscription.discounts'

services:

flux_se.sylius_stripe.provider.checkout.retrieve.params:
class: FluxSE\SyliusStripePlugin\Provider\CompositeParamsProvider
arguments:
- !tagged_iterator flux_se.sylius_stripe.provider.checkout.retrieve.inner_params

flux_se.sylius_stripe.provider.checkout.retrieve.expand:
class: FluxSE\SyliusStripePlugin\Provider\ExpandProvider
arguments:
- '%flux_se.sylius_stripe.checkout.retrieve.expand_fields%'
tags:
- name: flux_se.sylius_stripe.provider.checkout.retrieve.inner_params
priority: -100
Loading

0 comments on commit d162ccf

Please sign in to comment.