ServiceProvider.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the overtrue/wechat.
  4. *
  5. * (c) overtrue <i@overtrue.me>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace crmeb\services\easywechat\orderShipping;
  11. use EasyWeChat\Payment\Merchant;
  12. use Pimple\Container;
  13. use Pimple\ServiceProviderInterface;
  14. use EasyWeChat\MiniProgram\AccessToken;
  15. /**
  16. * Class ServiceProvider.
  17. *
  18. * @package crmeb\services\easywechat\order_ship
  19. * @package crmeb\services\easywechat\mini_express
  20. */
  21. class ServiceProvider implements ServiceProviderInterface
  22. {
  23. /**
  24. * {@inheritdoc}.
  25. */
  26. public function register(Container $pimple)
  27. {
  28. $pimple['mini_program.access_token'] = function ($pimple) {
  29. return new AccessToken(
  30. $pimple['config']['mini_program']['app_id'],
  31. $pimple['config']['mini_program']['secret'],
  32. $pimple['cache']
  33. );
  34. };
  35. $pimple['order_ship'] = function ($pimple) {
  36. return new OrderClient($pimple['mini_program.access_token'], $pimple);
  37. };
  38. }
  39. }