/** * @param string $orderId * @param Payment $payment * @param RecurringPaymentInformation $paymentInformation * * @dataProvider dataProvider */ public function testXMLGeneration($orderId, $payment, $paymentInformation) { $prophet = new Prophet(); $orderService = $prophet->prophesize('Checkdomain\\TeleCash\\IPG\\API\\Service\\OrderService'); $recurring = new Modify($orderService->reveal(), $orderId, $payment, $paymentInformation); $document = $recurring->getDocument(); $document->appendChild($recurring->getElement()); $elementRecurringPayment = $document->getElementsByTagName('ns2:RecurringPayment'); $this->assertEquals(1, $elementRecurringPayment->length, 'Expected element RecurringPayment not found'); $children = []; /** @var \DOMNode $child */ foreach ($elementRecurringPayment->item(0)->childNodes as $child) { $children[$child->nodeName] = $child->nodeValue; } $this->assertArrayHasKey('ns2:RecurringPaymentInformation', $children, 'Expected element RecurringPaymentInformation not found'); //no need to further test RecurringPaymentInformation, as this is already covered in RecurringPaymentInformationTest $this->assertArrayHasKey('ns1:Payment', $children, 'Expected element Payment not found'); //no need to further test Payment, as this is already covered in PaymentTest $this->assertArrayHasKey('ns2:Function', $children, 'Expected element Function not found'); $this->assertEquals('modify', $children['ns2:Function'], 'Function did not match'); $this->assertArrayHasKey('ns2:OrderId', $children, 'Expected element OrderId not found'); }
/** * Modify a recurring payment * * @param string $orderId * @param string $hostedDataId * @param float $amount * @param \DateTime|null $startDate * @param int $count * @param int $frequency * @param string $period * * @return Response\Action\ConfirmRecurring|Response\Error * @throws \Exception */ public function modifyRecurringPayment($orderId, $hostedDataId, $amount, $startDate, $count, $frequency, $period) { $service = $this->getService(); $paymentInformation = new Model\RecurringPaymentInformation($startDate, $count, $frequency, $period); $payment = new Model\Payment($hostedDataId, $amount); $recurringPaymentAction = new Request\Action\RecurringPayment\Modify($service, $orderId, $payment, $paymentInformation); return $recurringPaymentAction->modify(); }