public function testCreateChargeWithCustomerDefaultCard() { $chargeService = $this->_apiClient->chargeService(); $cardChargeModel = new \com\checkout\ApiServices\Charges\RequestModels\CardIdChargeCreate(); $chargePayload = \test\TestHelper::getBaseChargeModel($cardChargeModel); $chargePayload->setCardId('card_b1e4ce59-eb30-4e77-a85e-fc23d9730d8a'); $chargePayload->setCustomerId('cust_1DF71432-367C-4EB6-BEA4-D29A624F5ED5'); $chargeResponse = $chargeService->chargeWithCardId($chargePayload); $this->assertFalse($chargeResponse->hasError()); $this->assertEquals(200, $chargeResponse->getHttpStatus()); $this->assertEquals(1, $chargeResponse->getTransactionIndicator()); $this->assertNotNull($chargeResponse->getId()); }
public function getMockUpCaptureCharge() { $chargeService = new \com\checkout\ApiClient('sk_test_a2dba067-bfe8-425c-88e9-6685820aa16e'); $baseCardModel = \test\TestHelper::getMockUpBaseCard(); $cardChargeModel = new \com\checkout\ApiServices\Charges\RequestModels\CardChargeCreate(); $chargePayload = \test\TestHelper::getBaseChargeModel($cardChargeModel); $chargePayload->setBaseCardCreate($baseCardModel); $chargeResponse = $chargeService->chargeService()->chargeWithCard($chargePayload); $chargeCapturePayload = new \com\checkout\ApiServices\Charges\RequestModels\ChargeCapture(); $chargeCapturePayload->setChargeId($chargeResponse->getId()); $chargeCapturePayload->setValue($chargeResponse->getValue()); return $chargeService->chargeService()->CaptureCardCharge($chargeCapturePayload); }
public function testCaptureCharge() { $chargeService = $this->_apiClient->chargeService(); $response = \test\TestHelper::getMockUpCaptureCharge(); $this->assertEquals(200, $response->getHttpStatus()); $this->assertEquals('10000', $response->getResponseCode()); $this->assertEquals('Captured', $response->getStatus()); }