Jump to content

benbyf

Members
  • Posts

    796
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by benbyf

  1. Module's currently operating with this basic functionality:

    • Take credit card details and confirm with Stripe
    • Add js styling in moudles settings for Stripe Elements Form. So you can change how the form is displayed.
    • On return -> POST successful transaction id, name and email to relative url of your choice

    Things I'm looking to add:

    • Ability to POST successful values via AJAX to relative url of your choice.
    • Add CrossBrowserButton functionality - e.g. pay with apple pay button
    • Option to disable CrossBrowserButton if not required
    • Save Stripe Intent variables in session to be accessed by templates e.g. save amount, and currency in session to be used by module and / or template. Need to do something like this anyway as Stripe CrossBrowserButton doesn't take the same Intent information (see previous post ☝️).
    • Integration of module with PaymentModule - quite a bit of duplication currently here, so need to do some work to string the new module closer to payments module.

    Let me know what else might be useful?!

    • Like 1
  2. OK done some digging and found this absolutely stupid thing in their API: intents work with StripeElements menaing you can create a payment intent and supply that intent id to a form to start taking the payment, you can then use their API to step through the payment process using the language of your choice (pretty much) – I'm looking to implement both a PHP and JS implementation into my module. HOWEVER: if you want to use the cross browser payments button (e.g. pay with apply pay, google pay) then you have to create a new payment request to that js api, e.g. doesnt work with your pre-authed intent id... I've taken this up with them and they say:

    Quote

    "Unfortunately, this is not possible at this time, but it is very good feedback for us, and we'll consider it for the future."

    I consider this a massive oversight as surely the payment intents arethe beginning of ANY interaction with the StripAPI, in this case not. Anyway, will continue to work on this one to implement as much as possible.

    • Like 2
  3. I've been working on this a looks like it WILL require a change, as it now requires you update your payment journey to use PaymentIntentions, e.g. setting a intent to pay at the beginning of any payment checkout before actually requesting card information, address, email etc etc...

    I'm currently having to do this for my clients and adding support for Stripe Elements. Love this to be robust butI'm simply not a very good backend dev so muddling through it. Will release what I have when it's done hopefully in a week.

    • Like 4
  4. Think i'm miss understanding the conversion between curl in the terminal and curl in php.  Looking at the below and wondered how to set the -u. Is it setting a CURLOPT_USERPWD header? Or more complex than that?

    https://stripe.com/docs/payments/checkout/migration#client-products-server-code

    curl https://api.stripe.com/v1/customers \
      -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
      -d email="{{STRIPE_EMAIL}}" \
      -d source="{{STRIPE_TOKEN}}"
  5. Hi!

    Been doing some basic Twilio implementation for a client to enable them to automatically send text messages to registered users on page publish. As an upshot, I thought I would strip out the site specific work and stick up on github here: https://github.com/benbyford/TwilioChannels

    This modules pulls in the Twilio APi and enables you to send SMS messages from your front or backend.

    • Send SMS message
      • Truncate message to single message character limit
      • Auto-select number from range of numbers depending on $To number country of origin–this enables you to send messages with a local number to that user if one added to the config.

    Templates usage:

    $twilio = $modules->get("TwilioChannels");
    $twilio->sendSMS($toNumber, $message);

     

    • Like 7
  6. 5 minutes ago, BitPoet said:

    Thanks for posting that little trick. I took some inspiration there and made a small module that does the same without AOS. Should work with Default, Reno and Uikit themes. You can enable dev mode in the module's settings or by setting $config->devMode to true in site/config.php. Text and colors can be adapted in module settings. 

      Reveal hidden contents
    
    
    <?php
    
    /**
     * Admin Dev Mode Colors
     *
     * ProcessWire CMS module
     *
     * Changes the top bar color and injects a configurable string next to / instead of
     * the PW logo on development machines.
     *
     * The colors and text can be set in the module's configuration.
     *
     * You can enable development mode in two ways:
     *	- in the module's configuration
     *	- by setting $config->devMode to a truthy value in site/config.php
     *
     * Currently supported admin themes:
     *	- AdminThemeDefault
     *	- AdminThemeReno
     *	- AdminThemeUikit
     *
     * This module is released under the WTFPL. No warranties, no restrictions.
     *
     **/
    
    class AdminDevModeColors extends WireData implements Module, ConfigurableModule {
    	
    	public static function getModuleInfo() {
    		return [
    			"title"		=>	"Admin DEV Mode Colors",
    			"summary"	=>	"Enable distinct color scheme for development installs of PW",
    			"version"	=>	"0.0.1",
    			"autoload"	=>	true
    		];
    	}
    	
    	public function init() {
    		$this->addHookAfter("AdminTheme::getExtraMarkup", $this, "getColorMarkup");
    	}
    	
    	public function getColorMarkup(HookEvent $event) {
    		$parts = $event->return;
    		
    		if($this->config->devMode || $this->devMode) {
    			$parts["head"] .= $this->getStyle();
    		}
    		
    		$event->return = $parts;
    	}
    	
    	protected function getStyle() {
    		$bgcolor = $this->bgColor;
    		if(! $bgcolor) $bgcolor = 'rgb(153, 12, 94)';
    		$fgcolor = $this->fgColor;
    		if(! $fgcolor) $fgcolor = 'rgb(255, 255, 255)';
    		$devstring = $this->devString;
    		if(! $devstring) $devstring = "DEV";
    
    		$style = "<style>
    		/* Top bar coloring */
    		#masthead, #branding, #pw-masthead, #pw-masthead-mobile, body.AdminThemeReno a.main-nav-toggle { background-color: $bgcolor !important; }
    		body.AdminThemeReno #masthead #topnav > li > a { color: rgb(201, 207, 222) !imoprtant; }
    		
    		/* Admin theme default */
    		body.AdminThemeDefault #logo:before,
    		body.AdminThemeDefault li.collapse-topnav-menu:after {
    			content: '$devstring';
    			color: $fgcolor;
    			font-size: 2em;
    			font-weight: bold;
    			vertical-align: top;
    			margin-right: 1em;
    		}
    		body.AdminThemeDefault #logo img {
    			display: none;
    		}
    		
    		/* Admin theme Reno */
    		body.AdminThemeReno #logo:after {
    			content: '$devstring';
    			color: $fgcolor;
    			vertical-align: middle;
    			font-size: 2em !important;
    			letter-spacing: 0.05em;
    			margin-right: 5em;
    		}
    		body.AdminThemeReno #branding #logo img { display: none; }
    		body.AdminThemeReno #branding #logo img.sm {
    			display: inline;
    			margin: 0;
    		}
    		body.AdminThemeReno #branding #logo {
    			margin-top: 0.2em;
    		}
    		
    		/* Admin theme Uikit */
    		div.uk-navbar-right > ul > li:first-child > a:before,
    		#pw-masthead-mobile a:after {
    			content: '$devstring';
    			margin-right: 5em;
    			font-size: 2em;
    			font-weight: bold;
    			color: $fgcolor;
    			vertical-align: middle;
    		}
    		</style>" . PHP_EOL;
    	
    		return $style;
    	}
    	
    	public static function getModuleConfigInputfields($data) {
    		$inputfields = new InputfieldWrapper();
    		
    		$f = wire('modules')->get('InputfieldText');
    		$f->attr('id+name', 'bgColor');
    		$f->attr('value', isset($data["bgColor"]) ? $data["bgColor"] : 'rgb(153, 12, 94)');
    		$f->label = wire()->_("Background Color");
    		$f->description = wire()->_("Background color for masthead (top bar)");
    		$inputfields->append($f);
    		
    		$f = wire('modules')->get('InputfieldText');
    		$f->attr('id+name', 'fgColor');
    		$f->attr('value', isset($data["fgColor"]) ? $data["fgColor"] : 'rgb(255, 255, 255)');
    		$f->label = wire()->_("Foreground Color");
    		$f->description = wire()->_("Background color for dev text (top bar)");
    		$inputfields->append($f);
    		
    		$f = wire('modules')->get('InputfieldText');
    		$f->attr('id+name', 'devString');
    		$f->attr('value', isset($data["devString"]) ? $data["devString"] : 'DEV');
    		$f->label = wire()->_("Prepend Text");
    		$f->description = wire()->_("Text to inject into the top bar");
    		$inputfields->append($f);
    		
    		$f = wire('modules')->get('InputfieldCheckbox');
    		$f->attr('id+name', 'devMode');
    		$f->attr('value', 1);
    		if(isset($data["devMode"]) && $data["devMode"]) $f->attr('checked', 'checked');
    		$f->label = wire()->_("Enable DEV mode");
    		$f->description = wire()->_("Check this box to enable DEV mode colors");
    		$f->notice = wire()->_('You can also set $config->devMode = true in site/ready.php instead');
    		$inputfields->append($f);
    		
    		return $inputfields;
    	}
    	
    }

     

     

    Wicked! If you happen to stick it up on github I'll use it for sure!

    • Like 1
  7. Thought I'd share this quickly as it helps me get to grips with whether I'm looking at the dev site or live site when working on any client project. Dev site only has AdminOnSteroids module. I add the below to sites/templates/admin/admin.css and add that url the admin css field in the module.

    Currently only works with default adminTheme.

    #masthead{
        background: rgb(153, 12, 94) !important;
    }
    #logo:before{
        content: 'DEV ';
        color: white;
        margin-right: 1em;
        vertical-align: middle;
        display: inline-block;
        font-size: 1em;
        letter-spacing: 0.05em;
        margin: -15px 0.6em 0em 0;
    }

    Simply adds a DEV string and changes the header color so I can see I'm on Dev not live. I guess you could do the opposite if you wanted adding content: "LIVE" instead in the CSS.

    1931868546_Screenshot2019-04-2310_48_43.thumb.png.2bf4887c9edade02c3b4fbb4c8be28bb.png

    • Like 8
  8. Not sure on my install path as I do it so many times i just do what works which is mostly dfault settings.

    I was able to add ? ? ? emoji's into my site field labels as show with no extra work. Which is pretty awesome.

    144343189_Screenshot2019-04-1014_33_08.thumb.png.97804cc46eb48c4535f792271b696778.png

  9. 13 minutes ago, szabesz said:

    By default regular expressions are case sensitive and in the warning only a-z is displayed and I guess Ryan wanted to make sure there can be no issues with these filenames when writing to a case sensitive filesystem.

    If this is the case then I'm a total idiot. Thanks!

    • Like 1
    • Haha 1
  10. Super confused, getting a error for this code to create a save message to log file:

    public function init() {
    	$log = $this->wire('log');
    	$log->save("MyModuleName","working");
    }

    Error: Exception: Log name must contain only [-_.a-z0-9] with no extension (in /srv/users/serverpilot/apps/betaville-dev/public/wire/core/WireLog.php line 167)

    Not sure how to fix this. Any help appreciated.
     

     

  11. 14 hours ago, szabesz said:

    I think Ben's "specification" is just somewhat vague so that is the source of our confusion. Anyway, Members Messaging can be either for frontend or PW's backend or even for both but in the latter case it would probably be practical to split the code among "submodules".

    Module was created to track date/time based messages between one or more users. That said it might be I could use it to create a new module that has an admin page that acts as a conversation between the logged in user and the admin or any other users.

    If you're looking for a less structured, freeform notes sort of collaboration thing then let me know and ill have a think.

    • Like 2
  12. @gbball which library? Like any CMS style thing, processwire makes it easy yo work with content and create content driven sites - including things like users etc. If you dont have much content that needs to be easily edited thennnnnnnn probably don't use a CMS ? If you do then totally use PW as your content engine and the template system to display content on a page that also houses your webGL etc

  13. get this warning and am unsure even with the nice warning what to do here, the links dont seem to help - want to set eh site to FR and not the whole server as it is a shared server:

    https://www.dropbox.com/s/dxtfcrt1eyg9t7o/Screenshot 2019-01-15 11.40.53.png?dl=0

    Warning: your server locale is undefined and may cause issues. Please translate the “C” locale setting for each language to the proper locale in /wire/modules/LanguageSupport/LanguageSupport.module (shortcuts provided below):
    • English
    • Française
    For example, the locale setting for US English might be: en_US.UTF-8

     

×
×
  • Create New...