public function confirmTier(TransactionRepository $transactions)
 {
     $tier = $transactions->getUserTier(Auth::user());
     $tier = $tier ? $tier : 'free';
     $msg = Request::session()->get('lastPayment');
     return view('payment.confirmed', ['tier' => $tier, 'lastTxMsg' => $msg]);
 }
示例#2
0
 public function finalizeTransaction(TierDescriptor $tiers, TransactionRepository $transactions, TransactionResultListener $resultListener)
 {
     $txId = Request::get("tx");
     // $st = Request::get('st');
     // $amt = Request::get('amt');
     $r = $this->callPayPalAPI($this->formUrl(), ["cmd" => "_notify-synch", "tx" => $txId, "at" => $this->pdtToken(), "submit" => "PDT"]);
     if ($r[0] == "SUCCESS") {
         $status = "success";
     } else {
         $status = $r[0];
     }
     $buyerId = Auth::user()->getAuthIdentifier();
     $money = $r['mc_gross'];
     $product = array_get($r, 'custom', 'free');
     $tierPrice = floatval($tiers->getTierPrice($product));
     if ($tierPrice > floatval($money)) {
         return $resultListener->transactionFail(null, sprintf(_("You did not pay the full amount of the price for the item! (For further information, the transaction id is %s)"), $txId));
     }
     $extra = json_encode($r);
     $tx = new PaypalTransaction($txId, $status, $buyerId, $money, $product, $extra);
     if ($tx->getStatus() == "success") {
         $transactions->saveOrUpdateTransaction($tx);
         return $resultListener->transactionOk($tx);
     } else {
         return $resultListener->transactionFail($tx, sprintf(_("The transaction did not commit. The current status is %s"), $tx->getStatus()));
     }
 }
 public function profile(TransactionRepository $transactions, VolunteerRepository $volunteers)
 {
     $user = \Auth::user();
     $tier = $transactions->getUserTier($user);
     $volunteer_status = $volunteers->getStatus($user);
     return view('user_profile', ['user' => $user, 'tier' => $tier, 'volunteer' => $volunteer_status]);
 }
 public function handle($concept, $price)
 {
     $txId = $this->findNextTxId();
     $status = "pending";
     $uid = \Auth::user()->getAuthIdentifier();
     $tx = new BankTransferIntent($txId, $status, $uid, $price, $concept, ["paymentRegistered" => false]);
     return TransactionRepository::saveOrUpdateTransaction($tx);
 }