|
|
|
@@ -2,9 +2,11 @@ |
|
|
|
|
|
|
|
namespace App\Util\Custom\HelloTechno; |
|
|
|
|
|
|
|
use App\Codes\EnvironmentName; |
|
|
|
use App\Exceptions\AppCommonException; |
|
|
|
use App\Models\ReceiptIssuingHTParkingCustomOrder; |
|
|
|
use App\Models\ReceiptIssuingOrder; |
|
|
|
use App\Models\ReceiptIssuingOrderTax; |
|
|
|
use Exception; |
|
|
|
use Illuminate\Support\Arr; |
|
|
|
use Illuminate\Support\Carbon; |
|
|
|
@@ -58,9 +60,20 @@ class API |
|
|
|
return static::get(static::getAdjustDataUrl(), $query); |
|
|
|
} |
|
|
|
|
|
|
|
public static function sendReceiptIssuingOrder(ReceiptIssuingOrder $order, ReceiptIssuingHTParkingCustomOrder $customOrder) |
|
|
|
{ |
|
|
|
$param = static::makeReceiptIssuingOrderParams($order, $customOrder); |
|
|
|
public static function sendReceiptIssuingOrder( |
|
|
|
ReceiptIssuingOrder $order, |
|
|
|
ReceiptIssuingHTParkingCustomOrder $customOrder, |
|
|
|
ReceiptIssuingOrderTax $tax, |
|
|
|
string $eventName, |
|
|
|
Carbon $eventDatetime |
|
|
|
) { |
|
|
|
$param = static::makeReceiptIssuingOrderParams($order, $customOrder, $tax, $eventName, $eventDatetime); |
|
|
|
|
|
|
|
if (app()->environment([EnvironmentName::LOCAL->value])) { |
|
|
|
logger("HT通知 ローカル環境のため送信しない", ['SEND' => $param]); |
|
|
|
return []; |
|
|
|
} |
|
|
|
|
|
|
|
return static::post(static::getReceiptIssuingOrderUrl(), $param); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -93,10 +106,17 @@ class API |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static function makeReceiptIssuingOrderParams(ReceiptIssuingOrder $order, ReceiptIssuingHTParkingCustomOrder $customOrder): array |
|
|
|
{ |
|
|
|
public static function makeReceiptIssuingOrderParams( |
|
|
|
ReceiptIssuingOrder $order, |
|
|
|
ReceiptIssuingHTParkingCustomOrder $customOrder, |
|
|
|
ReceiptIssuingOrderTax $tax, |
|
|
|
string $eventName, |
|
|
|
Carbon $eventDatetime |
|
|
|
): array { |
|
|
|
$param = []; |
|
|
|
$param['id'] = $order->id; |
|
|
|
$param['event_name'] = $eventName; |
|
|
|
$param['event_datetime'] = static::formatDateTimeStr($eventDatetime); |
|
|
|
$param['customer_code'] = $customOrder->customer_code; |
|
|
|
$param['parking_management_code'] = $customOrder->parking_management_code; |
|
|
|
$param['adjust_seq_no'] = $customOrder->adjust_seq_no; |
|
|
|
@@ -121,8 +141,10 @@ class API |
|
|
|
$param['receipt_name'] = $order->receipt_name; |
|
|
|
$param['receipt_invoice_no'] = $order->receipt_invoice_no; |
|
|
|
$param['receipt_amount'] = $order->receipt_amount; |
|
|
|
$param['tax_rate'] = $tax->tax_rate; |
|
|
|
$param['tax_amount'] = $tax->tax_amount; |
|
|
|
$param['email'] = $order->email; |
|
|
|
$param['mail_pref_code'] = $order->mail_pref_code; |
|
|
|
$param['mail_pref_code'] = $order->mail_pref_code !== null ? $order->mail_pref_code->value : null; |
|
|
|
$param['mail_zip_code'] = $order->mail_zip_code; |
|
|
|
$param['mail_address1'] = $order->mail_address1; |
|
|
|
$param['mail_address2'] = $order->mail_address2; |
|
|
|
|