class PortOneGateway implements PaymentGateway (View source)

cable8mm/portone-php 클라이언트로 PortOne V2 API를 호출하는 게이트웨이.

패키지의 모든 PortOne 요청은 여기서 나간다.

Methods

lookup(string $paymentId)

PortOne에서 결제 1건을 조회한다.

gatewayPayment(string $status, array $data)

PortOne 결제 응답을 조회 결과로 바꾼다. 금액은 portone-php Payment 접근자로 읽는다.

array
paymentResponse(string $paymentId)

PortOne 결제 조회 응답을 받은 그대로 반환한다. 테스트용 응답 기록 등에 쓴다.

lookupForExpiry(string $paymentId)

만료 확인용으로 결제 1건을 조회한다. PortOne이 결제를 모르면 found가 false이다.

void
cancel(string $paymentId, string $reason, int|null $amount)

PortOne 결제를 취소(환불)한다. 금액 생략 시 전액 취소이다.

Details

GatewayPayment lookup(string $paymentId)

PortOne에서 결제 1건을 조회한다.

Parameters

string $paymentId

PortOne 결제 식별자

Return Value

GatewayPayment

PortOne 결제 상태와 실결제액

Exceptions

ConfigurationException
PortOneException

protected GatewayPayment gatewayPayment(string $status, array $data)

PortOne 결제 응답을 조회 결과로 바꾼다. 금액은 portone-php Payment 접근자로 읽는다.

Parameters

string $status

PortOne 결제 상태(응답의 status)

array $data

디코딩한 PortOne 응답 본문

Return Value

GatewayPayment

PortOne 결제 상태, 실결제액, 취소 총액

array paymentResponse(string $paymentId)

PortOne 결제 조회 응답을 받은 그대로 반환한다. 테스트용 응답 기록 등에 쓴다.

응답에는 고객 개인정보와 카드·계좌 정보가 들어 있을 수 있다. 기록하기 전에 PaymentResponseRedactor로 가리거나 portone:payment 명령을 쓴다.

Parameters

string $paymentId

PortOne 결제 식별자

Return Value

array

디코딩한 PortOne 응답 본문

Exceptions

ConfigurationException
PortOneException

GatewayPayment lookupForExpiry(string $paymentId)

만료 확인용으로 결제 1건을 조회한다. PortOne이 결제를 모르면 found가 false이다.

PAYMENT_NOT_FOUND는 T-003·T-021에서 결제창을 연 적 없는 결제에 대해 관측된 응답이다.

Parameters

string $paymentId

PortOne 결제 식별자

Return Value

GatewayPayment

PortOne 결제 상태와 실결제액

Exceptions

ConfigurationException
PortOneException

void cancel(string $paymentId, string $reason, int|null $amount)

PortOne 결제를 취소(환불)한다. 금액 생략 시 전액 취소이다.

Parameters

string $paymentId

PortOne 결제 식별자

string $reason

PortOne에 전달할 환불 사유

int|null $amount

환불 금액(원, null이면 전액)

Return Value

void

Exceptions

ConfigurationException