feat(发票): 为发送发票接口添加可选邮箱参数

在发送发票接口中添加可选的邮箱参数,允许指定接收发票的邮箱地址。当不指定邮箱时,保持原有行为不变。
This commit is contained in:
李东云
2025-12-02 17:59:18 +08:00
parent 6fd7f2f421
commit 19e95016fa
2 changed files with 11 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* InvoiceRepoInterface.php@Pay * InvoiceRepoInterface.php@Pay
* *
@@ -33,10 +34,11 @@ interface InvoiceRepoInterface
/** /**
* @param string $invoiceNo * @param string $invoiceNo
* @param string|null $email
* @return void * @return void
* @throws GuzzleException * @throws GuzzleException
*/ */
public function send(string $invoiceNo): void; public function send(string $invoiceNo, ?string $email): void;
/** /**
* @param string $invoiceNo * @param string $invoiceNo

View File

@@ -85,12 +85,17 @@ final class InvoiceRepo extends AbstractRepo implements InvoiceRepoInterface
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function send(string $invoiceNo): void public function send(string $invoiceNo, ?string $email): void
{ {
if (empty($invoiceNo)) { if (empty($invoiceNo)) {
throw new ValidateException(message: 'invoice no is required.'); throw new ValidateException(message: 'invoice no is required.');
} }
$this->requestService->requestGet(url: "/rpc/v2/invoice/invoices/$invoiceNo/email"); $this->requestService->requestGet(
url: "/rpc/v2/invoice/invoices/$invoiceNo/email",
data: [
'email' => $email,
],
);
} }
/** /**