@@ -1284,7 +1284,7 @@ public function testCreatePayPalAccount_noEmail() {
12841284 $ client ->createPayPalAccount ('test-user-token ' , $ payPalAccount );
12851285 $ this ->fail ('HyperwalletArgumentException expected ' );
12861286 } catch (HyperwalletArgumentException $ e ) {
1287- $ this ->assertEquals ('email is required! ' , $ e ->getMessage ());
1287+ $ this ->assertEquals ('email or accountId is required! ' , $ e ->getMessage ());
12881288 }
12891289 }
12901290
@@ -4036,7 +4036,7 @@ public function testListReceiptsForPrepaidCard_withParameters() {
40364036 // Validate mock
40374037 \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 ' ));
40384038 }
4039-
4039+
40404040 public function testListReceiptsForPrepaidCard_withInvalidFilter () {
40414041 $ client = new Hyperwallet ('test-username ' , 'test-password ' , 'test-program-token ' );
40424042 try {
@@ -5775,4 +5775,25 @@ public function testListTransferMethods_withParameters() {
57755775 // Validate mock
57765776 \Phake::verify ($ apiClientMock )->doGet ('/rest/v4/users/{user-token}/transfer-methods ' , array ('user-token ' => 'test-user-token ' ), array ('type ' =>TransferMethod::TYPE_PREPAID_CARD ));
57775777 }
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+ }
57785799}
0 commit comments