File tree Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ public function setCardToken($value)
37
37
return $ this ->setParameter ('token ' , $ value );
38
38
}
39
39
40
+ public function getMetadata ()
41
+ {
42
+ return $ this ->getParameter ('metadata ' );
43
+ }
44
+
45
+ public function setMetadata ($ value )
46
+ {
47
+ return $ this ->setParameter ('metadata ' , $ value );
48
+ }
49
+
40
50
abstract public function getEndpoint ();
41
51
42
52
public function getHttpMethod ()
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ public function getData()
15
15
$ data ['amount ' ] = $ this ->getAmountInteger ();
16
16
$ data ['currency ' ] = strtolower ($ this ->getCurrency ());
17
17
$ data ['description ' ] = $ this ->getDescription ();
18
+ $ data ['metadata ' ] = $ this ->getMetadata ();
18
19
$ data ['capture ' ] = 'false ' ;
19
20
20
21
if ($ this ->getCardReference ()) {
Original file line number Diff line number Diff line change @@ -19,4 +19,10 @@ public function testCardToken()
19
19
$ this ->assertSame ('abc123 ' , $ this ->request ->getCardToken ());
20
20
$ this ->assertSame ('abc123 ' , $ this ->request ->getToken ());
21
21
}
22
+
23
+ public function testMetadata ()
24
+ {
25
+ $ this ->assertSame ($ this ->request , $ this ->request ->setMetadata (array ('foo ' => 'bar ' )));
26
+ $ this ->assertSame (array ('foo ' => 'bar ' ), $ this ->request ->getMetadata ());
27
+ }
22
28
}
Original file line number Diff line number Diff line change @@ -14,14 +14,23 @@ public function setUp()
14
14
'amount ' => '12.00 ' ,
15
15
'currency ' => 'USD ' ,
16
16
'card ' => $ this ->getValidCard (),
17
+ 'description ' => 'Order #42 ' ,
18
+ 'metadata ' => array (
19
+ 'foo ' => 'bar ' ,
20
+ ),
17
21
)
18
22
);
19
23
}
20
24
21
- public function testCaptureIsFalse ()
25
+ public function testGetData ()
22
26
{
23
27
$ data = $ this ->request ->getData ();
28
+
29
+ $ this ->assertSame (1200 , $ data ['amount ' ]);
30
+ $ this ->assertSame ('usd ' , $ data ['currency ' ]);
31
+ $ this ->assertSame ('Order #42 ' , $ data ['description ' ]);
24
32
$ this ->assertSame ('false ' , $ data ['capture ' ]);
33
+ $ this ->assertSame (array ('foo ' => 'bar ' ), $ data ['metadata ' ]);
25
34
}
26
35
27
36
/**
You can’t perform that action at this time.
0 commit comments