/** * sync. * * @method sync * * @param string $gatewayName * @param callable $closure */ public function sync($gatewayName, callable $closure) { $payum = $this->getPayum(); $gateway = $this->getGateway($gatewayName); $storage = $payum->getStorage($this->getPaymentModelName($payum)); $payment = $storage->create(); $closure($payment, $gatewayName, $storage, $this->payum); $request = new Sync($payment); $convert = new Convert($payment, 'array', $request->getToken()); $gateway->execute($convert); $payment->setDetails($convert->getResult()); $gateway->execute($request); return $request->getModel(); }