I am doing a magento gateway for paysolution for 1.4 and 1.5 and i am stack in the return from the bank. It is my firs module an I confusing about the way MVC works.
The admin configuration part works perfect
the redirect to the bank works fine and the bank show the data from the order
I have the php code to analyze the return but i don't understand where to put it.
The problem is i don't know wich url i have to configure in the paysolution account and how I create the page in the module to get the return from the bank.
I you can point me the right direction I will really apriciate.
Regards,
Eduardo
you have to write a custom controller within your module in order to give the Payment Gateway a redirection URL to call.
Some gateways also requires server to server communication so they will require another URL the will call asynchronously in order to communicate transaction result.
In order to understand what is a controller I suggest you to carefully read the following tutorials:
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-1-introduction-to-magento#3
http://blog.baobaz.com/en/blog/magento-module-create-your-own-controller
According to the fact that the transaction is successful or not, you will end your controller method with one of the following redirections:
$this->_redirect('checkout/onepage/success');
or
$this->_redirect('checkout/onepage/failure');
I suggest you to take a look at the Paypal StandardController.php under [mageinstalldir]/app/code/core/Mage/Paypal/controllers and the OnepageController.php under [mageinstalldir]/app/code/core/Mage/Checkout/controllers
Best wishes,
Alessandro
Give this a try:
http://colourgray.wordpress.com/2009/11/11/magento-create-a-custom-payment-method/
Related
I am facing a problem, where some API is consuming Server Consumption a lot in AWS. so minimize this I have decided to divide my API into two-part that is (Read and Write) API. now the problem arises in Laravel 5.7.I am not getting how to identify which API is being used for reading and writing? I can do this just call a new method that overwrites my hostname from a Controller. but it is lazy task where i have 241 method in my project. for this, i have created separated Middleware.
Suppose i am calling Route::post('login', 'Api\AuthController#login')->middleware('ReadAPISourse');
Anyone has its better solution please tell.
right now i am calling middleware that name is ReadAPISourse in all get route. after that, i have fixed my problem.
Its answer was simple. just make a middleware and used that with a route.
Route::post('login', 'Api\AuthController#login')->middleware('ReadAPISourse');
but its after i am looking its better solution.
here the problem is the first system is booting with a DB connection then after it is being overwritten by ReadAPISourse.
In Magento when there's Paypal transaction error, it outputs a message like this:
This transaction cannot be processed (#15005: Processor Decline)
Since the message doesn't originate in Magento, it cannot be updated via translate.csv.
What are options available for developer to make these messages more user friendly?
This will not be easy but I think it's doable.
My guess would be to rewrite method
_processPaypalApiError($exception) in Mage_Paypal_Controller_Express_Abstract.
Since it's in an abstract class, you will have to rewrite one of the method (Express for example).
Also look at _setApiProcessableErrors
I'm still in a learning phase with PHP and Laravel 5 and since I upgraded to L5, I struggle with where my code belongs to. There are so many files and folders which seem to have the same purpose or at least are very similar. There are Commands, Controllers, Events, Services, Requests, etc. I give an example with my workflow and where I would place the code and I hope you guys can comment on that and correct/help me.
Situation
I want to register a new user in my application and send a welcome e-mail when he registered successfully.
Workflow
Controller (UserController): Returns requested view (register).
Request (RegisterRequest): The "RegisterRequest" validates the entered data.
Controller (UserController): Passes the validated data to the "UserRegistrar" (service) in 'App/Services'.
Service (UserRegistrar): Creates a new user and saves it to the database.
Controller (UserController): Fires the "UserWasRegistered" Event.
Event (UserWasRegistered): This Event call the "SendWelcomeEmail" Command.
Command (SendWelcomeEmail): This Command will send/queue the welcome e-mail.
Controller (UserController): Redirects the user to a view with the information that he has been registerd successfully and a message has been send to him.
Logic
Okay, let's discuss some logic:
Controller:
Doesn't hold much code.
Mainly there to return views (with requested data).
Handles workflow and "connects" modules (Services, Requests, Events).
Request: Validates the data for a specified request
Service: A service "does" something. For example it's doing requests to the database.
Event: An Event is a central place to call one or more tasks if it is fired (SendConfirmationMail, SendWelcomeMail).
Command: Mainly there to handle the logic for ONE certain task. For example sending a confirmation mail. Another command will hold the logic for sending the welcome mail. Both commands are called in the Event described before.
Repositories: What is that?!
So this is what I understand. Please help me and feed me with information.
Thanks,
LuMa
Your question is a little vague and will likely attract downvotes as being "too broad". That said, here's my take on this...
The biggest issue I see is that your application structure is very different from the recommended L5 structure - or even the standard MVC structure - that it's no wonder you're getting confused.
Let's talk about your "Logic" section:
controller - you're on the right track here. The controller is the glue between your models and your views. It can do some processing, but most should be offloaded to classes that handle specific tasks.
request - what is this? L5 includes a Request class that includes methods for examining the HTTP request received from the client. Are you talking about subclassing that? Why? If your idea of a "request" class is primarily concerned with examining input, you can either do that in your model (ie. validating stuff before sticking it in the database) or in your controller (see the L5 docs on controller validation)
service - again, what is this? You talk about "doing requests to the database", but L5 provides a class for that (DB). At a higher level, database access should primarily be done through models, which abstract away most of the low level database access. As for other services, what I usually do is create libraries to perform specific processing. For example, my application has a particular third party project management application that it accesses via an API. I have a library for that, with methods such as getProject or createProject.
event - An event is a way of ensuring that some code is called when the event happens, without a whole lot of messing about. It sounds like you have the right idea about events.
command - again, it sounds like you have the basic idea about commands.
repositories - these are way of abstracting the connection between a resource (primarily the database, but it can apply to other resources too) and the code that uses the resource. This gives a way to switch the underlying resource more easily if you (for example) decide to change database servers in the future. They are optional.
You also haven't mentioned anything about models. L5 provides an excellent way to deal with your data in understandable chunks via Eloquent models - this will make your life much easier.
My suggestion is this: start small. Build a simple MVC application with L5 - A model (to save some data), a view (to display the data), and a controller (to put the model & view together by handling the client request). Once you have that, start extending it.
There are tutorials out there that will give you this basic structure for Laravel - most are for Laravel 4, but see if you can follow the basic ideas and build something similar for Laravel 5.
Is there a way to change the scope/permission when using Microsoft.Web.WebPages.OAuth? The most logical place is when registering the client with OAuthWebSecurity.RegisterClient. I thought that the adding scope to the extraData parameter would possibly work, but I didn't have success with that.
Microsoft.Web.WebPages.OAuth does not expose the scope when authorizing with a client. I ended up adding custom DotNetOpenAuth clients to include my necessary scope.
The extradata is something you can pass about the provider and use it in tehe UI layer. For eg. extra data could be the icon to display when listing the provider to use for login.
Following post shows how you can write your own provider and plug it into your site
http://blogs.msdn.com/b/webdev/archive/2012/08/23/plugging-custom-oauth-openid-providers.aspx
I am currently building an online store using magento.
After placing an order, customers automatically receive an "order confirmation". However, I would like to check first first if this order can be processed (for several reasons) and after that, send an "order acceptance" email saying that we accepted the order starting to process it.
I cant believe that magento lacks this feature.
However I also need to send several other emails:
when payment is received
when more preoducts need to be ordered
when we received the products otderd by the customer..
Does anybody have any clue, how something like this can be accomplished?
Thanks in advance!
do you know any other e-commerce platform on php that has this feature ?
You most certainly can
overwrite the saveOrder() method in Mage_Checkout_Model_Type_Onepage that calls out the sending of this e-mail
overwrite sendNewOrderEmail() method in Mage_Sales_Model_Order that defines this method
overwrite the canSendNewOrderEmail() method in Mage_Sales_Helper_Data that handles the validation if sending this mail is allowed
edit the sales_email/order/enabled config value, that is used to control the condition on helper method, to be false from admin page
After that you have to implement your own status based e-mail sending in your extension observer . You can observe the save_order_after event to do that and you can call for the same method as it is accessible from order object
Note : This is commercial software
We have used this extension by amasty called order status. It works very well. It will fire off an email from the transactional emails when a certain status has been changed.