BasePayment.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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: 14:01
  9. */
  10. namespace app\common\payment\method;
  11. use app\common\models\PayType;
  12. use app\common\payment\setting\BasePaymentSetting;
  13. use app\common\payment\types\BasePaymentTypes;
  14. abstract class BasePayment
  15. {
  16. public $BasePaymentTypes;
  17. public $BasePaymentSetting;
  18. public function canUse()
  19. {
  20. return $this->BasePaymentSetting->canUse() && $this->BasePaymentTypes->canUse($this->code);
  21. }
  22. public function setTypes(BasePaymentTypes $BasePaymentTypes)
  23. {
  24. $this->BasePaymentTypes = $BasePaymentTypes;
  25. }
  26. public function setPayType()
  27. {
  28. $pay_type = $this->BasePaymentTypes->listPayType->where('code',$this->code)->first()?:new PayType();
  29. $this->BasePaymentSetting->setPayType($pay_type);
  30. }
  31. protected function setSetting(BasePaymentSetting $BasePaymentSetting)
  32. {
  33. $this->BasePaymentSetting = $BasePaymentSetting;
  34. }
  35. public function __call($method , $parameters)
  36. {
  37. return $this->BasePaymentSetting->$method(...$parameters);
  38. }
  39. }