|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\OmniKassa; |
|
4
|
|
|
|
|
5
|
|
|
use PHPUnit_Framework_TestCase; |
|
6
|
|
|
use Pronamic\WordPress\Pay\Payments\PaymentStatus; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Title: OmniKassa response codes test |
|
10
|
|
|
* Description: |
|
11
|
|
|
* Copyright: 2005-2020 Pronamic |
|
12
|
|
|
* Company: Pronamic |
|
13
|
|
|
* |
|
14
|
|
|
* @author Remco Tolsma |
|
15
|
|
|
* @version 2.0.0 |
|
16
|
|
|
* @since 1.0.0 |
|
17
|
|
|
*/ |
|
18
|
|
|
class ResponseCodesTest extends PHPUnit_Framework_TestCase { |
|
19
|
|
|
/** |
|
20
|
|
|
* Test transform. |
|
21
|
|
|
* |
|
22
|
|
|
* @dataProvider status_matrix_provider |
|
23
|
|
|
*/ |
|
24
|
|
|
public function test_transform( $response_code, $expected ) { |
|
25
|
|
|
$status = ResponseCodes::transform( $response_code ); |
|
26
|
|
|
|
|
27
|
|
|
$this->assertEquals( $expected, $status ); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function status_matrix_provider() { |
|
31
|
|
|
return array( |
|
32
|
|
|
// Transaction successful. |
|
33
|
|
|
array( ResponseCodes::TRANSACTION_SUCCES, PaymentStatus::SUCCESS ), |
|
34
|
|
|
// Credit card authorisation limit exceeded. Contact the Support Team Rabo OmniKassa. |
|
35
|
|
|
array( ResponseCodes::AUTHORIZATION_LIMIT, PaymentStatus::FAILURE ), |
|
36
|
|
|
// Invalid merchant contract. |
|
37
|
|
|
array( ResponseCodes::INVALID_MERCHANT_CONTRACT, PaymentStatus::FAILURE ), |
|
38
|
|
|
// Refused. |
|
39
|
|
|
array( ResponseCodes::AUTHORIZATION_REFUSED, PaymentStatus::FAILURE ), |
|
40
|
|
|
// Invalid transaction. Check the fields in the payment request. |
|
41
|
|
|
array( ResponseCodes::INVALID_TRANSACTION, PaymentStatus::FAILURE ), |
|
42
|
|
|
// Cancellation of payment by user. |
|
43
|
|
|
array( ResponseCodes::CANCELLATION_OF_PAYMENT, PaymentStatus::CANCELLED ), |
|
44
|
|
|
// Invalid status. |
|
45
|
|
|
array( ResponseCodes::INVALID_STATUS, PaymentStatus::FAILURE ), |
|
46
|
|
|
// Transaction not found in database. |
|
47
|
|
|
array( ResponseCodes::TRANSACTION_NOT_FOUND_IN_DATABASE, PaymentStatus::FAILURE ), |
|
48
|
|
|
// Invalid format. |
|
49
|
|
|
array( ResponseCodes::INVALID_FORMAT, PaymentStatus::FAILURE ), |
|
50
|
|
|
// Fraud suspicion. |
|
51
|
|
|
array( ResponseCodes::FRAUD_SUSPICION, PaymentStatus::FAILURE ), |
|
52
|
|
|
// Operation not allowed for this merchant/webshop. |
|
53
|
|
|
array( ResponseCodes::OPERATION_NOT_ALLOWED, PaymentStatus::FAILURE ), |
|
54
|
|
|
// Awaiting status report. |
|
55
|
|
|
array( ResponseCodes::PENDING_TRANSACTION, PaymentStatus::OPEN ), |
|
56
|
|
|
// Security problem detected. Transaction terminated. |
|
57
|
|
|
array( ResponseCodes::SECURITY_BREACH_DETECTED, PaymentStatus::FAILURE ), |
|
58
|
|
|
// Maximum number of attempts to enter credit card number (3) exceeded. |
|
59
|
|
|
array( ResponseCodes::NUMBER_ATTEMPT_EXCEEDED, PaymentStatus::FAILURE ), |
|
60
|
|
|
// Rabo OmniKassa server temporarily unavailable. |
|
61
|
|
|
array( ResponseCodes::ACQUIRER_SERVER_TEMPORARILY_UNAVAILABLE, PaymentStatus::FAILURE ), |
|
62
|
|
|
// Duplicate transaction. |
|
63
|
|
|
array( ResponseCodes::DUPLICATE_TRANSACTION, PaymentStatus::FAILURE ), |
|
64
|
|
|
// Time period expired. Transaction refused. |
|
65
|
|
|
array( ResponseCodes::REQUEST_TIMEOUT, PaymentStatus::EXPIRED ), |
|
66
|
|
|
// Payment page temporarily unavailable. |
|
67
|
|
|
array( ResponseCodes::PAYMENT_PAGE_TEMPORARILY_UNAVAILABLE, PaymentStatus::OPEN ), |
|
68
|
|
|
// Not existing response code. |
|
69
|
|
|
array( 'not existing response code', null ), |
|
70
|
|
|
); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|