Skip to content

iOS Examples: Integration Tests

A variety of integration tests are provided with the SDK. They are stored in the Example folder. Before running them, do not forget to: * Run 'pod install' in order to install the dependencies * Change the scheme, once you open the workspace in Xcode, to the testing one. Running on executable target will just open a dummy screen informing to choose the correct scheme.

These tests are useful for testing your hardware and back-end connection as well as familiarizing yourself with typical application code that uses the SDK.

Each Test file has detailed comments that walk you through the code, and are described briefly below.

UserTests

Provides a variety of tests for user and credential management (i.e., username/password), including:

  • get credentials for a user
  • remind a user of their username
  • handle a request by a user to reset their password
  • allow the user to change their password

This functionality is part of the User Manager component which is described in more detail in the User Manager component chapter.

SalesTests

Provides a basic test of a sale, including:

  • login and request user data
  • request a sale from the current user
  • save the sale response so it can be used by other tests, such as the Printer tests
  • query the sale

Tip

If you dive in and start reading the code, note that objects are named with a prefix of WD. WD is short for Wirecard. So to read the object name, ignore this prefix. For example, WDSalesQuery is the Sales Query object. WDMerchantUser is the Merchant User object.

SpireTests

The SDK supports the Spire Spm2 card reader terminal. This test allows you to validate that it functions properly with the SDK. To use this test, you must:

  • have an actual iOS device because device simulators do not work for this test
  • have a Spire terminal paired to your iOS device through your iOS device settings
  • your Spire terminal must have been provided by Wirecard (so it is setup properly on backend)

Once your hardware is ready, you can use the integration test to:

  • discover paired iOS device
  • check for updates for the device
  • handle firmware updates
  • process a card sale
  • refund a sale
  • process an authorize/preauthorize payment
  • capture an auth/preauth payment or add supplements amount to it
  • process card EFT payments

Tip

The refund code is particularly useful if you are using an actual credit card to test because you will want to refund any purchases you make on a real card.

The code also demonstrates how to add a tip and a discount. And there is additional code to help you with Cash Management if you have this feature enabled in the back-end.

DatecsPrinterTest

Enables you to test a Datecs printer, including:

  • get a sale
  • detect a printer
  • print a receipt

The Datecs printer only works with the Receipt object. The StarIO printer works with:

  • PDF
  • UIImage

CashTests

Demonstrates a complete usage of the Cash Management feature including how to:

  • login and request user data
  • check for available cash registers and get one
  • deal with various shift-related activities, such as open and close
  • pay in and pay out

The code also demonstrates how to process:

  • a complete cash sale with a basket full of items
  • a refund of a sale

CatalogueTests

Illustrates how to request:

  • product catalogues
  • product categories
  • products
  • product images

This data can then be used to display a product catalogue within your payment acceptance app, including images of each product.

ERP Tests

This test helps you validate queries directed at an SAP back-end ERP. For more information about using an ERP as part of your back-end, consult Using an ERP.

Before using this test, you must:

  • have ERP enabled in your back-end
  • ensure that you have actual data, such as product catalogue, members, products and so forth in your ERP

Note

Members is another term for Customers in some ERP systems.

The code demonstrates how to:

  • search for members
  • request discount prices for specific members
  • request stock levels for specific products

Note

Stock level refers to the quantity of products in inventory.

See Product Stocks (ERP) for more information about retrieving and using product stock levels from your ERP system.

SocketScannerTests

The SDK supports the SocketMobile Series 7 scanner. This Test allows you to test it, including:

  • discover paired scanners
  • listen for activity on the paired scanner
  • process a scanned barcode
  • handle battery level changes

To use this test, a barcode-example.png image file is provided in the WDePOSDemo folder, as shown:

Scan this barcode when running this test to validate that your scanner is functioning properly.

StarIOTests

The SDK supports a variety of StarIO devices. This test helps you test them. Specifically, the code:

  • detects paired devices
  • opens the cash drawer
  • prints a receipt
  • scans a barcode

Note

The StarMicronics device does not have a barcode scanner.

StatsTests

A simple implementation lets you test the statistics retrieval features of the SDK, including querying for:

  • minimum, maximum and average sale amounts
  • turnover
  • transaction counts

See the Sales Statistics chapter for complete information.