InfyOm Blog

latest-post
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. 
Invalid date2 minutesuserVishal Ribdiya

Posts

post
We all know that human behavior is difficult to understand & explain yet we need to take care of our Human Capital to develop & maintain the productivity & profitability of the organization.

In the last blog, we have discussed what is Morale, Characteristics of Morale, Relation between morale and Productivity. Let’s  move further to-

   Factors determining morale
  Measurement of Morale: why ??

Factors Determining morale :    
 
  • Sound & Effective Organisation
  • Opportunity to rise 
  • Remuneration 
  • Personal attributes
  • satisfaction level
  • Supervision level
  • Nature of work


1-Organization-
 It may sound surprising but the Organisation Itself plays a significant role in shaping an employee's attitude. The NAME & FAME  of the Organisation plays vital roles to determine employee morale. The Reputation of the organization builds the attitude of their employee better or worse towards it... For Instance- Someone who works for Google is more likely to take ownership in comparison to the person who is working for a small XYZ software company.

2- Opportunity to rise- 
If the person found their personal growth within the organization, it boosts the morale of an employee. On the other side  no possibility of personal growth decrease Morale of the employee 

3-Personal attributes -
Physical and mental health also play a major role in determining employee Morale. If the person is not physically or mentally fit for a particular role, this can be an obstacle in learning and progress at the workplace It leads to low morale.

4-Remuneration- 
It's a vital factor to determine the level of employee morale, If the employee feels he/she discriminates based on pay scale it leads to dissatisfaction with the organization.

5-Satisfaction level-
If employees are satisfied with the Work role, there will be more energy in the system. Satisfaction arrived from various factors such as Company image, Pay scale, Working conditions, Growth opportunities, Welcoming attitude of new ideas, learning attitudes, Training, etc.

6- Supervision Level- 
The level of supervision received by an employee is a tremendous factor that affects morale. More the supervision, less the enthusiasm. No one likes a big boss over his/her head. Too much monitoring and supervision make people feel nervous and this hampers the performance rather than improving it.

7-Nature of work- 
The nature of work also plays a significant role in employee morale. If the work is repetitive or involve long working hours it affect employee morale negatively 


Measurement of Morale-

The big question is why we need to measure employee morale ???? 

The company depends on employees for Everything from production to accounting & finance (Profit & loss ). If they are happy, they perform their job more efficiently which upsurge the success of the business as well as profitability. On the other side, poor employee Morale can harm Business-dropping productivity and raising the turnover rate.
While running the business we should constantly pay attention to our employee morale to maintain the health of the organization.

While measuring Employee Morale we need to consider following things-

  • Ask the right question 
  • Don’t ask anything in annoying way
  • Follow the performance data first 
  • Take the employee of the clock 
  • Listen to what they say
  • Keep eye on their project 

Well, Employee morale is a broad concept. To know more about Employee Morale please read my upcoming blog…

In the next blog, we will see Measurement of employee morale, Significance of high morale, Demerits of low morale…..


December 11, 20203 minutesauthorMariyam Bemat
post
Most of the developers are facing select2 styles removing issue when livewire render the component.

We can resolve this issue by using a livewire javascript hook.

Here is my screen with select2 before livewire component rendering.
select2-after-renrering-livewire-component
select2-before-livewire-render.png 37.21 KB


And when the livewire component is refreshed means re-render the select2 style is gone ☹️

select2-after-renrering-livewire-component
select2-after-renrering-livewire-component.png 62.48 KB

How to Fix it ?? 🤔


Well you just need to add some JQuery code to your livewire component. here we are going to use afterDomUpdate webhook of livewire. add following code to your livewire component :


document.addEventListener('livewire:load', function (event) {
    window.livewire.hook('afterDomUpdate', () => {
        $('#select2ID').select2();
    });
});

livewire:load is listening events when livewire component is load and we can add our code within it.

And now when your livewire component is refreshed your select2 style will be still there as we are again applying it.


Other Livewire Posts :

Stay tuned to us for more interesting stuffs about livewire. 


December 11, 20201 minuteauthorVishal Ribdiya
post

Introduction

Increasing customer loyalty is a requirement of any organization. If a recurring project is found, the organization develops. Do not require to generate new leads. The cycle of the company runs from the existing customer and scales the company.

1. Keep in touch

Keep in touch with each client every few months to make sure everything goes smoothly. During a class or meeting, ask about your client's challenges. Issues you can resolve. They are more likely to turn to you when they need you.

2. Create high-quality software

One of the best ways to keep customers coming back is to always develop high-quality software. You can do this by meeting the expectations of your customers and also by making sure that they are satisfied with your work. Help your customers save money and get rid of waste, ultimately deliver huge profits for them, and possibly do more business for you.

3. Listen carefully when your customers are speaking to you

Try to give your customers your undivided attention. Multi-tasking is often. When customers are in front of you, make eye contact.

4. Collaborate with clients

To ensure quality in the software you develop and keep your customers happy, you should encourage collaboration with your clients. Meet with them and ask questions so you can fully understand use cases for the software you are developing. Bring new ideas to make suggestions on how to make improvements.

5. Demonstrate time management skills

Tracking time is also key to the success of a project, you should be able to provide detailed reports to your clients for the time spent on their particular projects. They’ll be more likely to hire you again if they see you’re organized and working efficiently.

6. Keep your promises to your customers

When you tell your customer you are going to do something, follow-up as quickly as possible. Given the time frames and honor them.

7. Don’t waste your customers’ time

Everyone is busy. Complicated voice mail systems, making customers repeat their service requests more than once and un-knowledgeable employees are some major time-wasters. A customer’s time is as important as your time!

8. Ask your customers what they want

Constantly ask your customers what you can do for them and how you can do it better. They want extended hours, academic classes, or the ability to talk to the manager. After you ask, try to give them what they want and keep them informed of the process along the way.

We will see more points in our next tutorial.

December 10, 20202 minutesauthorAnkit Kalathiya
post

You must be thinking what is a webhook? Where it is used? What is the usage of it? And the most important why it’s used?

Webhooks are automated services, it is a way that the app can send automated messages or information to our system.

When something happens in the system then this service is fire and our system caches those services and can do according to changes in our system.

Let’s take an example of a stripe webhook

We have integrated Stripe payment gateway, we have according to payment fields in our system’s database. When our system user do the payment in stripe at that time payment is done in stripe, but now how will our system get to know about the customer has do payment or not?

When customer complete payment in stripe, it will send service(webhook) to our system which has information about customer payment detail, our system will cache this service, then our system will find that user in our system and if found then we can do payment changes in our customer detail.

November 28, 20201 MinutesauthorMonika Vaghasiya
post
After doing all the right things to boost productivity and still employees' productivity plunging or not increasing, we need to look at the Employee Morale. employee Morale is a decisive factor in an Organisation whether it is the Service sector or Manufacturing unit. It is one of the cornerstones of the business, only a few organizations pay attention to morale among employees in their organization and this is the major mistake from their side as it affects productivity which ultimately reflects in Organizational Growth & Productivity.

Let’s Discuss:

  • What’s Employee Morale?
  • Characteristics of Employee Morale.
  • Relation between Morale & Productivity.
What is Employee Morale ?

In simple terms employee morale is the standard of behavior of an employee which directly affects the productivity of the organization but it is a complex concept as there are ample factors that affect employee morale.

Definition :

Edwin Flippo : “ Morale is a mental condition or attitude of individual and groups which determines their willingness to cooperate”

Characteristics :

  • Psychological concept
  • Dynamic Nature
  • Group phenomenon
  • Reflect others
Psychological Concept:

Morale is the psychological phenomenon, it is the internal feeling of confidence, attitude, Zest, enthusiasm, satisfaction, etc. Moreover, it is the state of mind and emotions affecting the attitude and willingness to work that affect individual and organizational objectives.

Dynamic Nature:

Morale is Dynamic in nature; we cannot develop it overnight. Management has to make continuous efforts to build and maintain high morale among employees in the organization. It is a long term concept.

Group Phenomenon:

Morale is not an individual phenomenon but it's the sum of the total employee’s attitude, feelings, and sentiments.

Reflect others:

We cannot measure morale directly but it is reflected in productivity, discipline, turnover, etc. To measure morale we need to look at other factors.

Relations between Morale and Productivity:

Davis Designed that there is not always a positive link between Productivity and Employee morale. There can be four combinations of Morale and Productivity

1. High morale-High productivity

This situation is likely to occur when the employees are fully motivated to achieve high performance not only this but satisfied with all financial & nonfinancial rewards & highly satisfied with their job role. Feeling proud to be part of the organization/team.

2. High morale-low productivity

This situation occurs when the employees waste their time in the workplace or use the time to satisfy their personal goals. They don't care about organizational goals. There are many factors responsible for this kind of Employee Attitude in the workplace such as-

  1. lack of proper training,
  2. Lack of support by co-workers or leader,
  3. leaders/Superior behavior with him,
  4. Irresponsible Management (If we talk about It or another small service sector Irresponsible HR )
  5. Ineffective Supervision
  6. Restrictive norms of the informal group
  7. Outdated Technology & Methods
3.Low morale-High productivity

In a short period, it may be possible that with low morale Employee's productivity seems high but it is for a temporary or short span of time. Low Morale can not result in high productivity for a long time. this situation occurs when

  1. fear of losing a job,
  2. less availability of alternatives
  3. Strict Supervision, Rules & Regulations
  4. Punishment
  5. Policies and strategies focus on high productivity only.
4. Low morale-Low productivity

This situation occurs when the organizational & individual both goals are not satisfied & other factors like

  1. Lack of motivation
  2. Unclear Job role
  3. Lack of harmonious Superior-Subordinate relationship
These all factors result in frustration, tension and grievances develop against managers which reflect low productivity To pen down, morale is the paramount factor that gives a direct impact on productivity, Productivity impact on profitability, profitability impact on organizational growth. If the Morale is high then it will be possible to gain more fruits in the future but if it's low than it's Red Signal for any organization even the productivity is high but it will be for a short period of time only

I am not going to end the topic of Morale but will continue in the next blog with -

  1. Factor determining morale
  2. Significance of high morale
  3. Impact of low morale
  4. Measurement of morale
To know about these please read my upcoming blogs of Human Resource…..

November 28, 20203 minutesauthorMariyam Bemat
post
Software testing is a process of checking and validating the functionality of an application to determine if it meets specified requirements. It is about finding application faults and verifying where the application is operating according to the end-user needs.

Important Software Testing Techniques:-

  • Boundary Value Analysis (BVA)
  • Equivalence Class Partitioning
  • Decision Table based testing.
  • State Transition
  • Error Guessing
  • Boundary Value Analysis (BVA)
  1. The marginal cost assessment is based entirely on trying the boundaries between partitions. It includes maximum, minimum, internal or external barriers, typical values, and error values. It is generally seen that numerous errors occur at the obstacles of the defined input values as opposed to the center.
  2. It is also known as BVA and offers a selection of test entities that train limit values. This black container test method improves equivalence partitioning. This software program trying one approach is based on the principle that if a machine works well for these exact values, it will paint error-free for all values that are between the two limits.
Let's see one example:

Input condition is valid between 1 and 10 Boundary values 0,1,2 and 9,10,11

Equivalence Class Partitioning

The equal class phase lets you divide a hard and fast of check states into separate sections which are taken into consideration identical. The equal class division software program test technique breaks the input area of a program into a class of information, so a test case has to be designed.

Let’s see one example:

Input conditions are valid between

1 to 10 and 20 to 30

Hence, there are five equivalence classes

--- to 0 (invalid)

1 to 10 (valid)

11 to 19 (invalid)

20 to 30 (valid)

31 to --- (invalid)

You select values from each class, i.e.,

-2, 3, 15, 25, 45

Decision Table Based Testing

The decision table is known as the cause and effect table. This testing technique is suitable for input features that have a logical relationship between inputs. In this technique, combinations of inputs are processed. In order to identify the test case with the decision table, it is necessary to consider the terms, actions, and procedures. Conditions are taken as input and actions as output.

Testing Using The Decision Table In The Login Form


CONDITIONS CASE 1 CASE 2 CASE 3 CASE 3
| EMAIL  | F  | T  | F  | T
| PASSWORD  | F  | F  | T  | T
| OUTPUT  | ERROR  | ERROR  | ERROR  | HOME SCREEN

CASE 1: Email And Password Wrong: Error Message Displayed.

CASE 2: Email True And Password Wrong, Error Message Displayed.

CASE 3: Email Wrong And Password True, Error Message Displayed.

CASE 4: Email And Password True, Redirect to Home screen

State Transition Testing Technique

In-State Transition technique changes in input conditions change the state of the Application Under Test (AUT). This testing technique allows the tester to test the behavior of an AUT. The tester can perform this action by entering various input conditions in a sequence. In-State transition technique, the testing team provides positive as well as negative input test values for evaluating the system behavior.

Presently We Make A Diagram For Forgot Password/OTP Proces

  1. First Enter Right Number In This Text Box and Click RESET PASSWORD Button. One OTP Comes On Mobile Number.
  2. To reset the secret word should experience the "OTP" framework. The first run through the client enters the right "OTP", they will be permitted to go to the secret phrase change page.
  3. In the event that the client enters mistaken "OTP" unexpectedly and second, the framework will request the third time "OTP" is entered.
  4. In the event that "OTP" is valid, it will be permitted to go to the secret phrase change page, in any case, if the OTP is off base the third time, Error Message Displayed Like "Your OTP has been expired!!".
State Transition Table


ATTEMPT CORRECT PIN INCORRECT PIN
| [B1] Start  | B5  | B2
| [B2] First attempt  | B5  | B3
| [B3] Second attempt  | B5  | B4
| [B4] third attempt  | B5  | B4
| [B5] Access granted  | -  | -
| [B6] Account blocked  | -  | -
Error Guessing Technique

Error guessing is a software testing technique based on guessing the error that can appear in the code. The technique relies heavily on experience, with the test analysts using their experience to guess the problematic part of the test application. Therefore, test analysts need to be competent and experienced in order to better guess errors. The technique counts a list of possible errors or error-prone situations. Then the tester writes a test case to uncover these errors. To design test cases based on this software testing technique, the analyst can use the experience to identify the conditions.

This technique can be used at any level of testing and for testing the common mistakes like:

  • Divide by zero
  • Inserting blanks in text fields
  • Pressing the enter button without entering values
  • Uploading files that exceed the maximum limits
  • Exception null pointer.
  • Invalid parameters
Let’s see one example:

Suppose there is a requirement that the phone number be numeric and not less than 10 characters. And the software application has a phone number.

The following are the error estimation techniques:

  1. What will be the result if the cellphone number is left blank?
  2. What is the result if a character other than a digit is entered?
  3. What is the result if fewer than 10 digits are entered?
November 28, 20204 minutesauthorBhumi Khimani
post
We work on projects with the admin panel every day. In which we mostly use data tables and we need to delete the record from the data table without page refresh.

So, today I will show you how to extract a record using Ajax. It's very easy to integrate.

Let take one example. I have a Category data table and I want to delete one category from the table without refresh the page. now, what am I doing for that? first of all, I add a class for the listen to a click event into the delete button and it's says delete-btn. 

See the following image for where I added a class.

I used SweetAlert for the confirmation popup. let add sweet alert's CSN into the index.blade.php.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
let's declare routes of the delete record.

<script>
       let categoryUrl = '{{route('categories.index')}}';
</script>
next steps, I going to listen to the click event of the delete button. one more thing does not forget to add the record id into the data attribute to the delete button. see the above image for it. I highlighted with a yellow line.

So the general practices we use in Laravel is to write the following code to listen to a click event and delete a record,

$(document).on('click', '.delete-btn', function (event) {
            const id = $(event.currentTarget).data('id');
            swal({
                    title: 'Delete !',
                    text: 'Are you sure you want to delete this Category" ?',
                    type: 'warning',
                    showCancelButton: true,
                    closeOnConfirm: false,
                    showLoaderOnConfirm: true,
                    confirmButtonColor: '#5cb85c',
                    cancelButtonColor: '#d33',
                    cancelButtonText: 'No',
                    confirmButtonText: 'Yes',
                },
                function () {
                    $.ajax({
                url: categoryUrl + '/' + id,
                type: 'DELETE',
                DataType: 'json',
                data:{"_token": "{{ csrf_token() }}"},
                success: function(response){
                    swal({
                                title: 'Deleted!',
                                text: 'Category has been deleted.',
                                type: 'success',
                                timer: 2000,
                            });
                    $('#categoryTbl').DataTable().ajax.reload(null, false);
                },
                error: function(error){
                    swal({
                                title: 'Error!',
                                text: error.responseJSON.message,
                                type: 'error',
                                timer: 5000,
                            })    
                }
            });
                });
        });
Now we are done with the front-end side and need to look into it backend side. 

Let's declare the destroy method into the category Controller. I hope are you generate crud with InfyOm Laravel Generator. so, the Destroy method and routes are there. if not please create a route. if the destroy method is there then need to change the response of that method.

The destroy method code looks like,

 public function destroy($id)
    {
        $category = $this->categoryRepository->find($id);

        if (empty($category)) {
            Flash::error('Category not found');

            return $this->sendError('Category not found.');
        }

        $this->categoryRepository->delete($id);

        return $this->sendSuccess('Category deleted successfully.');
    }
Now we are done. the video tutorial also available here

November 26, 20202 minutesauthorShailesh Ladumor
post
  • Developer use API calling retrofit, volley JSON or other tools but API response check-in postman time confusion how to creating this response model class
  • So a friend in this topic I will try your confusion remove flow below all steps and 5 min inner creating a wonderful model class
Step: 1 Android studio in install "RoboPOJOGenerator"

  • Location in the android studio:
  1. Open android studio
  2. Go to File
  3. Go to Setting
  4. Click plugin
  • check the below image && click and install RoboPOJOGenerator then your android studio restart
Step: 2 How to open RoboPOJOGenerator

  1. Open android studio
  2. Go to File
  3. Select directory below the image in showing related select any one directory
  4. Right-click - select New - then below showing "RoboPOJOGenerator"
Step: 3 How to add postman response

  1. Postman response copy
  2. Paste this response in "RoboPOJOGenerator" in one black color dialog showing in android studio
  3. Left top side one cursor visible on this area in paste this response
  4. Select "GSON" option in "RoboPOJOGenerator"
  5. Last click generate button after a few moments your model class is ready
November 26, 20201 minuteauthorPankaj Valani