function it_should_not_charge_if_token_is_not_authorized(ChargeToken $request, APIClient $api, Payment $payment) { $model = new ArrayObject(array('PaymentOrder' => array('Status' => APIClient::STATUS_PROGRESS), 'PaymentOrderId' => 456, 'Amount' => 123, 'Currency' => 'EUR')); $request->getModel()->willReturn($model); $api->PaymentOrderCharge(Argument::any(), Argument::any(), Argument::any())->shouldNotBeCalled(); $payment->execute(Argument::any())->shouldNotBeCalled(); $this->execute($request); }
/** * @test * * @expectedException \Payum\Core\Exception\LogicException * @expectedExceptionMessage Possible endless cycle detected. ::onPreExecute was called 10 times before reach the limit. */ public function throwCycleRequestIfActionCallsMoreThenLimitAllows() { $cycledRequest = new \stdClass(); $action = new RequireOtherRequestAction(); $action->setSupportedRequest($cycledRequest); $action->setRequiredRequest($cycledRequest); $payment = new Payment(); $payment->addExtension(new EndlessCycleDetectorExtension($limit = 10)); $payment->addAction($action); $payment->execute($cycledRequest); }
/** * @param Keys $keys * * @return PaymentInterface */ public static function createCheckout(Keys $keys, ActionInterface $renderTemplateAction = null, $layoutTemplate = null, $obtainTokenTemplate = null) { $layoutTemplate = $layoutTemplate ?: '@PayumCore/layout.html.twig'; $obtainTokenTemplate = $obtainTokenTemplate ?: '@PayumStripe/Action/obtain_checkout_token.html.twig'; $renderTemplateAction = $renderTemplateAction ?: new RenderTemplateAction(TwigFactory::createGeneric(), $layoutTemplate); $payment = new Payment(); $payment->addApi($keys); $payment->addExtension(new EndlessCycleDetectorExtension()); $payment->addAction(new CaptureAction()); $payment->addAction(new StatusAction()); $payment->addAction(new ExecuteSameRequestWithModelDetailsAction()); $payment->addAction($renderTemplateAction); $payment->addAction(new ObtainTokenAction($obtainTokenTemplate)); $payment->addAction(new CreateChargeAction()); return $payment; }
/** * @param ApiContext $api * * @return \Payum\Core\Payment */ public static function create(ApiContext $api) { $payment = new Payment(); $payment->addApi($api); $payment->addExtension(new EndlessCycleDetectorExtension()); $payment->addAction(new CaptureAction()); $payment->addAction(new StatusAction()); $payment->addAction(new SyncAction()); $payment->addAction(new ExecuteSameRequestWithModelDetailsAction()); return $payment; }
/** * @param \Klarna_Checkout_ConnectorInterface $connector * * @return \Payum\Core\Payment */ public static function create(\Klarna_Checkout_ConnectorInterface $connector, ActionInterface $renderTemplateAction = null, $layoutTemplate = null, $captureTemplate = null) { $layoutTemplate = $layoutTemplate ?: '@PayumCore/layout.html.twig'; $captureTemplate = $captureTemplate ?: '@PayumKlarnaCheckout/Action/capture.html.twig'; $renderTemplateAction = $renderTemplateAction ?: new RenderTemplateAction(TwigFactory::createGeneric(), $layoutTemplate); $payment = new Payment(); $payment->addApi($connector); $payment->addAction(new CaptureAction($captureTemplate)); $payment->addAction(new NotifyAction()); $payment->addAction(new StatusAction()); $payment->addAction(new CreateOrderAction()); $payment->addAction(new UpdateOrderAction()); $payment->addAction($renderTemplateAction); return $payment; }
/** * @param \Omnipay\Common\GatewayInterface $gateway * * @return Payment */ public static function create(GatewayInterface $gateway) { $payment = new Payment(); $payment->addApi($gateway); $payment->addExtension(new EndlessCycleDetectorExtension()); $payment->addAction(new CaptureAction()); $payment->addAction(new StatusAction()); $payment->addAction(new ExecuteSameRequestWithModelDetailsAction()); return $payment; }
/** * @param Api $api * * @return \Payum\Core\Payment */ public static function create(Api $api) { $payment = new Payment(); $payment->addApi($api); $payment->addExtension(new EndlessCycleDetectorExtension()); $payment->addAction(new SetExpressCheckoutAction()); $payment->addAction(new GetExpressCheckoutDetailsAction()); $payment->addAction(new GetTransactionDetailsAction()); $payment->addAction(new DoExpressCheckoutPaymentAction()); $payment->addAction(new CreateRecurringPaymentProfileAction()); $payment->addAction(new GetRecurringPaymentsProfileDetailsAction()); $payment->addAction(new CaptureAction()); $payment->addAction(new NotifyAction()); $payment->addAction(new PaymentDetailsStatusAction()); $payment->addAction(new PaymentDetailsSyncAction()); $payment->addAction(new RecurringPaymentDetailsStatusAction()); $payment->addAction(new RecurringPaymentDetailsSyncAction()); $payment->addAction(new ManageRecurringPaymentsProfileStatusAction()); $payment->addAction(new CreateBillingAgreementAction()); $payment->addAction(new DoReferenceTransactionAction()); $payment->addAction(new AuthorizeTokenAction()); $payment->addAction(new ExecuteSameRequestWithModelDetailsAction()); return $payment; }
{ // TODO: Implement doDeleteModel() method. } /** * @param object $model * * @return \Payum\Core\Model\Identificator */ protected function doGetIdentificator($model) { // TODO: Implement doGetIdentificator() method. } /** * @param mixed $id * * @return object|null */ function findModelById($id) { return new \PayumBitPay\Model\Transaction(); } } $detailsClass = 'PayumBitPay\\Model\\Transaction'; $storage = new TestStorage($detailsClass); $storages = array($detailsClass => $storage); $payment = new Payment(); $payment->addAction(new CaptureAction($bitPayClient)); $payment->addAction(new StatusAction()); $payment->addAction(new NotifyAction($storage)); $payments = array('bitpay' => $payment); $registry = new SimpleRegistry($payments, $storages, 'bitpay');
/** * @test * * @expectedException \Payum\Core\Exception\RequestNotSupportedException */ public function shouldCallExtensionOnExceptionWhenExceptionThrown() { $notSupportedRequest = new \stdClass(); $extensionMock = $this->createExtensionMock(); $extensionMock->expects($this->once())->method('onException')->with($this->isInstanceOf('Payum\\Core\\Exception\\RequestNotSupportedException'), $this->identicalTo($notSupportedRequest)); $payment = new Payment(); $payment->addExtension($extensionMock); $payment->execute($notSupportedRequest); }
/** * @param Api $api * * @return \Payum\Core\Payment */ public static function create(Api $api) { $payment = new Payment(); $payment->addApi($api); $payment->addExtension(new EndlessCycleDetectorExtension()); $payment->addAction(new SetExpressCheckoutAction()); $payment->addAction(new GetTransactionDetailsAction()); $payment->addAction(new CaptureOnsiteAction()); $payment->addAction(new FillOrderDetailsAction()); $payment->addAction(new StatusAction()); $payment->addAction(new ExecuteSameRequestWithModelDetailsAction()); $payment->addAction(new GetHttpRequestAction()); return $payment; }
/** * @param Api\OrderApi $orderApi * @param Api\AgreementApi $agreementApi * @param Api\RecurringApi $recurringApi * * @return \Payum\Core\Payment */ public static function create(OrderApi $orderApi, AgreementApi $agreementApi = null, RecurringApi $recurringApi = null) { $payment = new Payment(); if ($agreementApi) { $payment->addApi($agreementApi); $payment->addAction(new AgreementDetailsStatusAction()); $payment->addAction(new CreateAgreementAction()); $payment->addAction(new DeleteAgreementAction()); $payment->addAction(new CheckAgreementAction()); $payment->addAction(new AutoPayAgreementAction()); } if ($recurringApi) { $payment->addApi($recurringApi); $payment->addAction(new StartRecurringPaymentAction()); $payment->addAction(new StopRecurringPaymentAction()); $payment->addAction(new CheckRecurringPaymentAction()); } $payment->addApi($orderApi); $payment->addExtension(new EndlessCycleDetectorExtension()); $payment->addAction(new InitializeOrderAction()); $payment->addAction(new CompleteOrderAction()); $payment->addAction(new CheckOrderAction()); $payment->addAction(new PaymentDetailsCaptureAction()); $payment->addAction(new PaymentDetailsStatusAction()); $payment->addAction(new PaymentDetailsSyncAction()); $payment->addAction(new AutoPayPaymentDetailsCaptureAction()); $payment->addAction(new AutoPayPaymentDetailsStatusAction()); $payment->addAction(new ExecuteSameRequestWithModelDetailsAction()); return $payment; }
public static function create(Config $config) { $payment = new Payment(); $payment->addApi($config); $payment->addAction(new CaptureAction()); $payment->addAction(new AuthorizeAction()); $payment->addAction(new StatusAction()); $payment->addAction(new SyncAction()); $payment->addAction(new ActivateAction()); $payment->addAction(new ActivateReservationAction()); $payment->addAction(new CancelReservationAction()); $payment->addAction(new CheckOrderStatusAction()); $payment->addAction(new GetAddressesAction()); $payment->addAction(new PopulateKlarnaFromDetailsAction()); $payment->addAction(new ReserveAmountAction()); return $payment; }
/** * @param Payment $payment * @param ArrayObject $config */ protected function buildExtensions(Payment $payment, ArrayObject $config) { foreach ($config as $name => $value) { if (0 === strpos($name, 'payum.extension')) { $prepend = in_array($name, $config['payum.prepend_extensions']); if (is_callable($value)) { $payment->addExtension(call_user_func_array($value, array($config)), $prepend); } else { $payment->addExtension($value, $prepend); } } } }