Skip to content

Commit

Permalink
Merge pull request #14 from olssonm/fix/add-swish-url
Browse files Browse the repository at this point in the history
Add SWISH_URL in config
  • Loading branch information
olssonm authored Aug 12, 2024
2 parents 846a8a2 + c374afd commit dcc8d05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ You will need to have access to your Swish-certificates to use this package in p

Read more about testing in their MSS-environment in their [official documentation](https://developer.swish.nu/documentation/environments#merchant-swish-simulator). A quick rundown on using/creating Swish-certificates [is published here](https://marcusolsson.me/artiklar/hur-man-skapar-certifikat-for-swish) (in Swedish).

When creating the client, you will have to set which environment you are working with (otherwise it defaults to the production environment, `https://cpc.getswish.net/swish-cpcapi/api/`), you may use `Client::TEST_ENDPOINT` and `Client::PRODUCTION_ENDPOINT` for this:
When creating the client, you will have to set which environment you are working with (otherwise it defaults to the production environment, `https://cpc.getswish.net/swish-cpcapi/api/`), you may use any of the following options:

``` php
Client::TEST_ENDPOINT // https://mss.cpc.getswish.net/swish-cpcapi/api/
Client::PRODUCTION_ENDPOINT // https://cpc.getswish.net/swish-cpcapi/api/
Client::SANDBOX_ENDPOINT // https://staging.getswish.pub.tds.tieto.com/swish-cpcapi/api/
```

``` php
use Olssonm\Swish\Certificate;
Expand Down Expand Up @@ -63,7 +69,7 @@ return [
'signing' => env('SWISH_SIGNING_CERTIFICATE_PATH', null),
'signing_password' => env('SWISH_CLIENT_SIGNING_PASSWORD', null),
],
'endpoint' => \Olssonm\Swish\Client::PRODUCTION_ENDPOINT,
'endpoint' => env('SWISH_URL', \Olssonm\Swish\Client::PRODUCTION_ENDPOINT),
];
```

Expand Down
2 changes: 1 addition & 1 deletion config/swish.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
'signing' => env('SWISH_SIGNING_CERTIFICATE_PATH', null), // Optional, used for payouts
'signing_password' => env('SWISH_SIGNING_CERTIFICATE_PASSWORD', null), // Optional, used for payouts
],
'endpoint' => \Olssonm\Swish\Client::PRODUCTION_ENDPOINT,
'endpoint' => env('SWISH_URL', \Olssonm\Swish\Client::PRODUCTION_ENDPOINT),
];
2 changes: 2 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Client

public const TEST_ENDPOINT = 'https://mss.cpc.getswish.net/swish-cpcapi/api/';

public const SANDBOX_ENDPOINT = 'https://staging.getswish.pub.tds.tieto.com/swish-cpcapi/api/';

protected ClientInterface $client;

public function __construct(
Expand Down

0 comments on commit dcc8d05

Please sign in to comment.