Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nutty About Hosting 22 posts 75 karma points
    May 21, 2016 @ 08:20
    Nutty About Hosting
    0

    Merchello 2.0.0 New Compatible Payment Plugin Example

    Hi Guys (Perhaps Rusty in particular :) ),

    It there a new payment plugin example that is compatible with the new V2 of merchello?

    I had written a WorldPay plugin that did not work as expected in V1.14 - I based it on the PayPal plugin code.

    So I have upgraded to V2 where the integrated PayPal works - but this does not seem to be based on the PlugIn code?

    Is there an updated example I can work from that is not integrated in to Merchello already?

    I also tried the Chase plugin code which no longer works in V2 of Merchello.

    The problems appear to be with the back end and angular controllers - I am getting this...

    merchello.stripe.controller.js?cdv=525082018:44 Uncaught TypeError: Cannot read property 'Controllers' of undefined
    

    Which is happening on the last line...

    }(window.merchello.Controllers = window.merchello.Controllers || {}));
    

    The built in PayPal code JS now seems to be different, and I have tried using and amending it - but haven't had any luck yet.

    So I just thought I'd ask here for some help - hopefully an updated plugin template is available - but I've not found it yet in the repo - but I am probably just missing it :)

    Cheers

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    May 21, 2016 @ 14:31
    Rusty Swayne
    0

    Hey there,

    It looks like the cleanup we did by removing some of the pre 1.7.0 code broken your Angular.

    https://github.com/Merchello/Merchello/blob/1.14.1/src/Merchello.Web.UI.Client/src/merchello.module.js

    Before 1.7.0 the Merchello was added I think incorrectly to the window object.

     // LEGACY NAMESPACES - THESE SHOULD NO LONGER BY USED
    (function (merchello, undefined) {
    
    // Global namespaces defined
    merchello.Models = {};
    merchello.Controllers = {};
    merchello.Directives = {};
    merchello.Filters = {};
    merchello.Services = {};
    merchello.Helpers = {};
    
    }(window.merchello = window.merchello || {}));
    

    I removed this snippet in 2.0.0 which is why you are encountering the window.merchello = undefined

    Post 1.7.0 we push the Angular merchello "module" into the umbraco.packages "module".

    The Angluar merchello module likewise has a "merchello.plugins" module which is intended to be used for Merchello plugin angular.

    Adding a .js file to your package.manifest (loaded first) mypluginname.module.js with contents below will accomplish this.

       (function () {
        angular.module('mypluginname',
            [
               'merchello.models'
            ]);
        angular.module('merchello.plugins').requires.push('mypluginname');
     }());
    

    The next step is to make sure your angular controllers are added to your module.

     angular.module('mypluginname').controller('MyControllerName',
    ['$scope',
        function ($scope) {
    
    
    
        }]);
    
  • Nutty About Hosting 22 posts 75 karma points
    May 21, 2016 @ 18:22
    Nutty About Hosting
    0

    Super stuff - Thanks Rusty. That is great - and has solved that issue now :)

    I now have the next problem...

    The back end config all works OK now...

    Back end WorldPay Config

    Back end WorldPay payment Option

    Now if I have

    <add key="Bazaar:ResolvePaymentForms" value="true" />
    

    The WorldPay option is not available at the check out - what do I need to do, to make the WorldPay option available there?

    If I set Bazaar:ResolvePaymentForms to false - the option is available at the checkout - but there is not submit button etc - if I hack in the correct GUID for WorldPay in to the form it checks out, but immediately shows the receipt, without redirecting off to WorldPay.

    Thanks again for your help with this.

    Cheers, Sean

  • Nutty About Hosting 22 posts 75 karma points
    May 24, 2016 @ 12:04
    Nutty About Hosting
    0

    Hi Rusty,

    I realise you are very busy :) But could you let me know, should I be able to get the above to work with the current code on the latest Merhcello version?

    I am now thinking perhaps I should start from scratch again, and build the WorldPay provider directly inside the Merchello Solution alongside the PayPal one, whilst basically duplicating the PayPal code and editing as needed

    I am just concerned about not being able to get this working at all.

    Cheers, Sean

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    May 24, 2016 @ 15:56
    Rusty Swayne
    0

    Hey Sean,

    It sounds like you are pretty close but if you choose to refactor, following the pattern that is in the Core should be fine as well. I'd keep it in a separate library though. The Merchello.Providers library are basically built to simply resolve the same way a custom provider would. The only difference is they directly have dependencies on the Merchello.Core and Merchello.Web projects so that they are easier to maintain.

    I don't have a link to your repo to check but it sounds like you may not have decorated your method with the GatewayMethodUiAttribute

     [GatewayMethodUi("WorldPay.WhateverMethod")]
    

    This attribute should also decorate a controller the implements IPaymentMethodUiController so it can be resolved as a PaymentController. The Bazaar has a base class that it uses for this with it's own model, checkout the PayPal controller in there -

  • Nutty About Hosting 22 posts 75 karma points
    May 25, 2016 @ 13:57
    Nutty About Hosting
    1

    You Super Star Rusty!

    Thanks for that - I now have a rough working checkout - need to polish it up and make sure all working correctly. Once that's all sorted and the site is live, I will then look to publish the WorldPay code on GitHub :)

    Thanks again!

    Cheers, Sean

  • AndrewS 3 posts 23 karma points
    Dec 02, 2016 @ 15:38
    AndrewS
    0

    Hi Sean,

    Is it available anywhere on the tinterweb? Looking to implement WorldPay provider as well.

    Thanks, Andrew

  • Nutty About Hosting 22 posts 75 karma points
    Dec 04, 2016 @ 18:41
    Nutty About Hosting
    0

    Hi Andrew,

    It's not published anywhere at the moment, as ideally, I'd look at the code and test it more.

    I am happy to share the code with you though - it may just work for you - and if not if will give you a starter for 10.

    Cheers, Sean

  • Mohammed BOUTEBEL 64 posts 103 karma points
    Mar 03, 2017 @ 14:25
    Mohammed BOUTEBEL
    1

    Hello.

    I have the same issue with the Stripe payment provider. Can you give more details about this code :

    angular.module('mypluginname').controller('MyControllerName',
    ['$scope',
        function ($scope) {
    
    
    
        }]);
    

    Thank you !

Please Sign in or register to post replies

Write your reply to:

Draft