feat : Bridge pay
This commit is contained in:
37
app/Service/Test/Bridge/Pay/PremiumPaymentService.php
Normal file
37
app/Service/Test/Bridge/Pay/PremiumPaymentService.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
* @web_site https://ctexthuang.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Test\Bridge\Pay;
|
||||
|
||||
class PremiumPaymentService extends PaymentGateway
|
||||
{
|
||||
/**
|
||||
* @param float $amount
|
||||
* @return array
|
||||
*/
|
||||
public function processPayment(float $amount): array
|
||||
{
|
||||
$fee = $amount * 0.02; // 2%手续费
|
||||
$this->logger->debug('Premium payment processing with fee: ' . $fee);
|
||||
return $this->payment->pay($amount + $fee);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $amount
|
||||
* @return array
|
||||
*/
|
||||
public function processRefund(float $amount): array
|
||||
{
|
||||
$fee = $amount * 0.01; // 1%手续费
|
||||
$this->logger->debug('Premium payment processing with refund: ' . $fee);
|
||||
return $this->payment->refund($amount - $fee);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user