@@ -1284,7 +1284,7 @@ public function testCreatePayPalAccount_noEmail() {
1284
1284
$ client ->createPayPalAccount ('test-user-token ' , $ payPalAccount );
1285
1285
$ this ->fail ('HyperwalletArgumentException expected ' );
1286
1286
} catch (HyperwalletArgumentException $ e ) {
1287
- $ this ->assertEquals ('email is required! ' , $ e ->getMessage ());
1287
+ $ this ->assertEquals ('email or accountId is required! ' , $ e ->getMessage ());
1288
1288
}
1289
1289
}
1290
1290
@@ -4036,7 +4036,7 @@ public function testListReceiptsForPrepaidCard_withParameters() {
4036
4036
// Validate mock
4037
4037
\Phake::verify ($ apiClientMock )->doGet ('/rest/v4/users/{user-token}/prepaid-cards/{prepaid-card-token}/receipts ' , array ('user-token ' => 'test-user-token ' , 'prepaid-card-token ' => 'test-prepaid-card-token ' ), array ('createdBefore ' => 'value ' ));
4038
4038
}
4039
-
4039
+
4040
4040
public function testListReceiptsForPrepaidCard_withInvalidFilter () {
4041
4041
$ client = new Hyperwallet ('test-username ' , 'test-password ' , 'test-program-token ' );
4042
4042
try {
@@ -5775,4 +5775,25 @@ public function testListTransferMethods_withParameters() {
5775
5775
// Validate mock
5776
5776
\Phake::verify ($ apiClientMock )->doGet ('/rest/v4/users/{user-token}/transfer-methods ' , array ('user-token ' => 'test-user-token ' ), array ('type ' =>TransferMethod::TYPE_PREPAID_CARD ));
5777
5777
}
5778
+
5779
+ public function testCreatePayPalAccount_WithAccountId () {
5780
+ // Setup
5781
+ $ client = new Hyperwallet ('test-username ' , 'test-password ' );
5782
+ $ apiClientMock = $ this ->createAndInjectApiClientMock ($ client );
5783
+ $ payPalAccount = new PayPalAccount ();
5784
+ $ payPalAccount ->setTransferMethodCountry ('test-transferMethodCountry ' );
5785
+ $ payPalAccount ->setTransferMethodCurrency ('test-transferMethodCurrency ' );
5786
+ $ payPalAccount ->setAccountId ('test-accountId ' );
5787
+
5788
+ \Phake::when ($ apiClientMock )->doPost ('/rest/v4/users/{user-token}/paypal-accounts ' , array ('user-token ' => 'test-user-token ' ), $ payPalAccount , array ())->thenReturn (array ('token ' => 'test-token ' ));
5789
+
5790
+ // Run test
5791
+ $ newPayPalAccount = $ client ->createPayPalAccount ('test-user-token ' , $ payPalAccount );
5792
+ $ this ->assertNotNull ($ newPayPalAccount );
5793
+ $ this ->assertEquals (array ('token ' => 'test-token ' ), $ newPayPalAccount ->getProperties ());
5794
+
5795
+
5796
+ // Validate mock
5797
+ \Phake::verify ($ apiClientMock )->doPost ('/rest/v4/users/{user-token}/paypal-accounts ' , array ('user-token ' => 'test-user-token ' ), $ payPalAccount , array ());
5798
+ }
5778
5799
}
0 commit comments