11
11
12
12
namespace Omnipay \PayPal \Message ;
13
13
14
+ use Omnipay \Common \CreditCard ;
14
15
use Omnipay \TestCase ;
15
16
16
17
class ExpressAuthorizeRequestTest extends TestCase
@@ -29,7 +30,7 @@ public function setUp()
29
30
);
30
31
}
31
32
32
- public function testGetData ()
33
+ public function testGetDataWithoutCard ()
33
34
{
34
35
$ this ->request ->initialize (array (
35
36
'amount ' => '10.00 ' ,
@@ -56,6 +57,67 @@ public function testGetData()
56
57
$ this ->assertSame ('https://www.example.com/header.jpg ' , $ data ['HDRIMG ' ]);
57
58
}
58
59
60
+ public function testGetDataWitCard ()
61
+ {
62
+ $ this ->request ->initialize (array (
63
+ 'amount ' => '10.00 ' ,
64
+ 'currency ' => 'AUD ' ,
65
+ 'transactionId ' => '111 ' ,
66
+ 'description ' => 'Order Description ' ,
67
+ 'returnUrl ' => 'https://www.example.com/return ' ,
68
+ 'cancelUrl ' => 'https://www.example.com/cancel ' ,
69
+ 'notifyUrl ' => 'https://www.example.com/notify ' ,
70
+
71
+ 'headerImageUrl ' => 'https://www.example.com/header.jpg ' ,
72
+ ));
73
+
74
+ $ card = new CreditCard (array (
75
+ 'name ' => 'John Doe ' ,
76
+ 'address1 ' => '123 NW Blvd ' ,
77
+ 'address2 ' => 'Lynx Lane ' ,
78
+ 'city ' => 'Topeka ' ,
79
+ 'state ' => 'KS ' ,
80
+ 'country ' => 'USA ' ,
81
+ 'postcode ' => '66605 ' ,
82
+ 'phone ' => '555-555-5555 ' ,
83
+
84
+ ));
85
+ $ this ->request ->setCard ($ card );
86
+
87
+ $ expected = array (
88
+ 'METHOD ' => 'SetExpressCheckout ' ,
89
+ 'VERSION ' => ExpressAuthorizeRequest::API_VERSION ,
90
+ 'USER ' => null ,
91
+ 'PWD ' => null ,
92
+ 'SIGNATURE ' => null ,
93
+ 'PAYMENTREQUEST_0_PAYMENTACTION ' => 'Authorization ' ,
94
+ 'SOLUTIONTYPE ' => null ,
95
+ 'LANDINGPAGE ' => null ,
96
+ 'NOSHIPPING ' => 1 ,
97
+ 'ALLOWNOTE ' => 0 ,
98
+ 'PAYMENTREQUEST_0_AMT ' => '10.00 ' ,
99
+ 'PAYMENTREQUEST_0_CURRENCYCODE ' => 'AUD ' ,
100
+ 'PAYMENTREQUEST_0_INVNUM ' => '111 ' ,
101
+ 'PAYMENTREQUEST_0_DESC ' => 'Order Description ' ,
102
+ 'RETURNURL ' => 'https://www.example.com/return ' ,
103
+ 'CANCELURL ' => 'https://www.example.com/cancel ' ,
104
+ 'PAYMENTREQUEST_0_NOTIFYURL ' => 'https://www.example.com/notify ' ,
105
+
106
+ 'HDRIMG ' => 'https://www.example.com/header.jpg ' ,
107
+ 'PAYMENTREQUEST_0_SHIPTONAME ' => 'John Doe ' ,
108
+ 'PAYMENTREQUEST_0_SHIPTOSTREET ' => '123 NW Blvd ' ,
109
+ 'PAYMENTREQUEST_0_SHIPTOSTREET2 ' => 'Lynx Lane ' ,
110
+ 'PAYMENTREQUEST_0_SHIPTOCITY ' => 'Topeka ' ,
111
+ 'PAYMENTREQUEST_0_SHIPTOSTATE ' => 'KS ' ,
112
+ 'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE ' => 'USA ' ,
113
+ 'PAYMENTREQUEST_0_SHIPTOZIP ' => '66605 ' ,
114
+ 'PAYMENTREQUEST_0_SHIPTOPHONENUM ' => '555-555-5555 ' ,
115
+
116
+ );
117
+
118
+ $ this ->assertEquals ($ expected , $ this ->request ->getData ());
119
+ }
120
+
59
121
public function testHeaderImageUrl ()
60
122
{
61
123
$ this ->assertSame ($ this ->request , $ this ->request ->setHeaderImageUrl ('https://www.example.com/header.jpg ' ));
0 commit comments