Skip to content

Commit 3d3b2fc

Browse files
committed
Merge branch 'ericmp33-master'
2 parents e2636cd + bf05e88 commit 3d3b2fc

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

src/Sermepa/Tpv/Tpv.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ public function setTradeName($tradename = '')
628628
* z = Bizum
629629
* p = PayPal
630630
* N = Masterpass
631+
* xpay = GooglePay y ApplePay
631632
* ]
632633
*
633634
* @return $this
@@ -639,7 +640,7 @@ public function setMethod($method = 'C')
639640
throw new TpvException('Add pay method');
640641
}
641642

642-
if (!in_array($method, ['T', 'C', 'R', 'D', 'z', 'p', 'N'])) {
643+
if (!in_array($method, ['T', 'C', 'R', 'D', 'z', 'p', 'N', 'xpay'])) {
643644
throw new TpvException('Pay method is not valid');
644645
}
645646

tests/TpvTest.php

+13-23
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function merchant_direct_payment_return_false_or_true($boolean)
3232
$redsys = new Tpv();
3333
$redsys->setMerchantDirectPayment($boolean);
3434
$ds = $redsys->getParameters();
35-
$this->assertIsBool( $ds['DS_MERCHANT_DIRECTPAYMENT']);
35+
$this->assertIsBool($ds['DS_MERCHANT_DIRECTPAYMENT']);
3636
}
3737

3838
public function amountProvider()
@@ -58,7 +58,6 @@ public function amount_is_valid($correctAmount, $amount)
5858
$redsys->setAmount($amount);
5959
$ds = $redsys->getParameters();
6060
$this->assertEquals($correctAmount, $ds['DS_MERCHANT_AMOUNT']);
61-
6261
}
6362

6463

@@ -72,7 +71,6 @@ public function sum_total_is_valid($correctAmount, $amount)
7271
$redsys->setSumTotal($amount);
7372
$ds = $redsys->getParameters();
7473
$this->assertEquals($correctAmount, $ds['DS_MERCHANT_SUMTOTAL']);
75-
7674
}
7775

7876
/**
@@ -196,7 +194,6 @@ public function throw_when_order_is_invalid($orderNumber)
196194
$this->expectException(\Sermepa\Tpv\TpvException::class);
197195
$redsys = new Tpv();
198196
$redsys->setOrder($orderNumber);
199-
200197
}
201198

202199
public function orderNumberProvider()
@@ -280,8 +277,6 @@ public function throw_environment_is_not_test_or_live()
280277
$this->expectException(\Sermepa\Tpv\TpvException::class);
281278
$redsys = new Tpv();
282279
$redsys->setEnvironment('production');
283-
284-
285280
}
286281

287282
public function SearchingFormProvider()
@@ -292,7 +287,6 @@ public function SearchingFormProvider()
292287
['Ds_SignatureVersion'],
293288
['btn_submit'],
294289
];
295-
296290
}
297291

298292
/**
@@ -303,7 +297,7 @@ public function check_if_form_create_inputs_with_parameters($search)
303297
{
304298
$redsys = new Tpv();
305299
$form = $redsys->createForm();
306-
$this->assertStringContainsString($search,$form);
300+
$this->assertStringContainsString($search, $form);
307301
}
308302

309303
/**
@@ -314,7 +308,7 @@ public function when_set_all_parameters_should_obtain_all_ds_merchant_valid()
314308
{
315309
$redsys = new Tpv();
316310
$redsys->setEnvironment('test')
317-
->setAmount(rand(10,600))
311+
->setAmount(rand(10, 600))
318312
->setOrder(time())
319313
->setMerchantcode('999008881')
320314
->setCurrency('978')
@@ -338,7 +332,6 @@ public function when_set_all_parameters_should_obtain_all_ds_merchant_valid()
338332
$this->assertArrayHasKey('DS_MERCHANT_MERCHANTURL', $parameters);
339333
$this->assertArrayHasKey('DS_MERCHANT_URLOK', $parameters);
340334
$this->assertArrayHasKey('DS_MERCHANT_URLKO', $parameters);
341-
342335
}
343336

344337
/**
@@ -383,8 +376,8 @@ public function check_if_url_of_tpv_is_test_or_live($environment, $url)
383376
public function force_to_send_the_form_with_javascript()
384377
{
385378
$redsys = new Tpv();
386-
$redsys->setNameForm('custom_form_'.date('His'));
387-
$js = 'document.forms["'.$redsys->getNameForm().'"].submit();';
379+
$redsys->setNameForm('custom_form_' . date('His'));
380+
$js = 'document.forms["' . $redsys->getNameForm() . '"].submit();';
388381

389382
$redirect = $redsys->executeRedirection(true);
390383

@@ -458,7 +451,6 @@ public function invalidExpiryDateProvider()
458451
['am'],
459452
['236'],
460453
];
461-
462454
}
463455

464456
/**
@@ -503,11 +495,10 @@ public function invalidParameters()
503495
[45],
504496
[666],
505497
[
506-
[100,'R'],
498+
[100, 'R'],
507499
['Ds_store' => 233]
508500
]
509501
];
510-
511502
}
512503

513504
/**
@@ -522,24 +513,22 @@ public function throw_parameters_is_not_an_array($parameters)
522513
$this->expectException(\Sermepa\Tpv\TpvException::class);
523514
$redsys = new Tpv();
524515

525-
$redsys->setParameters($parameters);
526-
516+
$redsys->setParameters($parameters);
527517
}
528518

529519
/**
530520
* @test
531521
*/
532522

533-
public function set_new_parameters()
534-
{
523+
public function set_new_parameters()
524+
{
535525
$parameters = ['DS_MERCHANT_COF_INI' => 'S', 'DS_MERCHANT_COF_TYPE' => 'R'];
536526
$redsys = new Tpv();
537527
$redsys->setParameters($parameters);
538528

539529
$this->assertArrayHasKey('DS_MERCHANT_COF_INI', $parameters);
540530
$this->assertArrayHasKey('DS_MERCHANT_COF_TYPE', $parameters);
541-
542-
}
531+
}
543532

544533
public function invalidSetMethod()
545534
{
@@ -549,6 +538,7 @@ public function invalidSetMethod()
549538
['X'],
550539
['AA'],
551540
['Np'],
541+
['Xpay']
552542
];
553543
}
554544

@@ -573,7 +563,8 @@ public function methodsProvider()
573563
['D'],
574564
['z'],
575565
['p'],
576-
['N']
566+
['N'],
567+
['xpay']
577568
];
578569
}
579570

@@ -639,5 +630,4 @@ public function throw_when_set_environment_or_version_is_invalid($environment, $
639630
$redsys = new Tpv();
640631
$redsys->getJsPath($environment, $version);
641632
}
642-
643633
}

0 commit comments

Comments
 (0)