PaymentMethodNonce.php
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace Braintree;
/**
 * Braintree PaymentMethodNonce module
 *
 * @package    Braintree
 * @category   Resources
 */
/**
 * Creates and manages Braintree PaymentMethodNonces
 *
 * <b>== More information ==</b>
 *
 *
 * @package    Braintree
 * @category   Resources
 * 
 * @property-read \Braintree\BinData $binData
 * @property-read boolean $default
 * @property-read string $nonce
 * @property-read \Braintree\ThreeDSecureInfo $threeDSecureInfo
 * @property-read string $type
 */
class PaymentMethodNonce extends Base
{
    // static methods redirecting to gateway
    public static function create($token)
    {
        return Configuration::gateway()->paymentMethodNonce()->create($token);
    }
    public static function find($nonce)
    {
        return Configuration::gateway()->paymentMethodNonce()->find($nonce);
    }
    public static function factory($attributes)
    {
        $instance = new self();
        $instance->_initialize($attributes);
        return $instance;
    }
    protected function _initialize($nonceAttributes)
    {
        $this->_attributes = $nonceAttributes;
        $this->_set('nonce', $nonceAttributes['nonce']);
        $this->_set('type', $nonceAttributes['type']);
        if(isset($nonceAttributes['threeDSecureInfo'])) {
            $this->_set('threeDSecureInfo', ThreeDSecureInfo::factory($nonceAttributes['threeDSecureInfo']));
        }
        if(isset($nonceAttributes['binData'])) {
            $this->_set('binData', BinData::factory($nonceAttributes['binData']));
        }
    }
}
class_alias('Braintree\PaymentMethodNonce', 'Braintree_PaymentMethodNonce');