@@ -130,6 +130,21 @@ public function testShouldCreateCardIfDuplicateCustomerProfileExists()
130130 $ this ->assertSame ('Successful. ' , $ response ->getMessage ());
131131 }
132132
133+ public function testShouldCreateCardFromOpaqueDataIfDuplicateCustomerProfileExists ()
134+ {
135+ $ this ->setMockHttpResponse (array ('CIMCreateCardFailureWithDuplicate.txt ' , 'CIMCreatePaymentProfileSuccess.txt ' ,
136+ 'CIMGetProfileSuccess.txt ' , 'CIMGetPaymentProfileSuccess.txt ' ));
137+
138+ $ response = $ this ->gateway ->createCard ($ this ->createCardFromOpaqueDataOptions )->send ();
139+
140+ $ this ->assertTrue ($ response ->isSuccessful ());
141+ $ this ->assertSame (
142+ '{"customerProfileId":"28775801","customerPaymentProfileId":"26485433"} ' ,
143+ $ response ->getCardReference ()
144+ );
145+ $ this ->assertSame ('Successful. ' , $ response ->getMessage ());
146+ }
147+
133148 public function testShouldUpdateExistingPaymentProfileIfDuplicateExistsAndForceCardUpdateIsSet ()
134149 {
135150 // Duplicate **payment** profile
@@ -146,6 +161,17 @@ public function testShouldUpdateExistingPaymentProfileIfDuplicateExistsAndForceC
146161 $ this ->assertSame ('Successful. ' , $ response ->getMessage ());
147162 }
148163
164+ public function testDoesntUpdateExistingPaymentProfileFromOpaqueData ()
165+ {
166+ // Duplicate **payment** profile
167+ $ this ->setMockHttpResponse (array ('CIMCreateCardFailureWithDuplicate.txt ' , 'CIMCreatePaymentProfileFailure.txt ' ,
168+ 'CIMGetProfileSuccess.txt ' , 'CIMUpdatePaymentProfileSuccess.txt ' , 'CIMGetPaymentProfileSuccess.txt ' ));
169+
170+ $ response = $ this ->gateway ->createCard ($ this ->createCardFromOpaqueDataOptions )->send ();
171+
172+ $ this ->assertFalse ($ response ->isSuccessful ());
173+ }
174+
149175 public function testShouldUpdateExistingPaymentProfileIfDuplicateExistsAndMaxPaymentProfileLimitIsMet ()
150176 {
151177 $ this ->setMockHttpResponse (array ('CIMCreateCardFailureWithDuplicate.txt ' ,
0 commit comments