How to do Payments with Stripe Checkout using Laravel

How to do Payments with Stripe Checkout using Laravel

https://ift.tt/39jRaIt


Payments gateways are very useful components of any e-commerce store. One of the popular payment gateways is Stripe. it’s becoming more popular nowadays. 

Stripe’s simple definition is : 

We bring together everything that’s required to build websites and apps that accept payments and send payouts globally. Stripe’s products power payments for online and in-person retailers, subscription businesses, software platforms and marketplaces, and everything in between.  ~ Stripe

To begin this laravel tutorial, I hope you already have fresh laravel repo.

Stripe Configuration with Laravel

Run the following command to install stripe :

composer require stripe/stripe-php

if you don’t have a Stripe account, you’ll want to set that up and add your API keys. Add the following to your .env file.

STRIPE_KEY=your-stripe-key
STRIPE_SECRET=your-stripe-secret

Publish Migrations Files From Stripe

php artisan vendor:publish --tag="cashier-migrations" 

And Run migrations by hitting the following command

php artisan migrate 

Setup Stripe Controller

Now create a stripe controller by hitting the following command:

php artisan make:controller StripeController
namespace App\Http\Controllers;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Stripe\Checkout\Session;
use Stripe\Exception\ApiErrorException;
/**
 * Class FeaturedCompanySubscriptionController
 */
class StripeControlle extends AppBaseController
{
    public function createSession(Request $request)
    {
        setStripeApiKey();
        $session = Session::create([
            'payment_method_types' => ['card'],
            'customer_email'       => $userEmail,
            'line_items'           => [
                [
                    'price_data'  => [
                        'product_data' => [
                            'name' => 'Make '.$company->user->first_name.' as featured Company',
                        ],
                        'unit_amount'  => 100 * 100,
                        'currency'     => 'USD',
                    ],
                    'quantity'    => 1,
                    'description' => '',
                ],
            ],
            'client_reference_id'  => '1234',
            'mode'                 => 'payment',
            'success_url'          => url('payment-success').'?session_id={CHECKOUT_SESSION_ID}',
            'cancel_url'           => url('failed-payment?error=payment_cancelled'),
        ]);
        $result = [
            'sessionId' => $session['id'],
        ];
        return $this->sendResponse($result, 'Session created successfully.');
    }
    public function paymentSuccess(Request $request)
    {
        $sessionId = $request->get('session_id');
        // 
    }
   
    public function handleFailedPayment()
    {
        // 
    }
}

Define Routes

    Route::post('stripe-charge', 'StripeController@createSession');
    Route::get('payment-success', 'StripeController@paymentSuccess');
    Route::get('failed-payment',  'StripeController@handleFailedPayment');

Setup From View file

Here we are going to create stripe session from backend and redirect to stripe checkout page once we will receive the sessionId from backend.

Assume that makePaymentURL is something like “APP_URL/stripe-charge”.

Now let’s say when you hit the submit form of stripe it will call MakePaymentURL and that URL returns your session ID which we will use to redirect to the stripe checkout page. 

 $(document).on('click', '#makePayment', function () {
           
        $(this).addClass('disabled');
        $.post(makePaymentURL, payloadData).done((result) => {
            let sessionId = result.data.sessionId;
            stripe.redirectToCheckout({
                sessionId: sessionId,
            }).then(function (result) {
                $(this).html('Make Featured').removeClass('disabled');
                manageAjaxErrors(result);
            });
        }).catch(error => {
            $(this).html('Make Featured').removeClass('disabled');
            manageAjaxErrors(error);
        });
    });

That’s it, after entering proper details into stripe you will get a success callback to a related route, where you can perform related actions. 

programming

via Laravel News Links https://ift.tt/2dvygAJ

January 25, 2021 at 03:05PM

Top 10 Best Selenium Cheat Sheets.

Top 10 Best Selenium Cheat Sheets.

https://ift.tt/399YVAx

Hey Finxters! I am back to write another top 10 cheat sheets for Python with libraries, open-source and frames that can be used with it.

Today, we are going to discuss Selenium Cheat Sheets used in Python.

To better explain, Selenium is an open-source web-based automation tool that allows you to test your web application in various ways including permit it to tap buttons or enter the content in structures. It is also a powerful tool for controlling web browser through programs and automation. I hope that you find these cheat sheets useful, tape them to your wall and study them as you work on your portfolio projects.

Without further ado, let us dive right into Selenium and the cheat sheets we need to learn it.

Cheat Sheet 1: GeeksforGeeks

This tutorial will get you started in Selenium and Python. It starts off with a table of contents to get you through the basics to more advanced methods, then followed by two tables, Selenium Web Drivers and Selenium Web Elements to help get you started on what you can expect.

Pros: Rated ‘E’ for everyone. Perfect for if you are just starting out.

Cons: None that I can see.

Cheat Sheet 2: CPPBuzz

Though this cheat sheet uses examples in Java, it does go through the various commonly used methods in Selenium for web browser manipulations. From loading a webpage to finding an element by XPath. This cheat sheet is great for beginners wanting to understand Selenium and all of the languages it supports.

Pros: Rated ‘E’ for everyone. These commonly used methods are subject to be used on almost every project so be sure to pin this one to the wall.

Cons: None that I can see.

Cheat Sheet 3: STM (Software Testing Material)

This cheat sheet is specifically designed for common exceptions for Selenium, and how to handle them. It will give you a list of exceptions and their definitions on what each error is, as well as each case they might occur. Honestly, take the time to highlight this cheat sheet before taping it to the wall. This cheat sheet is going to be your best friend when learning exceptions in Selenium.

Pros: Rated ‘E’ for everyone.

Cons: None that I can see.

Cheat Sheet 4: DZone RefCards

This cheat sheet will teach you all about Selenium. While it claims to have everything, you need to know about Selenium, I cannot confirm that. What I can confirm is that it is perfect for beginners and intermediate developers to learn Selenium with. From what it is all about to how to install. This cheat sheet will take you through the basics of what you need to learn. The only way to get better is to practice though! Keep it handy nearby as you go through Selenium.

Pros: Rated ‘E’ for everyone.

Cons: None that I can see.

Cheat Sheet 5: Automate the Planet

This cheat sheet is a collection of the ‘most exhaustive’ list of web driver locators. Even though it says its for C#, understand that Selenium can be used for many languages including Python, without its commands changing from language to language. It lists default methods and attributes, complete XPath Locators, and complete CSS selectors.

Pros: Rated ‘E’ for everyone. It is a good list to keep handy when working in Selenium.

Cons: None that I can see.

Cheat Sheet 6: All Selenium

This cheat sheet uses the most frequently used Selenium and Python. It will give you clear instructions for Auto downloading, locating elements, and reading browser details. It has a list of Python Selenium commands for operations on elements including code snippets so you can if you are doing it right. It specifically works in Python for those who are just starting to learn Selenium with Python.

Pros: Rated ‘E’ for everyone.

Cons: None that I can see.

Cheat Sheet 7: Intellipaat

Intellipaat is another on of those website I visit frequently for information and cheat sheets. This cheat sheet is for Selenium, it will show you the commands neatly separated and listed. It lets you know what each command is and what to write when using the method. It does not show you code examples, but it is one you would want to keep handy, taped to the wall.

Pros: Rated ‘E’ for everyone. By far, the easiest one to understand and implement.

Cons: None that I can see, though it does not have code snippets.

Cheat Sheet 8: Codoid

This cheat sheet is again for Python and WebDriver commands. These are helpful when learning to automate web application testing. It will teach you to install, maximize and minimize the windows, switching between frames and cookies. This is another great cheat sheet to have handy taped to the wall.

Pros: Rated ‘E’ for everyone. It is very clear on how to run each command.

Cons: None that I can see.

Cheat Sheet 9: Cheatography

Cheatography is another website I like to visit when I need any cheat sheet that is easily readable, and I can hang up on the wall for accessibility. This is another Selenium cheat sheet I would say is great way for testing yourself. It offers definitions, but not the actual code to write the method.

Pros: Easy to read, great for testing yourself on various definitions on Selenium.

Cons: For the intermediate developer, it offers no code methods.

Cheat Sheet 10: TechCanvass

While not exactly a cheat sheet, it is a perfect beginners guide to Selenium and offers tutorials on Selenium in Java. The nice thing is the commands do not change much from language to language. So, you will be able to convert it to your language of choice. This is the perfect way to get started.

Pros: Rated ‘E’ for everyone. Perfect beginner’s tutorial.

Cons: None that I can see.

Thank you once again for coming along on this journey with me to find the best Selenium cheat sheets on the web. Tape these to your wall or keep them in a handy reference notebook on the desk when you are working. I hope you find these articles informative and useful as you continue your journey in Python!

The post Top 10 Best Selenium Cheat Sheets. first appeared on Finxter.

Python

via Finxter https://ift.tt/2HRc2LV

January 22, 2021 at 10:17AM

AR 15 Magazine Faceoff: Best of the Best

AR 15 Magazine Faceoff: Best of the Best

https://ift.tt/39PazzU


Somewhere in the deepest parts of the dark web, there’s a conspiracy afoot. Sewing division, and tearing families apart, the war of the AR 15 Magazine rages on, and it’s not what we think. This isn’t the fight over what makes a high capacity magazine, but over which one is the best. The factions are fuzzy, sometimes blending between polymer and metal construction, other times relying on reputation and history, but the truth about what makes an excellent AR 15 Magazine has to come out, and it’s not for the faint of heart.

We concern ourselves with features such as construction, capacity, cost, and compatibility. The evaluations, however, focus on reliability over time, in harsh environments, and durability, as well as subjective matters including aesthetic and feel. The features can typically be gleaned from the manufacturer’s website, the evaluation, however, cannot.

ar 15 magazine face off

Each has its purpose. Each has its place.

Magpul PMAG

Construction: Reinforced Polymer
Capacity: 10/20/30/40 rounds
Colors: Black, Brown, and Irregular Releases
Cost: ~$12-18 depending on the model, and bulk orders.
Compatibility:

  • Gen 2: Colt-STANAG,
  • Gen 3: STANAG + HK416, FN SCAR MK16, British SA-80
  • Specific Magazines for 300 Blackout

    magpul lineup ar 15 magazine

    Left to Right: D60 Drum, GEN M3 40 Round, GEN M2 30 Round, GEN M2 30 Round Windowed, GEN M3 30 Round PMAG

The reigning champion of polymer AR15 magazines holds its throne, not only because it has seen war and come home to tell about it, but continues to fit both the needs of the many and the needs of the few. Having improved their initial design to the current standard of 3rd Generation PMAGS, the list includes options for capacity and caliber-specific models. Early to identify the need for a 300 Blackout specific magazine, for both differentiating from mags loaded with .223/5.56 and specifically identifying feed issues specific to the caliber, Magpul continues to fit a niche, even when it has long defined a genre.

magpul d60 pmag

The motive behind creating a polymer AR 15 Magazine isn’t as simple and one single choice. Aluminum magazines suffered from bent feed lips for years, and instead of bending, the polymer would simply break, leaving nothing to chance. Polymer could survive and continue in extreme environments where aluminum would shrink and expand depending on the temperature. By manufacturing AR 15 magazines through injection molding, Magpul achieved a disassemblable magazine without the bulk needed with aluminum construction.

Make no mistake, however, PMAGS are made to last as long as possible, but also have a disposable element. An out of spec PMAG should be broken or cracked, relieving the user of having to look for small bends. At the same time, as a testimony to their durability, many remain in use after decades of deployments and competitive abuse.

Website: www.magpul.com

Daniel Defense

Construction: Carbon Fiber Reinforced Polymer
Capacity: 32 rounds
Colors: Black
Cost: ~$19
Compatibility: 5.56 and 300 Blackout

daniel defense ar 15 magazine

John Lovell of Warrior Poet Society once nearly broke the internet when he suggested that a 30 round AR 15 magazine should only be loaded to 28 or 29 rounds. This practice originated in the military to make seating a magazine easier and more reliable on a closed bolt under stress, so it’s not surprising that when Daniel Defense came out with their own magazine, they set their capacity at 32. Further, they took inspiration from many other magazine accessories common across military and competitive scenes with aggressive texturing and a looped baseplate.

Unlike PMAGs, Daniel Defense Magazines come in one format, and one format only. Both 300 Blackout and .223/5.56 rounds reliably cycle, which makes them a good candidate to add to an already existing stockpile to consistently differentiate between magazines loaded with the caliber.

Website: www.danieldefense.com

Where to Buy: When In Stock, $19 at Gun Mag Warehouse, $22 at Brownell’s, and $22 from Daniel Defense.

Lancer AR 15 Magazine

Construction: Polymer Body with Hardened Steel Feed Lips
Capacity: 5, 10, 20, 30 round options.
Colors: Black, Flat Dark Earth, Clear, Smoke, Translucent Red, Translucent Flat Dark Earth, and other special releases.
Cost: ~$16
Compatibility: .223/5.56 with specific options for 300 Blackout
Additional Features: Couplers Available

lancer ar 15 magazine

Lancer Systems took the strengths of both metal and polymer magazines and combined them in order to produce a hybrid that combats the weakness of both. The hardened steel feed lips resist distortion better than aluminum and don’t crack like polymer. The lightweight body can be molded for a better grip. Whether for the tactical ability to check rounds or for the Instagram, or to differentiate between mags loaded with 300 Blackout or 2.23/.556, polymer has quickly become the new normal in magazine construction.

lancer systems magazines

Lancer mags come with a suite of useful features. Other than having a long and constantly changing list of color options, Lancer AR 15 Magazines come in different capacities and have propriety couplers for those so inclined. The texture resembles some chequering seen on pistol grips and provides a secure hold when cold and wet while ridges serve as round count indicators with markers at 30 and 20 rounds. Compared to a PMAG, Lancer Mags are a little thinner and slightly closer in dimension to their aluminum predecessors.

URL: https://lancer-systems.com/

Strike Industries AR 15 Magazine

Construction: Glass Reinforced Polymer
Capacity: 32 rounds
Colors: Black
Cost: ~$17
Compatibility: .223/5.56

strike industries ar 15 magazine

Similar to Daniel Defense Magazines, the Strike Industries AR 15 Magazine has a capacity of 32 for spring tension. Following their style, it has both aggressive texturing and a slight cyberpunk aesthetic. It’s not all show, as the front and back of the AR 15 Magazine feature the most abrasive surface, leaving the sides slicker to avoid rubbing holes in gear or dragging during a reload.

Strike Industries took extra care in designing their feed ramp, for a secure first-round chambering. Though they are a new player on the AR 15 Magazine field, it is yet to see where they will land, although the pool is large and the demand high. A small but distinguishing feature is the thumb bump on the back spine. Acting as a reference point, it serves as a repeatable spot to index the thumb, especially when drawing from a chest rig or plate carrier. Those familiar with efficiently reloading under Night Vision will immediately relate to this small advantage.

Where to Buy and URL: https://www.strikeindustries.com/si-ar-mag.html

STANAG // GI

Construction: Aluminum or Steel
Capacity: 5, 10, 20, 30, 40 rounds.
Colors: If you can imagine it, someone probably sells it somewhere.
Cost: ~$12-35
Compatibility: Variations are to be expected. STANAG will want to be individually tested for 300 Blackout.

aluminum ar 15 magazine

As it stands, aluminum magazines are a world of their own. Variations between companies require a little investigation to determine what the markings truly mean. Like forged AR-15 Lowers, at some point many were made in the same factory, but that does not mean all aluminum magazines are created equal. Derived from the NATO term Standardization Agreement, STANAG pattern magazines are supposed to be able to fit and operate in any firearm designed to the specifications.

ar 15 magazine baseplate

Image enhanced to identify the variety of manufacturers.

There appears, from the outset, to be two different discussions when it comes to aluminum AR 15 Magazines. First, there are the aluminum-versus-polymer wars, which occasionally resemble the old 9mm versus .45 days of yore. Within the aluminum magazine purists, however, you will find another conflict. Which manufacturers are considered worthy, and which should be avoided?

war magazines

I tell by that look on your face, you’ve seen a lot kid. Top: Magpul Windowed PMAG GEN M2. Bottom: Geniune Colt Mag from who knows when. Both saw combat.

Aluminum magazines differ from polymer, in that their feed lips will bend when plastic will break. This double-edged sword renders polymer magazines disposable, while aluminum AR 15 Mags require maintenance. With routine inspection and regular tuning, aluminum magazines can last for decades and across multiple conflicts. In contrast, however, a bent feed lip can cause malfunctions and Murphy’s Law doesn’t play fair. Those who have carried a firearm professionally have long attested to the importance of magazine maintenance.


Drum AR 15 Magazine Options:

The AR 15 Drum Magazine has seen a renaissance in recent years and directly challenges the higher capacity box style magazines for capacity and reliability.

Magpul D60

Construction: Reinforced Polymer
Capacity: 60 rounds
Colors: Black
Cost: ~$125
Compatibility: 2.23/.556 only

ar 15 magazine drum magpul d60

For years, capacity has always had its drawbacks and it has long been either reliability or weight. Since much of the weight is derived from the ammunition carried, one can only make a 60 round AR 15 magazine so light. The greater challenge of reliability includes not only adverse environments, but drop tests and feeding consistencies. The Magpul D60 moves away from the box style magazine to bring the increased reliability of a drum, and the cost of size and weight.

magpul d60 round count

Round after round, the Magpul D60 Ar 15 Magazine continues to chew our ammunition stores and in turn, ammo budget. On top of regularly feeding .223 and 5.56 ammunition, the Magpul D60 also boasts something not always common in drum magazines: it’s user servicable. Magpul recommends that the drum be cleaned and lightly oiled every 1000 rounds, which, if we’re tracking that round count, speaks for itself.

magpul d60 versus pmag 30 round gen 3

There’s no way to escape the weight of a fully loaded 60 round drum. Though difficult to store on a plate carrier or belt, D60’s find their place in both defensive and competitive uses. A round count window on the rear of  drum informs the shooter when the drum is full and when 10 rounds remain.


More on AR-15’s and Magazines

guns

via Recoil https://ift.tt/2ycx5TA

January 21, 2021 at 11:11PM

F**k Mayor Pete

F**k Mayor Pete

https://ift.tt/2LK6NzX

Mayor Pete Buttigieg is going through his confirmation hearing in the Senate to be Secretary of Transportation.

His qualifications is that he had anonymous sexual encounters in airport men’s rooms got engaged an an airport terminal.

As I mentioned earlier, Biden issued an executive order killing the Keystone XL pipeline and wants to end leases drilling on public land in Alaska.

Gas will hit $5 per gallon, devastating the economy, enriching Arab terrorist states, and making us dependent on foreign oil again.

This idea is such a shit idea that it’s pissed off the Canadian Prime Minister.

This will cost this country billions of dollars and thousands of jobs.

Little Lord Pete was asked about this and said this:

What the actually fuck!!!

Oil line work is good paying work.

What the fuck are welders, pipefitters, and other guys used to making $30+ per hour plus overtime going to do?  Become Walmart greeters?

These are valuable skills and needed jobs. Thar is until the Government comes in and fucks people over.

The fuck is wrong with Pete.

I’ll tell you.

He’s a piece of shit motherfucker that cut his teeth at McKinsey and Co. which is the birthplace of the corporate “fuck the working man, outsource his job so the CEO can get a bonus” business consulting.

Now he’s doing the same fucking thing, not for some assfuck CEO but to benefit the human fucking garbage at the Climate Change Industrial Complex.

This guy built his career fucking over the working man and he’s doing that again.

That’s his qualification.  His job isn’t to improve the economy through efficient transportation and good transportation energy policy.  His job is to fuck working and middle class people out of their jobs so a handful of people (green energy execs and investors) can get filthy fucking rich.

When you think about it like that, he’s eminently qualified.

 

guns

via https://gunfreezone.net

January 21, 2021 at 03:25PM

‘Nobody’ May Be the Movie America Needs Most Right Now

‘Nobody’ May Be the Movie America Needs Most Right Now

https://ift.tt/3nZ2PQY


 

Please be aware…the red band trailer above is definitely NSFW.

Now that that’s out of the way, ‘Nobody,’ appears to be a cross between ‘John Wick’ and ‘Death Wish’ starring Saul Goodman Bob Odenkirk as a put-upon suburban dad. The good news is the ‘Nobody’ villains only steal his daughter’s kitty cat bracelet…no puppies were harmed in the making of this shoot-em-up.

As Rotten Tomatoes summarizes the plot . . .

Hutch Mansell, (is) an underestimated and overlooked dad and husband, taking life’s indignities on the chin and never pushing back. A nobody. When two thieves break into his suburban home one night, Hutch declines to defend himself or his family, hoping to prevent serious violence. His teenage son, Blake (Gage Munroe, The Shack), is disappointed in him and his wife, Becca (Connie Nielsen, Wonder Woman), seems to pull only further away.

The aftermath of the incident strikes a match to Hutch’s long-simmering rage, triggering dormant instincts and propelling him on a brutal path that will surface dark secrets and lethal skills. In a barrage of fists, gunfire and squealing tires, Hutch must save his family from a dangerous adversary (famed Russian actor Aleksey Serebryakov, Amazon’s McMafia)–and ensure that he will never be underestimated as a nobody again.

In other words, ‘Nobody’ is 92 minutes packed with lots of bad guys getting kilt and blowed up. The Ilya Naishuller action flick, like 1974’s ‘Death Wish’ before it, appears to tap into America’s prevailing national sense of concern about rising crime, civil unrest, defunded police departments and prosecutors who don’t prosecute criminals.

Expect today’s critics to be about as receptive to ‘Nobody’ as they were to its predecessor. But like Death Wish (both the original and the 2018 remake), look for audiences to be far more enthusiastic than the critics as ‘Nobody’ looks like it features lots of good, wholesome ballistic entertainment…and who can’t use more of that these days?

 

guns

via The Truth About Guns https://ift.tt/1TozHfp

January 21, 2021 at 01:01PM