'Create Payment Transactions', 'message' => 'You have successfully created currency supplier transactions' ]; } /** @var FetchesTransaction */ private $fetchesTransaction; /** @var CreatePaymentTransactionProcessor */ private $createPaymentTransactionProcessor; public function __construct( FetchesTransaction $fetchesTransaction, CreatePaymentTransactionProcessor $createPaymentTransactionProcessor ) { $this->fetchesTransaction = $fetchesTransaction; $this->createPaymentTransactionProcessor = $createPaymentTransactionProcessor; } public function logic(Request $request) : JsonResponse { $payment_method = PaymentMethodType::PAYMENT_METHODS[$request->input('payment_method')]; $invoice_transaction = $this->fetchesTransaction->execute(['id' => $request->input('transaction_id')]); $payment_transaction = $this->createPaymentTransactionProcessor->execute($invoice_transaction, $payment_method , $request->input('bank_code')); return $this->resourceResponse(new TransactionResource($payment_transaction)); } }