New send money

This commit is contained in:
CHIEFSOFT\ameye
2024-07-08 13:36:59 -04:00
parent d9a69cc3c5
commit 1da40abc03
2 changed files with 48 additions and 2 deletions
+3 -1
View File
@@ -167,7 +167,9 @@ $routes->post('/en/wrench/api/v1/accounttypes', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/getjob', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/mybanklist', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/sendmoney', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/sendmoney', 'WrenchWallet::sendMoney');//'WrenchApi::apigate'
$routes->post('/en/wrench/api/v1/sendinterest', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/waitinginterest', 'WrenchApi::apigate');
+45 -1
View File
@@ -2,15 +2,59 @@
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
class WrenchWallet extends BaseController
{
use ResponseTrait;
public function __construct()
{
log_message('critical', "WrenchWallet Path GATE 001");
$this->request = $request = \Config\Services::request();
}
public function sendMoney(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$in["action"] = WRENCHBOARD_USER_SENDMONEY;
$out["internal_return"] = 0;
$in["InitiatingChannel"] = 7;
$in["InitiatingPaymentMethodCode"] = "CA";
$in["InitiatingCurrencyCode"] = '566'; // 566 - NRN - Naira
$in["InitiatingEntityCode"] = "MBA";
$in["transaction_id"] = "T" . rand(120000, 999999);
$in["TerminatingPaymentMethodCode"] = "AC";
$in["TerminatingCurrencyCode"] = '566'; // 566 - NRN - Naira
$in["TerminatingCountryCode"] = 'NG'; // NG - Nigeria
$in["bankid"] = $in["recipientid"];
$in["InitiatingAmount"] = $in["amount"];
$in["TerminatingAmount"] = $in["amount"];
$out=[];
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
$out['internal_return'] = $ret;
log_message('critical', "***** ***** WrenchWallet::sendMoney Ret = ".$ret );
if ( isset($out['internal_return']) && isset( $out['confirmation']) ){
$endpoint = "SENDMONEY_".$in["assign_mode"]."-". $out["confirmation"];
log_message('critical', "***** ***** WrenchWallet::sendMoney SENDMONEY_ = ".$endpoint );
$this->saveCache($endpoint,$out,25000);
$local_url = "http://".$this->micro_service_net1.":3037/eventSendMoney";
$outX = $this->APIcall('POST', $local_url, ["message"=>$out]);
}else
{
$fail_endpoint = "SENDMONEY_FAIL_".strtoupper( date("FDYjGis") );
log_message('critical', "***** ***** WrenchWallet::sendMoney FAIL_OFFER = ".$fail_endpoint );
$this->saveCache($fail_endpoint,$in,25000);
}
return $this->respond( $this->summaryReturnData($in,$out), 200);
}
public function index()
{
return [];