mirror of
https://git.yoomoney.ru/scm/sdk/yookassa-sdk-php.git
synced 2026-10-29 11:06:27 +00:00
Добавлен новый тип уведомления для webhook-ов payment_method.active
This commit is contained in:
@@ -49,7 +49,9 @@ use YooKassa\Model\Payout\PayoutCancellationDetailsPartyCode;
|
||||
use YooKassa\Model\Payout\PayoutCancellationDetailsReasonCode;
|
||||
use YooKassa\Model\Payout\PayoutStatus;
|
||||
use YooKassa\Model\Refund\RefundStatus;
|
||||
use YooKassa\Model\SavePaymentMethod\SavePaymentMethodStatus;
|
||||
use YooKassa\Request\Deals\DealResponse;
|
||||
use YooKassa\Request\PaymentMethods\PaymentMethodResponse;
|
||||
use YooKassa\Request\Payments\PaymentResponse;
|
||||
use YooKassa\Request\Payouts\PayoutResponse;
|
||||
use YooKassa\Request\Refunds\RefundResponse;
|
||||
@@ -127,6 +129,11 @@ class NotificationFactoryTest extends TestCase
|
||||
|
||||
break;
|
||||
|
||||
case NotificationEventType::PAYMENT_METHOD_ACTIVE:
|
||||
$notification = $this->getPaymentMethodActiveNotification($eventType);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$notification = $this->getPaymentNotification($eventType);
|
||||
}
|
||||
@@ -249,6 +256,44 @@ class NotificationFactoryTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
private function getPaymentMethodActiveNotification($type): array
|
||||
{
|
||||
$statuses = SavePaymentMethodStatus::getValidValues();
|
||||
|
||||
$cardTypes = ['Mir', 'Visa', 'MasterCard', 'AmericanExpress', 'JCB', 'UnionPay'];
|
||||
|
||||
$paymentMethod = [
|
||||
'type' => PaymentMethodType::BANK_CARD,
|
||||
'id' => Random::str(36),
|
||||
'saved' => Random::bool(),
|
||||
'status' => Random::value($statuses),
|
||||
'holder' => [
|
||||
'account_id' => Random::str(1, 64, '0123456789'),
|
||||
],
|
||||
'card' => [
|
||||
'first6' => Random::str(6, 6, '0123456789'),
|
||||
'last4' => Random::str(4, 4, '0123456789'),
|
||||
'expiry_month' => str_pad((string)Random::int(1, 12), 2, '0', STR_PAD_LEFT),
|
||||
'expiry_year' => (string)Random::int(2024, 2030),
|
||||
'card_type' => Random::value($cardTypes),
|
||||
'card_product' => [
|
||||
'code' => 'MCP',
|
||||
'name' => 'MIR Privilege',
|
||||
],
|
||||
'issuer_country' => 'RU',
|
||||
'issuer_name' => 'Sberbank',
|
||||
],
|
||||
];
|
||||
|
||||
return [
|
||||
[
|
||||
'type' => $this->getExpectedType(),
|
||||
'event' => $type,
|
||||
'object' => $paymentMethod,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
private function getPayoutNotification($type): array
|
||||
{
|
||||
$cancellationDetailsParties = PayoutCancellationDetailsPartyCode::getValidValues();
|
||||
@@ -365,6 +410,12 @@ class NotificationFactoryTest extends TestCase
|
||||
self::assertInstanceOf(DealResponse::class, $object);
|
||||
self::assertEquals($object, new DealResponse($value));
|
||||
|
||||
break;
|
||||
|
||||
case NotificationEventType::PAYMENT_METHOD_ACTIVE:
|
||||
self::assertInstanceOf(PaymentMethodResponse::class, $object);
|
||||
self::assertEquals($object, new PaymentMethodResponse($value));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user