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