Skip to content

Commit

Permalink
v3.0.0 (#97)
Browse files Browse the repository at this point in the history
- Seller onboarding flow has been migrated from Oauth to Connect Onboarding. Make sure to configure your [Connect branding settings](https://dashboard.stripe.com/settings/connect) before upgrading.
- Consequently, the `/api/onboarding` endpoint has been removed, the `AccountOnboarding` entity has been deleted, and the `STRIPE_CLIENT_ID` environment variable is no longer needed.
- The `connector:sync:onboarding` command no longer uses the delay parameter. This parameter is now deprecated, please remove it from your crontab settings.
- You can now use the `SCHEME` environment variable to force HTTP when working locally or in a development environment.
- Stripe accounts are now created during the onboarding job and mapped with the corresponding Mirakl shop.
- Auto debit of negative balances is now disabled by default for new Stripe accounts (see #78).
- Improved Controllers tests.
  • Loading branch information
youssef-stripe authored Mar 8, 2022
1 parent e21ac6b commit c27e0d7
Show file tree
Hide file tree
Showing 56 changed files with 1,961 additions and 2,970 deletions.
20 changes: 12 additions & 8 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ APP_SECRET=TO_BE_GENERATED
# Will have to be in the X-AUTH-TOKEN header of every private request. Please generate a strong secret
OPERATOR_PASSWORD=TO_BE_GENERATED

# The scheme on which the connector will be publicly available.
# Used when generating refresh URLs for the onboarding flow.
# Defaults to https
#SCHEME=https

# The base host on which the connector will be publicly available.
# Used when generating redirect URLs for the Stripe Account Express onboarding.
# Used when generating refresh URLs for the onboarding flow.
# Required
BASE_HOST=https://stripe-mirakl.example.com
BASE_HOST=stripe-mirakl.example.com

# The connection URL to your database.
# See https://www.doctrine-project.org/projects/doctrine-dbal/en/2.9/reference/configuration.html#connecting-using-a-url
Expand Down Expand Up @@ -50,16 +55,15 @@ MIRAKL_API_KEY=
###### Onboarding workflow ######
#################################

# Enable the seller onboarding workflow.
# Defaults to true.
#ENABLE_SELLER_ONBOARDING=true

# The URL we will redirect the seller to after a successful account creation.
# Will be requested by a seller, must be publicly available.
# Default will be $MIRAKL_HOST_NAME/mmp/shop/account/shop
#REDIRECT_ONBOARDING=

# Your Stripe Connect Client ID. Available in your connect dashboard.
# https://dashboard.stripe.com/account/applications/settings
# Required
STRIPE_CLIENT_ID=ca_xxxxx

# Your Stripe Webhook Secret. Used to validate received webhooks.
# You can find it when you configure the connect webhook in the dashboard.
# https://dashboard.stripe.com/webhooks, then select the webhook
Expand Down Expand Up @@ -102,7 +106,7 @@ STRIPE_PREFILL_ONBOARDING=false
# Your Stripe Account Webhook Secret. Used to validate received webhooks.
# You can find it when you configure the connect webhook in the dashboard.
# https://dashboard.stripe.com/webhooks, then select the webhook
# Required / TODO: make this optional (required if payment validation enabled)
# Required
STRIPE_OPERATOR_WEBHOOK_SECRET=whsec_xxxxx

########################################
Expand Down
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ PANTHER_APP_ENV=panther
DATABASE_URL=${DATABASE_URL}
MESSENGER_TRANSPORT_DSN=in-memory://

STRIPE_CLIENT_ID=ca_key
STRIPE_CLIENT_SECRET=sk_test_secret

BASE_HOST=connector-example.com
MIRAKL_HOST_NAME=https://stripe.mirakl.net
REDIRECT_ONBOARDING=https://stripe.com
STRIPE_PREFILL_ONBOARDING=true
ENABLE_PRODUCT_PAYMENT_SPLIT=true
Expand Down
134 changes: 72 additions & 62 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
# Changelog

## Version 3.0.0
- Seller onboarding flow has been migrated from Oauth to Connect Onboarding. Make sure to configure your [Connect branding settings](https://dashboard.stripe.com/settings/connect) before upgrading.
- Consequently, the `/api/onboarding` endpoint has been removed, the `AccountOnboarding` entity has been deleted, and the `STRIPE_CLIENT_ID` environment variable is no longer needed.
- The `connector:sync:onboarding` command no longer uses the delay parameter. This parameter is now deprecated, please remove it from your crontab settings.
- You can now use the `SCHEME` environment variable to force HTTP when working locally or in a development environment.
- Stripe accounts are now created during the onboarding job and mapped with the corresponding Mirakl shop.
- Auto debit of negative balances is now disabled by default for new Stripe accounts (see #78).
- Improved Controllers tests.

## Version 2.1.5
- Fixed the Reason column in alerting emails

- Fixed the Reason column in alerting emails.

## Version 2.1.4
- Fetch orders by id in batches of 100 (#91 thanks @cysp)
- Minor syntax improvements and fixes
- Fetch orders by id in batches of 100 (#91 thanks @cysp).
- Minor syntax improvements and fixes.

## Version 2.1.3

- Added miraklShopId to Stripe Account metadata (#85 thanks @christophersjchow)
- Improved logs readability + added option to output externally via Filebeat
- Bumped dependencies
- Added miraklShopId to Stripe Account metadata (#85 thanks @christophersjchow).
- Improved logs readability + added option to output externally via Filebeat.
- Bumped dependencies.

## Version 2.1.2

- Added: fetch payment ID from PaymentMapping if not provided in order transaction_number
- Fixed: mark PaymentMapping as captured if charge is captured
- Added: fetch payment ID from PaymentMapping if not provided in order transaction_number.
- Fixed: mark PaymentMapping as captured if charge is captured.

## Version 2.1.1

- Fixed transfers not being created for subscription fees and extra invoices
- Added migration to restore previously aborted subscription fees and extra invoices to the backlog
- Fixed transfers not being created for subscription fees and extra invoices.
- Added migration to restore previously aborted subscription fees and extra invoices to the backlog.

## Version 2.1.0

Expand All @@ -31,11 +41,11 @@

## Version 2.0.4

- Fixed query params formatting for arrays (#72 thanks @fhervieux)
- Fixed query params formatting for arrays (#72 thanks @fhervieux).

## Version 2.0.3

- Fixed serialization of array query params on service endpoints (#70 thanks @fhervieux)
- Fixed serialization of array query params on service endpoints (#70 thanks @fhervieux).

## Version 2.0.2

Expand All @@ -52,106 +62,106 @@
- Added: "on hold" and "aborted" statuses for better backlog management.
- Added: support for service orders by the payment split and validation workflows.
- Fixed: `account.updated` event will now result in 200 OK if the account is not on Mirakl.
- Fixed: captured amount for refused/cancelled orders
- Fixed: captured amount for refused/cancelled orders.
- Breaking changes to the environment variables:
- Default payment metadata key for the payment validation is now `mirakl_commercial_order_id`. The connector will keep using your custom metadata key if you set one. This only affects users relying on the payment validation workflow and with no set `MIRAKL_METADATA_ORDER_ID` variable.
- Breaking changes to resources exposed by the connector API:
- Resource: renamed `StripeCharge` entity to `PaymentMapping`
- Resource: removed `TRANSFER_INVALID_AMOUNT` status from `StripeTransfer`
- Resource: added `*_ABORTED` and `*_ON_HOLD` statuses to `StripeTransfer`, `StripePayout` and `StripeRefund`
- Resource: added `type` to `StripeRefund`
- Notification: `stripePayoutId` in the `payout.failed` notification has been deprecated in favor of `payoutId`
- Notification: added `type` to `payout.failed`
- Resource: renamed `StripeCharge` entity to `PaymentMapping`.
- Resource: removed `TRANSFER_INVALID_AMOUNT` status from `StripeTransfer`.
- Resource: added `*_ABORTED` and `*_ON_HOLD` statuses to `StripeTransfer`, `StripePayout` and `StripeRefund`.
- Resource: added `type` to `StripeRefund`.
- Notification: `stripePayoutId` in the `payout.failed` notification has been deprecated in favor of `payoutId`.
- Notification: added `type` to `payout.failed`.

## Version 1.2.7

- Fixed capture flow when using PaymentIntents (#46)
- Fixed capture flow when using PaymentIntents (#46).

## Version 1.2.6

- Renamed sequence to match code naming (#45)
- Fixed incorrect method call in webhook controller (#43 thanks @christophersjchow)
- Improve compatibility with hybrid orders in capture flow (#42)
- Renamed sequence to match code naming (#45).
- Fixed incorrect method call in webhook controller (#43 thanks @christophersjchow).
- Improve compatibility with hybrid orders in capture flow (#42).

## Version 1.2.5

- Fixed payment validation + split combination (#38)
- Prevent failed payouts from being dispatched twice (#40)
- Fixed payment validation + split combination (#38).
- Prevent failed payouts from being dispatched twice (#40).

## Version 1.2.4

- Fetch shops from SERVICE domain too in onboarding job (#31 thanks @fhervieux)
- Fetch shops from SERVICE domain too in onboarding job (#31 thanks @fhervieux).

## Version 1.2.3

- Added distinct webhooks for operator and sellers (#29)
- Added payment cancellation for orders refused by all sellers (#30)
- Added distinct webhooks for operator and sellers (#29).
- Added payment cancellation for orders refused by all sellers (#30).

## Version 1.2.2

- Added validation and capture consumers to Docker example
- Added validation command to Docker example
- Updated cron schedule for orders in Docker example
- Added validation and capture consumers to Docker example.
- Added validation command to Docker example.
- Updated cron schedule for orders in Docker example.

## Version 1.2.1

- Updated docker example to force Composer 1.10 (#27)
- Updated docker example to force Composer 1.10 (#27).

## Version 1.2.0

- Added filter by orderId for transfers API (thanks @daniL16)
- Added payment validation (PA01) workflow
- Fixed commission handling in refunds workflow
- Improved retry logic for refunds workflow
- Improved retry logic for payouts workflow
- Fixed transfers workflow for new users (thanks @eBusEntwHOFM)
- Added filter by orderId for transfers API (thanks @daniL16).
- Added payment validation (PA01) workflow.
- Fixed commission handling in refunds workflow.
- Improved retry logic for refunds workflow.
- Improved retry logic for payouts workflow.
- Fixed transfers workflow for new users (thanks @eBusEntwHOFM).

## Version 1.1.6

- Bump symfony/http-kernel from 4.4.7 to 4.4.13
- Bump symfony/http-kernel from 4.4.7 to 4.4.13.

## Version 1.1.5

- Improved process-payouts job
- Fixed rare cases of one cent discrepancy in amount calculation
- Improved process-payouts job.
- Fixed rare cases of one cent discrepancy in amount calculation.

## Version 1.1.4

- Fixed retry attempts for already created transfers
- Fixed missing listener for KYC update job
- Fixed retry attempts for already created transfers.
- Fixed missing listener for KYC update job.

## Version 1.1.3

- Fixed mapping for notifications of FailedRefundMessage
- Fixed mapping for notifications of FailedRefundMessage.

## Version 1.1.2

- Fix test-db messages table handling
- Retry failed and invalid_amount transfers in process transfers command
- Fix test-db messages table handling.
- Retry failed and invalid_amount transfers in process transfers command.

## Version 1.1.1

- Moved Docker sample to a new [folder](examples/docker) for clarity
- Docker sample is now based on TrafeX/docker-php-nginx
- Moved Docker sample to a new [folder](examples/docker) for clarity.
- Docker sample is now based on TrafeX/docker-php-nginx.

## Version 1.1.0

- Upgrade to Symfony 4.4.7 (LTS)
- Fix PHP requirement to 7.1
- Add refund capabilities (thanks @ablanchard)
- Fix Transfer amount when order includes taxes
- Upgrade to Symfony 4.4.7 (LTS).
- Fix PHP requirement to 7.1.
- Add refund capabilities (thanks @ablanchard).
- Fix Transfer amount when order includes taxes.

## Version 1.0.0

- Initiation of Stripe Express onboarding
- Monitoring of Stripe accounts update
- Transfers from platform Stripe account to sellers Stripe account based on Mirakl Orders
- Payouts from sellers Stripe account to sellers bank account based on Mirakl Invoices
- Transfers from sellers Stripe account to platform Stripe account based on Mirakl Invoices (subscriptions fees, etc.)
- Initiation of Stripe Express onboarding.
- Monitoring of Stripe accounts update.
- Transfers from platform Stripe account to sellers Stripe account based on Mirakl Orders.
- Payouts from sellers Stripe account to sellers bank account based on Mirakl Invoices.
- Transfers from sellers Stripe account to platform Stripe account based on Mirakl Invoices (subscriptions fees, etc.).
- Server to server notifications:
- Seller account is updated on Stripe
- Transfer failed
- Payout failed
- Seller account is updated on Stripe.
- Transfer failed.
- Payout failed.
- Email notifications:
- Server to server notifications fail
- Daily recap of failed transfers and failed payouts
- Server to server notifications fail.
- Daily recap of failed transfers and failed payouts.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.5
3.0.0
2 changes: 1 addition & 1 deletion config/packages/nelmio_api_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ nelmio_api_doc:
title: Stripe Mirakl Connector
description: >
This connector allows marketplaces powered by Mirakl to onboard sellers on Stripe and pay them out automatically.
version: 2.1.5
version: 3.0.0
securityDefinitions:
Bearer:
type: apiKey
Expand Down
14 changes: 10 additions & 4 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
env(SCHEME): "https"
env(CORS_ALLOW_ORIGIN): "^https?://localhost(:[0-9]+)?$"
env(MAILER_DSN): "smtp://null"
env(TECHNICAL_ALERT_EMAIL): ""
Expand All @@ -15,6 +16,7 @@ parameters:
env(MIRAKL_CUSTOM_FIELD_CODE): "stripe-url"
env(ENABLE_SERVICE_PAYMENT_SPLIT): false
env(ENABLE_SERVICE_PAYMENT_REFUND): false
env(ENABLE_SELLER_ONBOARDING): true

default_redirect_onboarding: "%env(MIRAKL_HOST_NAME)%/mmp/shop/account/shop"
default_enable_product_payment_split: false
Expand All @@ -26,11 +28,10 @@ parameters:
deprecated_enable_product_payment_refund: "%env(default:default_enable_product_payment_refund:bool:ENABLES_AUTOMATIC_REFUND_CREATION)%"
deprecated_payment_metadata_commercial_order_id: "%env(default:default_payment_metadata_commercial_order_id:MIRAKL_METADATA_ORDER_ID)%"

router.request_context.scheme: '%env(SCHEME)%'
router.request_context.host: "%env(BASE_HOST)%"
router.request_context.scheme: 'https'

app.base_host: "%env(BASE_HOST)%"
app.stripe.client_id: "%env(STRIPE_CLIENT_ID)%"
app.stripe.client_secret: "%env(STRIPE_CLIENT_SECRET)%"
app.stripe.webhook_seller_secret: "%env(default:deprecated_webhook_secret:STRIPE_SELLERS_WEBHOOK_SECRET)%"
app.stripe.webhook_operator_secret: "%env(default:deprecated_webhook_secret:STRIPE_OPERATOR_WEBHOOK_SECRET)%"
Expand All @@ -39,6 +40,7 @@ parameters:
app.workflow.enable_service_payment_split: "%env(bool:ENABLE_SERVICE_PAYMENT_SPLIT)%"
app.workflow.enable_product_payment_refund: "%env(default:deprecated_enable_product_payment_refund:bool:ENABLE_PRODUCT_PAYMENT_REFUND)%"
app.workflow.enable_service_payment_refund: "%env(bool:ENABLE_SERVICE_PAYMENT_REFUND)%"
app.workflow.enable_seller_onboarding: "%env(bool:ENABLE_SELLER_ONBOARDING)%"
app.workflow.payment_metadata_commercial_order_id: "%env(default:deprecated_payment_metadata_commercial_order_id:PAYMENT_METADATA_COMMERCIAL_ORDER_ID)%"
app.mirakl.api_key: "%env(MIRAKL_API_KEY)%"
app.mirakl.host_name: "%env(MIRAKL_HOST_NAME)%"
Expand All @@ -56,7 +58,6 @@ services:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
bind:
$stripeClientId: "%app.stripe.client_id%"
$stripeClientSecret: "%app.stripe.client_secret%"
$webhookSellerSecret: "%app.stripe.webhook_seller_secret%"
$webhookOperatorSecret: "%app.stripe.webhook_operator_secret%"
Expand All @@ -69,6 +70,7 @@ services:
$enableServicePaymentSplit: "%app.workflow.enable_service_payment_split%"
$enableProductPaymentRefund: "%app.workflow.enable_product_payment_refund%"
$enableServicePaymentRefund: "%app.workflow.enable_service_payment_refund%"
$enableSellerOnboarding: "%app.workflow.enable_seller_onboarding%"
$metadataCommercialOrderId: "%app.workflow.payment_metadata_commercial_order_id%"
$redirectOnboarding: "%app.redirect.onboarding%"
$operatorNotificationUrl: "%app.operator.notification_url%"
Expand Down Expand Up @@ -130,7 +132,7 @@ services:
json_log_formatter:
class: Monolog\Formatter\JsonFormatter

App\Command\AccountOnboardingCommand:
App\Command\SellerOnboardingCommand:
calls:
- setLogger: ['@monolog.logger.onboarding']

Expand All @@ -153,3 +155,7 @@ services:
App\Command\SellerSettlementCommand:
calls:
- setLogger: ['@monolog.logger.process_payout']

App\Service\StripeClient:
bind:
$verifyWebhookSignature: true
12 changes: 7 additions & 5 deletions config/services_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
bind:
$stripeClientSecret: "%app.stripe.client_secret%"
$webhookSellerSecret: "%app.stripe.webhook_seller_secret%"
$webhookOperatorSecret: "%app.stripe.webhook_operator_secret%"
$customFieldCode: "%app.mirakl.stripe_custom_field_code%"

App\Tests\StripeMockedHttpClient:
class: App\Tests\StripeMockedHttpClient
public: true
bind:
$metadataCommercialOrderId: "%app.workflow.payment_metadata_commercial_order_id%"

App\Tests\MiraklMockedHttpClient:
class: App\Tests\MiraklMockedHttpClient
public: true
bind:
$customFieldCode: "%app.mirakl.stripe_custom_field_code%"

App\Service\MiraklClient:
class: App\Service\MiraklClient
Expand All @@ -32,3 +31,6 @@ services:
- method: setHttpClient
arguments:
- '@App\Tests\StripeMockedHttpClient'
bind:
$stripeClientSecret: "%app.stripe.client_secret%"
$verifyWebhookSignature: false
2 changes: 1 addition & 1 deletion examples/docker/app/config/crontab
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Every minute.
* * * * * php /var/www/bin/console connector:sync:onboarding 5 > /dev/null 2>&1
* * * * * php /var/www/bin/console connector:sync:onboarding -q > /dev/null 2>&1
# Every 5 minutes starting from 0. E.g. 10:00.
0-59/5 * * * * php /var/www/bin/console connector:validate:pending-debit -q > /dev/null 2>&1
# Every 5 minutes starting from 1. E.g. 10:01.
Expand Down
Loading

0 comments on commit c27e0d7

Please sign in to comment.