1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Larium\Pay; |
6
|
|
|
|
7
|
|
|
use Larium\CreditCard\CreditCard; |
8
|
|
|
|
9
|
|
|
class TransactionFactory |
10
|
|
|
{ |
11
|
1 |
|
public static function purchase($amount, CreditCard $card, array $extraOptions = []) |
12
|
|
|
{ |
13
|
1 |
|
return new Transaction\PurchaseTransaction($amount, $card, $extraOptions); |
14
|
|
|
} |
15
|
|
|
|
16
|
1 |
|
public static function authorize($amount, CreditCard $card, array $extraOptions = []) |
17
|
|
|
{ |
18
|
1 |
|
return new Transaction\AuthorizeTransaction($amount, $card, $extraOptions); |
19
|
|
|
} |
20
|
|
|
|
21
|
1 |
|
public static function capture($amount, $id, array $extraOptions = []) |
22
|
|
|
{ |
23
|
1 |
|
return new Transaction\CaptureTransaction($amount, $id, $extraOptions); |
24
|
|
|
} |
25
|
|
|
|
26
|
1 |
|
public static function refund($amount, $id, array $extraOptions = []) |
27
|
|
|
{ |
28
|
1 |
|
return new Transaction\RefundTransaction($amount, $id, $extraOptions); |
29
|
|
|
} |
30
|
|
|
|
31
|
1 |
|
public static function cancel($id, array $extraOptions = []) |
32
|
|
|
{ |
33
|
1 |
|
return new Transaction\CancelTransaction($id, $extraOptions); |
34
|
|
|
} |
35
|
|
|
|
36
|
1 |
|
public static function retrieve($id) |
37
|
|
|
{ |
38
|
1 |
|
return new Transaction\RetrieveTransaction($id); |
39
|
|
|
} |
40
|
|
|
|
41
|
1 |
|
public static function initiate( |
42
|
|
|
$amount, |
43
|
|
|
$successUri, |
44
|
|
|
$cancelUri, |
45
|
|
|
array $extraOptions = [] |
46
|
|
|
) { |
47
|
1 |
|
return new Transaction\InitialTransaction( |
48
|
1 |
|
$amount, |
49
|
1 |
|
$successUri, |
50
|
1 |
|
$cancelUri, |
51
|
1 |
|
$extraOptions |
52
|
1 |
|
); |
53
|
|
|
} |
54
|
|
|
|
55
|
1 |
|
public static function query(array $criteria) |
56
|
|
|
{ |
57
|
1 |
|
return new Transaction\QueryTransaction($criteria); |
58
|
|
|
} |
59
|
|
|
|
60
|
1 |
|
public static function threedSecureAuthenticate($pares, $transactionId) |
61
|
|
|
{ |
62
|
1 |
|
return new Transaction\ThreedSecureAuthenticateTransaction( |
63
|
1 |
|
$pares, |
64
|
1 |
|
$transactionId |
65
|
1 |
|
); |
66
|
|
|
} |
67
|
|
|
|
68
|
1 |
|
public static function transfer( |
69
|
|
|
$amount, |
70
|
|
|
$currency, |
71
|
|
|
$recipientIdentifier, |
72
|
|
|
array $extraOptions = [] |
73
|
|
|
) { |
74
|
1 |
|
return new Transaction\TransferTransaction( |
75
|
1 |
|
$amount, |
76
|
1 |
|
$currency, |
77
|
1 |
|
$recipientIdentifier, |
78
|
1 |
|
$extraOptions |
79
|
1 |
|
); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|