Code Duplication    Length = 21-28 lines in 2 locations

app/Http/Controllers/CartController.php 1 location

@@ 108-135 (lines=28) @@
105
    /**
106
     * Done
107
     */
108
    public function done(Request $request){
109
110
        //je recupere les informations de retour de Paypal
111
        $id = $request->get('paymentId');
112
        $token = $request->get('token');
113
        $payer_id = $request->get('PayerID');
114
115
        $payment = PayPal::getById($id, $this->_apiContext);
116
117
        $paymentExecution = PayPal::PaymentExecution();
118
119
        //execution du paiment a partir du Payer
120
        //Requete à Paypal: débit du montant de a transaction au Payer
121
        $paymentExecution->setPayerId($payer_id);
122
        $executePayment = $payment->execute($paymentExecution, $this->_apiContext);
123
124
        // Clear the shopping cart,
125
        $request->session()->pull('likes', []);
126
127
        // Write database
128
129
130
131
132
        // Thank the user for the purchase
133
        return view('Cart/success');
134
135
    }
136
137
138
    /**

app/Http/Controllers/MainController.php 1 location

@@ 70-90 (lines=21) @@
67
68
69
70
    public function done(Request $request)
71
    {
72
        $id = $request->get('paymentId');
73
        $token = $request->get('token');
74
        $payer_id = $request->get('PayerID');
75
76
        $payment = PayPal::getById($id, $this->_apiContext);
77
78
        $paymentExecution = PayPal::PaymentExecution();
79
80
        $paymentExecution->setPayerId($payer_id);
81
        $executePayment = $payment->execute($paymentExecution, $this->_apiContext);
82
83
        // Clear the shopping cart, write to database, send notifications, etc.
84
        $request->session()->pull('likes', []);
85
86
87
        exit(dump($executePayment));
88
        // Thank the user for the purchase
89
        return view('Main/index');
90
    }
91
92
    /**
93
     * Page Acceuil