mirror of
https://git.yoomoney.ru/scm/sdk/yookassa-sdk-php.git
synced 2026-09-18 22:06:15 +00:00
Добавлены данные карты в метод оплаты SberPay. Изменена логика в методе оплаты BankCard
This commit is contained in:
@@ -50,22 +50,16 @@ class PaymentMethodFactoryTest extends TestCase
|
||||
{
|
||||
$instance = $this->getTestInstance();
|
||||
|
||||
$optionsMap = array(
|
||||
'card_type' => 'cardType',
|
||||
'expiry_month' => 'expiryMonth',
|
||||
'expiry_year' => 'expiryYear',
|
||||
'account_number' => 'accountNumber',
|
||||
);
|
||||
|
||||
$paymentData = $instance->factoryFromArray($options);
|
||||
self::assertNotNull($paymentData);
|
||||
self::assertTrue($paymentData instanceof AbstractPaymentMethod);
|
||||
|
||||
foreach ($options as $property => $value) {
|
||||
if (array_key_exists($property, $optionsMap)) {
|
||||
$property = $optionsMap[$property];
|
||||
if (is_object($paymentData->{$property})) {
|
||||
self::assertEquals($paymentData->{$property}->toArray(), $value);
|
||||
} else {
|
||||
self::assertEquals($paymentData->{$property}, $value);
|
||||
}
|
||||
self::assertEquals($paymentData->{$property}, $value);
|
||||
}
|
||||
|
||||
$type = $options['type'];
|
||||
@@ -76,10 +70,11 @@ class PaymentMethodFactoryTest extends TestCase
|
||||
|
||||
self::assertEquals($type, $paymentData->getType());
|
||||
foreach ($options as $property => $value) {
|
||||
if (array_key_exists($property, $optionsMap)) {
|
||||
$property = $optionsMap[$property];
|
||||
if (is_object($paymentData->{$property})) {
|
||||
self::assertEquals($paymentData->{$property}->toArray(), $value);
|
||||
} else {
|
||||
self::assertEquals($paymentData->{$property}, $value);
|
||||
}
|
||||
self::assertEquals($paymentData->{$property}, $value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,11 +147,13 @@ class PaymentMethodFactoryTest extends TestCase
|
||||
'id' => Random::str(1, 64),
|
||||
'saved' => Random::bool(),
|
||||
'title' => Random::str(10, 20),
|
||||
'last4' => Random::str(4, '0123456789'),
|
||||
'first6' => Random::str(6, '0123456789'),
|
||||
'expiryYear' => Random::int(2000, 2200),
|
||||
'expiryMonth' => Random::value(array('01','02','03','04','05','06','07','08','09','10','11','12')),
|
||||
'cardType' => Random::str(3, 10),
|
||||
'card' => array(
|
||||
'last4' => Random::str(4, '0123456789'),
|
||||
'first6' => Random::str(6, '0123456789'),
|
||||
'expiry_year' => Random::int(2000, 2200),
|
||||
'expiry_month' => Random::value(array('01','02','03','04','05','06','07','08','09','10','11','12')),
|
||||
'card_type' => Random::str(3, 10),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
@@ -165,11 +162,29 @@ class PaymentMethodFactoryTest extends TestCase
|
||||
'id' => Random::str(1, 64),
|
||||
'saved' => Random::bool(),
|
||||
'title' => Random::str(10, 20),
|
||||
'last4' => Random::str(4, '0123456789'),
|
||||
'first6' => Random::str(6, '0123456789'),
|
||||
'expiry_year' => Random::int(2000, 2200),
|
||||
'expiry_month' => Random::value(array('01','02','03','04','05','06','07','08','09','10','11','12')),
|
||||
'card_type' => Random::str(3, 10),
|
||||
'card' => array(
|
||||
'last4' => Random::str(4, '0123456789'),
|
||||
'first6' => Random::str(6, '0123456789'),
|
||||
'expiry_year' => Random::int(2000, 2200),
|
||||
'expiry_month' => Random::value(array('01','02','03','04','05','06','07','08','09','10','11','12')),
|
||||
'card_type' => Random::str(3, 10),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'type' => PaymentMethodType::SBERBANK,
|
||||
'id' => Random::str(1, 64),
|
||||
'saved' => Random::bool(),
|
||||
'title' => Random::str(10, 20),
|
||||
'card' => array(
|
||||
'last4' => Random::str(4, '0123456789'),
|
||||
'first6' => Random::str(6, '0123456789'),
|
||||
'expiry_year' => Random::int(2000, 2200),
|
||||
'expiry_month' => Random::value(array('01','02','03','04','05','06','07','08','09','10','11','12')),
|
||||
'card_type' => Random::str(3, 10),
|
||||
),
|
||||
'phone' => Random::str(4, 15, '0123456789'),
|
||||
),
|
||||
),
|
||||
array(
|
||||
@@ -201,7 +216,7 @@ class PaymentMethodFactoryTest extends TestCase
|
||||
array(
|
||||
array(
|
||||
'type' => PaymentMethodType::YOO_MONEY,
|
||||
'accountNumber' => Random::str(31, '0123456789'),
|
||||
'account_number' => Random::str(31, '0123456789'),
|
||||
'id' => Random::str(1, 64),
|
||||
'saved' => Random::bool(),
|
||||
'title' => Random::str(10, 20),
|
||||
|
||||
Reference in New Issue
Block a user