BasePaymentSetting.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Name: 芸众商城系统
  5. * Author: 广州市芸众信息科技有限公司
  6. * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
  7. * Date: 2021/8/26
  8. * Time: 15:47
  9. */
  10. namespace app\common\payment\setting;
  11. use app\common\models\PayType;
  12. use app\common\payment\types\BasePaymentTypes;
  13. abstract class BasePaymentSetting
  14. {
  15. public $paymentTypes;
  16. public $payType;
  17. public function __construct(BasePaymentTypes $basePaymentTypes)
  18. {
  19. $this->paymentTypes = $basePaymentTypes;
  20. }
  21. public function setPayType(PayType $payType)
  22. {
  23. $this->payType = $payType;
  24. }
  25. abstract public function canUse();
  26. public function getCode()
  27. {
  28. return $this->payType->code;
  29. }
  30. public function getName()
  31. {
  32. if (app('plugins')->isEnabled('pay-manage')) {
  33. return \Yunshop\PayManage\models\PayType::currentPayAlias($this->payType->id);
  34. }
  35. return $this->payType->name;
  36. }
  37. public function getId()
  38. {
  39. if (!miniVersionCompare('1.1.132')) {
  40. if ($this->payType->code == 'wechatMinPay') {
  41. return 1;
  42. }
  43. }
  44. return $this->payType->id;
  45. }
  46. public function getWeight()
  47. {
  48. return 10;
  49. }
  50. public function needPassword()
  51. {
  52. return false;
  53. }
  54. }