Completed
Push — master ( 1887e7...545774 )
by Andreas
13:56 queued 11:36
created

TransactionFactory   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 10

Test Coverage

Coverage 76.67%

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 10
dl 0
loc 73
ccs 23
cts 30
cp 0.7667
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A purchase() 0 4 1
A authorize() 0 4 1
A capture() 0 4 1
A refund() 0 4 1
A cancel() 0 4 1
A retrieve() 0 4 1
A query() 0 4 1
A initiate() 0 13 1
A threedSecureAuthenticate() 0 7 1
A transfer() 0 13 1
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