[CC payment changes Adrian Georgescu **20140315154517 Ignore-this: 7fba27671e3e53789ec6f3c6954b872e ] hunk ./library/sip_settings.php 1927 - printf (_("Calling to telephone numbers is possible at the costs set forth in the Price List. "),$this->url); hunk ./library/sip_settings.php 1928 - print _("You can purchase credit with a Credit Card. "); + printf (_("Calling to telephone numbers is possible at the costs set forth in the Price List. "),$this->url); + //printf (_("You can purchase credit with a Credit Card or Bitcoin. "),$this->url, $this->url); + //print "

"; + //printf (_("You can purchase credit using Bitcoin. "), $this->url); + + print "

"; hunk ./library/sip_settings.php 1940 - if ($this->require_proof_of_identity) { - if ($this->login_type == 'subscriber') { - if (!in_array("payments",$this->groups)) { + $credit_amount = 20; + //$method = 'btc'; + + if ($method == 'btc') { + print "

Select an amount and click submit to go the Bitcoin payment page."; + printf("

+ + Amount USD +

+

+ ", $this->account); + } else { + $chapter=sprintf(_("Credit Card")); + $this->showChapter($chapter); + if ($this->require_proof_of_identity) { + if ($this->login_type == 'subscriber') { + if (!in_array("payments",$this->groups)) { + $this->showIdentityProof(); + } + } else { hunk ./library/sip_settings.php 1962 - } else { - $this->showIdentityProof(); + + if (!in_array("payments",$this->groups)) { + return false; + } hunk ./library/sip_settings.php 1967 - - if (!in_array("payments",$this->groups)) { + + $payment_processor = new $this->payment_processor_class($this); + + if ($payment_processor->fraudDetected()) { + $chapter=sprintf(_("Payments")); + $this->showChapter($chapter); + + print " + + + "; + + if ($account->login_type!='subscriber') { + print "

"; + printf ("%s",$this->fraud_reason); + } else { + print _("Page Not Available"); + $log=sprintf("CC transaction is not allowed from %s for %s (%s)",$_SERVER['REMOTE_ADDR'],$account->account,$this->fraud_reason); + syslog(LOG_NOTICE, $log); + } + + print " + + "; + hunk ./library/sip_settings.php 1994 - } - - $payment_processor = new $this->payment_processor_class($this); - - - if ($payment_processor->fraudDetected()) { - $chapter=sprintf(_("Payments")); - $this->showChapter($chapter); - - print " - - - "; - - if ($account->login_type!='subscriber') { - print "

"; - printf ("%s",$this->fraud_reason); - } else { - print _("Page Not Available"); - $log=sprintf("CC transaction is not allowed from %s for %s (%s)",$_SERVER['REMOTE_ADDR'],$account->account,$this->fraud_reason); - syslog(LOG_NOTICE, $log); + + $basket = array('pstn_credit'=>array('price' => $credit_amount, + 'description' => _('Prepaid Credit'), + 'unit' => 'credit', + 'duration' => 'N/A', + 'qty' => 1 + ) + ); + + // print "

";
+           // print_r($payment_processor);
+           // print "
"; + $payment_processor->doDirectPayment($basket); + + //print "
";
+            //
+            //print_r($payment_processor);
+            //print "
"; + if ($payment_processor->transaction_results['success']) { + // add PSTN credit + $this->addBalanceReseller($credit_amount,sprintf("CC transaction %s",$payment_processor->transaction_results['id'])); + } + + if ($this->first_transaction && $payment_processor->make_credit_checks) { + // block account temporary to check the user + // $transaction_data= $payment_processor->['CardProcessor']['transaction_data']; + // if ( $this->email != $transaction_data['USER_EMAIL'] || + // $this-> + $this->SipPort->addHeader($this->SoapAuth); + $result = $this->SipPort->removeFromGroup(array("username" => $this->username,"domain"=> $this->domain),"free-pstn"); hunk ./library/sip_settings.php 2025 - - print " - - "; - - return false; - } - - $credit_amount = 20; - $basket = array('pstn_credit'=>array('price' => $credit_amount, - 'description' => _('Prepaid Credit'), - 'unit' => 'credit', - 'duration' => 'N/A', - 'qty' => 1 - ) - ); - $payment_processor->doDirectPayment($basket); - - if ($payment_processor->transaction_results['success']) { - // add PSTN credit - $this->addBalanceReseller($credit_amount,sprintf("CC transaction %s",$payment_processor->transaction_results['id'])); - } - - if ($this->first_transaction && $payment_processor->make_credit_checks) { - // block account temporary to check the user - $this->SipPort->addHeader($this->SoapAuth); - $result = $this->SipPort->removeFromGroup(array("username" => $this->username,"domain"=> $this->domain),"free-pstn");