Exemplo n.º 1
0
 public function create()
 {
     // get transferred_at
     // $transferred_at = explode('-', Input::get('transferred_at'));
     // $transferred_at = mktime(0,0,0,$transferred_at[1],$transferred_at[0],$transferred_at[2]);
     $transferred_at = strtotime(Input::get('transferred_at'));
     // get input
     $input = array('user_id' => Auth::user()->id, 'currency' => Input::get('currency'), 'total' => Input::get('total'), 'transferred_at' => $transferred_at, 'to_bank' => Input::get('to_bank'), 'bank_name' => Input::get('bank_name'), 'bank_account' => Input::get('bank_account'), 'bank_account_name' => Input::get('bank_account_name'), 'message' => Input::get('message'), 'donation_ids' => Input::get('donation_ids'));
     $result = Payment::add($input);
     if ($result['success']) {
         Session::flash('success', 'Proses konfirmasi pengiriman donasi Anda berhasil. Selanjutnya kami mohon kesediaan Anda untuk menunggu Admin BagiKasih melakukan verifikasi. BagiKasih akan mengirim Anda email jika proses verivikasi telah dilakukan. Terima kasih.');
         if (Request::ajax()) {
             return Response::json(['success' => true, 'redirect_url' => URL::route('riwayat-donasi')]);
         } else {
             return $result;
         }
     } else {
         // if fail
         if (Request::ajax()) {
             return Response::json(json_encode($result));
         } else {
             return $result;
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 static function create_from_pptxn($pptxn_id)
 {
     $t = new PayPalTxn($pptxn_id);
     # if it already has a payment_id, stop here and just return that id
     if ($t->payment_id() > 0) {
         return $t->payment_id();
     }
     $student_id = $t->student_id();
     if ($student_id === false) {
         return false;
     }
     $set = array('student_id' => $student_id, 'created_at' => 'NOW()');
     $money = $t->money();
     $set['currency'] = $money->code;
     $set['millicents'] = $money->millicents;
     $info = $t->infoarray();
     if (!isset($info['item_number'])) {
         return false;
     }
     $d = new Document($info['item_number']);
     if ($d->failed()) {
         return false;
     }
     $set['document_id'] = $d->id;
     $p = new Payment(false);
     $payment_id = $p->add($set);
     $t->set(array('payment_id' => $payment_id));
     return $payment_id;
 }
Exemplo n.º 3
0
 function testPaymentAdd()
 {
     $p = new Payment(false);
     $set = array('student_id' => 1, 'document_id' => 3, 'currency' => 'EUR', 'millicents' => 15000, 'details' => 'nah', 'created_at' => '2008-11-01');
     $new_id = $p->add($set);
     $p = new Payment($new_id);
     $m = $p->money();
     $this->assertEquals('€1.50 EUR', $m->show_with_code());
 }
Exemplo n.º 4
0
 /**
  * Stores the Payments as present in the POST request
  *
  * See {@see Payment::delete()},
  * {@see Payment::add()}, and
  * {@see Payment::update()}.
  */
 static function storePayments()
 {
     $result = NULL;
     if (isset($_GET['delete_payment'])) {
         $payment_id = intval($_GET['delete_payment']);
         $result = Payment::delete($payment_id);
     }
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after Payment::delete: ".self::$success.", changed: ".self::$changed);
     $result = Payment::add();
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after Payment::add: ".self::$success.", changed: ".self::$changed);
     $result = Payment::update();
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after Payment::update: ".self::$success.", changed: ".self::$changed);
     Payment::reset();
     if (empty($_POST['bpayment'])) {
         return;
     }
     // NOTE: All the following could be handled by Payment::settings()
     \Cx\Core\Setting\Controller\Setting::set('payrexx_instance_name', trim(strip_tags(contrexx_input2raw($_POST['payrexx_instance_name']))));
     \Cx\Core\Setting\Controller\Setting::set('payrexx_api_secret', trim(strip_tags(contrexx_input2raw($_POST['payrexx_api_secret']))));
     \Cx\Core\Setting\Controller\Setting::set('payrexx_active', !empty($_POST['payrexx_active']));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_shop_id', trim(strip_tags(contrexx_input2raw($_POST['postfinance_shop_id']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_active', !empty($_POST['postfinance_active']));
     //        \Cx\Core\Setting\Controller\Setting::set('postfinance_hash_seed',
     //            trim(strip_tags(contrexx_input2raw($_POST['postfinance_hash_seed']);
     // Replaced by
     \Cx\Core\Setting\Controller\Setting::set('postfinance_hash_signature_in', trim(strip_tags(contrexx_input2raw($_POST['postfinance_hash_signature_in']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_hash_signature_out', trim(strip_tags(contrexx_input2raw($_POST['postfinance_hash_signature_out']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_authorization_type', trim(strip_tags(contrexx_input2raw($_POST['postfinance_authorization_type']))));
     // OBSOLETE -- Determined by the available cards and the PostFinance
     // backend settings
     //        \Cx\Core\Setting\Controller\Setting::set('postfinance_accepted_payment_methods', $strYellowpayAcceptedPM);
     \Cx\Core\Setting\Controller\Setting::set('postfinance_use_testserver', !empty($_POST['postfinance_use_testserver']));
     // Postfinance Mobile
     \Cx\Core\Setting\Controller\Setting::set('postfinance_mobile_webuser', trim(strip_tags(contrexx_input2raw($_POST['postfinance_mobile_webuser']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_mobile_sign', trim(strip_tags(contrexx_input2raw($_POST['postfinance_mobile_sign']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_mobile_ijustwanttotest', !empty($_POST['postfinance_mobile_ijustwanttotest']));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_mobile_status', !empty($_POST['postfinance_mobile_status']));
     // Saferpay
     \Cx\Core\Setting\Controller\Setting::set('saferpay_id', trim(strip_tags(contrexx_input2raw($_POST['saferpay_id']))));
     \Cx\Core\Setting\Controller\Setting::set('saferpay_active', !empty($_POST['saferpay_active']));
     \Cx\Core\Setting\Controller\Setting::set('saferpay_finalize_payment', !empty($_POST['saferpay_finalize_payment']));
     \Cx\Core\Setting\Controller\Setting::set('saferpay_use_test_account', !empty($_POST['saferpay_use_test_account']));
     \Cx\Core\Setting\Controller\Setting::set('saferpay_window_option', intval($_POST['saferpay_window_option']));
     // Paypal
     \Cx\Core\Setting\Controller\Setting::set('paypal_account_email', trim(strip_tags(contrexx_input2raw($_POST['paypal_account_email']))));
     \Cx\Core\Setting\Controller\Setting::set('paypal_active', !empty($_POST['paypal_active']));
     \Cx\Core\Setting\Controller\Setting::set('paypal_default_currency', trim(strip_tags(contrexx_input2raw($_POST['paypal_default_currency']))));
     // Datatrans
     \Cx\Core\Setting\Controller\Setting::set('datatrans_merchant_id', trim(strip_tags(contrexx_input2raw($_POST['datatrans_merchant_id']))));
     \Cx\Core\Setting\Controller\Setting::set('datatrans_active', !empty($_POST['datatrans_active']));
     \Cx\Core\Setting\Controller\Setting::set('datatrans_request_type', trim(strip_tags(contrexx_input2raw($_POST['datatrans_request_type']))));
     \Cx\Core\Setting\Controller\Setting::set('datatrans_use_testserver', !empty($_POST['datatrans_use_testserver']));
     // Paymill
     \Cx\Core\Setting\Controller\Setting::set('paymill_active', !empty($_POST['paymill_active']));
     \Cx\Core\Setting\Controller\Setting::set('paymill_use_test_account', !empty($_POST['paymill_use_test_account']));
     \Cx\Core\Setting\Controller\Setting::set('paymill_test_private_key', trim(strip_tags(contrexx_input2raw($_POST['paymill_test_private_key']))));
     \Cx\Core\Setting\Controller\Setting::set('paymill_test_public_key', trim(strip_tags(contrexx_input2raw($_POST['paymill_test_public_key']))));
     \Cx\Core\Setting\Controller\Setting::set('paymill_live_private_key', trim(strip_tags(contrexx_input2raw($_POST['paymill_live_private_key']))));
     \Cx\Core\Setting\Controller\Setting::set('paymill_live_public_key', trim(strip_tags(contrexx_input2raw($_POST['paymill_live_public_key']))));
     // LSV
     \Cx\Core\Setting\Controller\Setting::set('payment_lsv_active', !empty($_POST['payment_lsv_active']));
     // All preceding should be handled by Payment::settings()
 }