Skip to content

Commit

Permalink
Añadir documentación, arreglar cosillas y añadir test
Browse files Browse the repository at this point in the history
  • Loading branch information
alphp committed Jan 4, 2024
1 parent 3a10b1c commit 44c82f7
Show file tree
Hide file tree
Showing 6 changed files with 851 additions and 2 deletions.
770 changes: 770 additions & 0 deletions doc/Códigos de Respuesta.md

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions doc/Tabla Ds_ProcessedPayMethod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Tabla Ds_ProcessedPayMethod

Informa sobre el método en el que se ha realizado la operación:

https://pagosonline.redsys.es/parametros-entrada-salida.html

| Método de pago | Valor |
|---------------:|-------|
| 1 | Visa Secure
| 3 | Tradicional Mundial
| 5 | Finanet
| 11 | Capacidad FINANET
| 13 | Capacidad Visa Secure
| 14 | Tradicional UE
| 22 | MasterCard Identity Check
| 23 | Capacidad Identity Check
| 24 | Pago AMEX
| 25 | Pago MOTO
| 28 | Pago JCB
| 31 | Pago DINERS
| 39 | JCB JSecure
| 40 | Capacidad JSecure
| 41 | Domiciliacion
| 42 | Transferencia
| 54 | PayPal
| 57 | SafeKey
| 58 | Capacidad SafeKey
| 59 | MasterPass Wallet
| 68 | Bizum
| 70 | UPI ExpressPay
| 71 | GooglePay
| 72 | ApplePay
| 73 | UPI SecurePlus
| 74 | Capacidad Discover
| 75 | Discover ProtectBuy
| 76 | Discover
| 77 | Amazon Pay
| 78 | Challenge Visa
| 79 | Challenge MasterCard
| 80 | Frictionless Visa
| 81 | Frictionless MasterCard
| 82 | Attempt Visa
| 83 | Attempt MasterCard
| 85 | Challenge Amex
| 86 | Challenge Discover
| 87 | Frictionless Amex
| 88 | Frictionless Discover
| 89 | Attempt Amex
| 90 | Attempt Discover
| 92 | Pago DINERS ProtectBuy
| 93 | Challenge Diners ProtectBuy
| 94 | Frictionless Diners ProtectBuy
| 95 | Pago Attempt Diners ProtectBuy
| 96 | Challenge JCB
| 97 | Frictionless JCB
| 98 | Attempt JCB
| 107 | Pago con cuenta
6 changes: 6 additions & 0 deletions src/Redsys/Merchant/MerchantEnvironment.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<?php
declare(strict_types=1);

namespace Redsys\Merchant;

use ReflectionClass;

class MerchantEnvironment {
public const LIVE = 'live';
public const TEST = 'test';
public const REST_LIVE = 'restLive';
public const REST_TEST = 'restTest';
public const START_REST_LIVE = 'startRequestRestLive';
public const START_REST_TEST = 'startRequestRestTest';
public const MANAGE_REQUEST_REST_LIVE = 'manageRequestRestLive';
public const MANAGE_REQUEST_REST_TEST = 'manageRequestRestTest';

public static function isValid (string $value) : bool {
return in_array($value, (new ReflectionClass(self::class))->getConstants());
Expand Down
2 changes: 1 addition & 1 deletion src/Redsys/Merchant/MerchantTransactionTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MerchantTransactionTypes {
public const ANULACION_DE_CONFIRMACION_SEPARADA = 47; // Anulación de confirmación separada
public const MODIFICACION_DE_CADUCIDAD_DEL_ENLACE_PAYGOLD = 51; // Modificación de caducidad del enlace (Paygold)

public static function isValid (string $value) : bool {
public static function isValid (int $value) : bool {
return in_array($value, (new ReflectionClass(self::class))->getConstants());
}
}
16 changes: 16 additions & 0 deletions tests/MerchantEnvironmentTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);

namespace Redsys\Merchant;

use PHPUnit\Framework\TestCase as PHPUnitTestCase;

class MerchantEnvironmentTest extends PHPUnitTestCase {
public function testCodeIsValid () {
$this->assertTrue(MerchantEnvironment::isValid(MerchantEnvironment::LIVE));
}

public function testCodeNotValid () {
$this->assertFalse(MerchantEnvironment::isValid('INVALID'));
}
}
2 changes: 1 addition & 1 deletion tests/MerchantTransactionTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public function testCodeIsValid () {
}

public function testCodeNotValid () {
$this->assertFalse(MerchantTransactionTypes::isValid('INVALID'));
$this->assertFalse(MerchantTransactionTypes::isValid(-1));
}
}

0 comments on commit 44c82f7

Please sign in to comment.