/** * We should increment the order ID with each NewInvoice call */ function testNewInvoiceOrderId() { $init = $this->getDonorTestData('BR'); $firstRequest = $this->setUpRequest($init); $firstAttempt = new TestingAstroPayAdapter(); $firstAttempt->setDummyGatewayResponseCode('1'); $firstAttempt->doPayment(); $this->setUpRequest($init, $firstRequest->getSessionArray()); $secondAttempt = new TestingAstroPayAdapter(); $secondAttempt->doPayment(); parse_str($firstAttempt->curled[0], $firstParams); parse_str($secondAttempt->curled[0], $secondParams); $this->assertNotEquals($firstParams['x_invoice'], $secondParams['x_invoice'], 'Not generating new order id for NewInvoice call'); }
public function testResetSubmethodOnMethodSwitch() { // Donor thinks they want to make a bank transfer, submits form $init = $this->getDonorTestData('BR'); $init['payment_method'] = 'bt'; $init['payment_submethod'] = 'itau'; $firstRequest = $this->setUpRequest($init); $gateway = new TestingAstroPayAdapter(); $gateway->do_transaction('Donate'); $donorData = $firstRequest->getSessionData('Donor'); $this->assertEquals('itau', $donorData['payment_submethod'], 'Test setup failed.'); // Then they go back and decide they want to donate via credit card $init['payment_method'] = 'cc'; unset($init['payment_submethod']); $secondRequest = $this->setUpRequest($init, $firstRequest->getSessionArray()); $gateway = new TestingAstroPayAdapter(); $newMethod = $gateway->getData_Unstaged_Escaped('payment_method'); $newSubmethod = $gateway->getData_Unstaged_Escaped('payment_submethod'); $this->assertEquals('cc', $newMethod, 'Test setup failed'); $this->assertEquals('', $newSubmethod, 'Submethod was not blanked on method switch'); }