cego / seamless-wallet-client
Package for interacting with the seamless wallet service
Installs: 3 124
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 1
Requires
- php: ^7.4|^8.0
- ext-bcmath: *
- ext-json: *
- cego/service-client-base: ^0.1.9
- guzzlehttp/guzzle: ^6.5.5|^7.0.1
- illuminate/http: ^7.0|^8.0
- illuminate/support: ^7.0|^8.0
- nbj/property-container: ^1.4
- nesbot/carbon: ^2.42
- phpoption/phpoption: ^1.7
- vlucas/phpdotenv: ^5.2
Requires (Dev)
- cego/request-insurance: ^0.3.2
- friendsofphp/php-cs-fixer: ^2.16
- orchestra/testbench: ^6.13
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^9.0
- ramsey/uuid: ^4.1
Suggests
- cego/request-insurance: Allows for sending asynchronous requests
- dev-master
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.0
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- 0.0.1-rc2
- 0.0.1-rc1
- dev-thwo/bump-base-client
- dev-thwo/remove-composer-lock
- dev-niza/add-wallet-summary-endpoint
- dev-niza/add-description-to-transactions
- dev-niza/implement-service-client-base
- dev-niza/add-request-insurance-option
- dev-niza/add-transaction-endpoint
- dev-mjn/add-github-actions
- dev-niza/add-sum-of-wallet-balances-endpoint
This package is auto-updated.
Last update: 2022-01-18 12:44:18 UTC
README
Project was initially created by:
- Niki Ewald Zakariassen (NIZA)
- Nikolaj Boel Jensen (NBJ)
Usage
The seamless wallet client implements a fluid interface for interacting with the seamless wallet service.
Interface
// Getting a client instance $seamlessWallet = SeamlessWallet::create('base_url') ->auth(/* < Credentials > */); // Setting the target player $seamlessWallet->forPlayer($playerId);
// Creating a user wallet SeamlessWallet::create(/* < Base Url > */) ->auth(/* < Credentials > */) ->forPlayer($playerId) ->createWallet();
// Deposits / withdraws / balance / rollback SeamlessWallet::create(/* < Base Url > */) ->auth(/* < Credentials > */) ->forPlayer($playerId) ->deposit(100, "UUID6" /*, $transaction_context, $external_id */); SeamlessWallet::create(/* < Base Url > */) ->auth(/* < Credentials > */) ->forPlayer($playerId) ->withdraw(20, "UUID6" /*, $transaction_context, $external_id */); SeamlessWallet::create(/* < Base Url > */) ->auth(/* < Credentials > */) ->forPlayer($playerId) ->getBalance(); SeamlessWallet::create(/* < Base Url > */) ->auth(/* < Credentials > */) ->rollbackTransaction("UUID6");
// Using request insurance SeamlessWallet::create(/* < Base Url > */) ->auth(/* < Credentials > */) ->useRequestInsurance() ->forPlayer($playerId) ->deposit(100, "UUID6" /*, $transaction_context, $external_id */);
Note: After calling ->forPlayer() the id is kept in memory for later use
Note: Request insurance is only usable for POST requests, and is remembered for following requests. GET requests will always use the synchronous HTTP driver
Error Handling
The client does not use error return values, meaning if a request failed then an exception will be thrown: SeamlessWalletRequestFailedException.php.
The client has a configurable amount of retries on server errors, before throwing an exception.
- env("SEAMLESS_WALLET_CLIENT_MAXIMUM_NUMBER_OF_RETRIES")
- env("SEAMLESS_WALLET_CLIENT_TIMEOUT")