final class SignedWebhook (View source)

internal  
 

테스트·로컬 재전송용 웹훅 본문을 만들고 설정된 웹훅 Secret으로 서명한다.

서명은 cable8mm/portone-php의 WebhookSigner로 만들므로 패키지 웹훅 경로의 검증을 그대로 통과한다. InteractsWithPortOneWebhooks와 portone:webhook-replay가 함께 쓴다.

Methods

static string
body(string $type, string $paymentId, array $data = [])

PortOne 거래 웹훅 형식의 본문을 만든다.

static array
headers(string $body)

본문의 webhook-id, webhook-signature, webhook-timestamp 헤더를 만든다.

Details

static string body(string $type, string $paymentId, array $data = [])

PortOne 거래 웹훅 형식의 본문을 만든다.

data에는 결제 ID와 portone.store_id가 들어가며, 추가 데이터가 같은 키를 덮어쓴다.

Parameters

string $type

웹훅 종류(예: Transaction.Paid)

string $paymentId

PortOne 결제 식별자

array $data

data에 더할 값(예: transactionId, cancellationId)

Return Value

string

JSON 본문

static array headers(string $body)

본문의 webhook-id, webhook-signature, webhook-timestamp 헤더를 만든다.

Parameters

string $body

서명할 본문

Return Value

array

헤더 이름과 값

Exceptions

ConfigurationException