PDA

Просмотр полной версии : PZMPay driver for the Omnipay


Receiver
04.10.2024, 20:16
Описание:Платёжный шлюз «PZMPay» для библиотеки обработки платежей «Omnipay»

Установка:

Bash:






composer require league/omnipay receiver1/omnipay-pzmpay




Использование:

PHP:






// Создаём новый платёжный шлюз
$gateway
=
Omnipay
:
:
create
(
'PZMPay'
)
;
// Устанавливаем секретный код
$gateway
-
>
setSecretCode
(
'secretCode'
)
;




PHP:






// Создаём новый платёж на сумму 10 руб. 00 коп.
$purchaseResponse
=
$gateway
-
>
purchase
(
[
'amount'
=
>
10
,
'currency'
=
>
'RUB'
,
'description'
=
>
'Пополнение баланса 1337 Cheats'
,
]
)
-
>
send
(
)
;
if
(
!
$purchaseResponse
-
>
isSuccessful
(
)
)
{
throw
new
Exception
(
$response
-
>
getMessage
(
)
)
;
}
// Получаем идентификатор платежа в PZMPay
$invoiceId
=
$purchaseResponse
-
>
getTransactionId
(
)
;
// Получаем ссылку на форму оплаты PZMPay
$redirectUrl
=
$purchaseResponse
-
>
getRedirectUrl
(
)
;




PHP:






$notification
=
$gateway
-
>
acceptNotification
(
$data
)
;
if
(
$notification
-
>
getTransactionStatus
(
)
===
NotificationInterface
:
:
STATUS_COMPLETED
)
{
/** @var TransactionModel $incomingTransaction */
$incomingTransaction
=
$notification
-
>
getTransactionReference
(
)
;
$transactionResponse
=
$gateway
-
>
fetchTransaction
(
[
'transactionId'
=
>
$incomingTransaction
-
>
getId
(
)
,
]
)
-
>
send
(
)
;
/** @var TransactionModel $trustedTransaction */
$trustedTransaction
=
$transactionResponse
-
>
getTransactionReference
(
)
;
print
(
$trustedTransaction
-
>
getAmount
(
)
)
;
}




Исходный код:https://github.com/receiver1/omnipay-pzmpayПакет composer: https://packagist.org/packages/receiver1/omnipay-pzmpay (https://www.blast.hk/redirect/aHR0cHM6Ly9wYWNrYWdpc3Qub3JnL3BhY2thZ2VzL3JlY2Vpdm VyMS9vbW5pcGF5LXB6bXBheQ)

Ultima Maybach, не эконом

У меня не пинта, а целый галлон

Шею тянет в ад мой металлолом

Притягивает дам мой одеколон​