Skip to content

Commit 9f62df5

Browse files
authored
Update CIMGatewayIntegrationTest.php
Adds deletePaymentProfileRequest integration test
1 parent d1efead commit 9f62df5

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/CIMGatewayIntegrationTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,41 @@ public function testCustomerAndPaymentProfile()
112112
);
113113
}
114114

115+
public function testPaymentProfileDelete()
116+
{
117+
118+
// Create a customer profile with the specified email (email is the identifier) (to have a deletable payment profile)
119+
$email = uniqid('', true) . '@example.com';
120+
$cardRef = $this->createCard(array('email' => $email));
121+
$cardRef = json_decode($cardRef,true);
122+
123+
//Delete the recently created payment profile (deletes the payment profile only, not the customer profile)
124+
$params = array(
125+
'customerProfileId' => $cardRef['customerProfileId'],
126+
'customerPaymentProfileId' => $cardRef['customerPaymentProfileId']
127+
);
128+
$defaults = array( );
129+
$params = array_merge($defaults, $params);
130+
$request = $this->gateway->deleteCard($params);
131+
$request->setDeveloperMode(true);
132+
/* @var $response CIMResponse */
133+
$response = $request->send();
134+
$this->assertTrue($response->isSuccessful(), 'Should be successful as we have deleted a payment profile');
135+
136+
/* retrieve the recently deleted payment profile for the customer profile from authorize.net (returns NULL) */
137+
$params = array(
138+
'customerProfileId' => $cardRef['customerProfileId'],
139+
'customerPaymentProfileId' => $cardRef['customerPaymentProfileId']
140+
);
141+
$defaults = array( );
142+
$params = array_merge($defaults, $params);
143+
$request = $this->gateway->getPaymentProfile($params);
144+
$request->setDeveloperMode(true);
145+
/* @var $response CIMResponse */
146+
$response = $request->send();
147+
$this->assertNull($response->getCustomerPaymentProfileId(), 'Should be null as we have deleted that payment profile');
148+
}
149+
115150
public function testAuthorizeCapture()
116151
{
117152
$cardRef = $this->createCard();

0 commit comments

Comments
 (0)