Skip to content

Onboarding Testers

Christian Dangl edited this page Dec 7, 2022 · 4 revisions

Hi,

We love quality and we love testing! Therefore, it's an obvious thing that we did our best for an easy and fun experience when it comes to testing payments with our plugin.

This page tells you a bit more about the tools and options you have with the MolliePayments plugin in Shopware 6.

1. Test mode and Mollie sandbox

Mollie provides a simple Sandbox mode to start testing. Open the plugin configuration and enable the "Test Mode" for your Sales Channel.

If you now start a payment in your shop, you should already see the sandbox page, where you can easily decide what should happen in your test scenario.

If you run your tests on a local system. Please note that "localhost" is not supported by Mollie. Please create a custom domain e.g. with your local /etc/hosts file, also add it to the domains of your Shopware sales channel, and use this one in your browser.

2. Swagger API

If you want to test API requests and response in an easy way, then we have prepared a custom Swagger project in our "Tests" folder. This comes with an easy to use docker-compose.yml file (just check out the makefile in this folder).

The Swagger page contains 2 views, 1 for the Storefront and API and 1 for Headless integrations. We did try to add everything that might be related to things you would usually test, and also added instructions and setup guides on these pages.

You can of course also use other API calls that are not integrated on this page (this ist just a sample for typical cases).

You should be able to start testing the Shopware API within 2 minutes if you already have Docker installed.

3. Fixtures and test data

We have provided a couple of test fixtures for you. This is fully optional, but helps if you want to get started in a fast way. It though requires this plugin to be installed as well: https://github.com/basecom/FixturesPlugin

Once ready, just run this command to install all fixtures, or a handful of them. Please note, you need the development dependencies to be installed first.

make dev
make fixtures

Congratulations, you should now see all kinds of products in your Shopware shop.

If you only want to install a few of the fixtures, feel free to use these commands directly

# activates and assigns payment methods for your Sales Channels
php bin/console fixture:load:group mollie-setup

# Installs demo data such as categories, products and users
php bin/console fixture:load:group mollie-demodata

4. Receive Webhooks locally

If you want to receive Mollie webhooks locally on your developer machine, please read our separate guide on this: Local Webhooks

5. Apple Pay Direct (online + local)

Apple Pay Direct can be fully tested. Once "Test Mode" is active in the plugin, you should also a TEST suffix in the shop name of the Apple Pay sheet.

Please keep in mind, that some requirements exist for Apple Pay Direct (see payment page in this documentation). Also the LIVE Api Key is required for domain validation, although we only use the TEST key for the payment.

If you test Apple Pay Direct features for your customer, you can fully test this on your local machine. Please read our separate guide on this: Apple Pay Direct Development

6. Subscriptions (online + local)

Subscriptions can be fully tested in test mode. You can even fake a renewal of orders. For this, please follow these steps:

  1. Disable security for testing

Add this line to the ".env" file of Shopware on the server. It will disable security checks that usually verify if a payment is really related to a specific subscriptions.

MOLLIE_DEV_MODE=1
  1. Create and confirm subscription with webhook or directly

If you have a system that is able to receive webhooks, you don't need to do anything. If this is not the case, you can add another value to the ".env" file. If Cypress mode is ON, a subscription on the Mollie side is already created when the user comes back from Mollie. If it's OFF, subscriptions are confirmed (created) on an incoming successful webhook.

MOLLIE_CYPRESS_MODE=1

Now go ahead and purchase a product that has been marked as "subscription" in the Shopware Administration.

  1. Renewal with Webhook

Now open Swagger, there is a webhook for subscriptions. Paste in your subscription ID (you can get it from the administration view of the subscription) and ANY Mollie transaction id (tr_xyz) from the Mollie dashboard.

If that ID is not yet known in Shopware, a new order is created which is the basic renewal process.

If the ID is known, only a payment status update happens.

If you want to read more about local development or testing on subscriptions, please read this: Subscription Development

7. Cypress Tests

We love Cypress and we use it a lot! This is a crucial thing for us and helps us to deliver a high quality product. And it also means, that it's possible to test a full checkout process in your Shopware shop too (if you use our plugin, or just Mollie).

Please check out our Cypress tests on Github. You can also build your own tests too.

These 2 links should help you to get started

Clone this wiki locally