Skip to content

Instantly share code, notes, and snippets.

@crushcafeteria
Created January 7, 2016 07:02
Show Gist options
  • Save crushcafeteria/90973fba92b67987a12c to your computer and use it in GitHub Desktop.
Save crushcafeteria/90973fba92b67987a12c to your computer and use it in GitHub Desktop.
function ip_recieve(){
header('Content-Type: application/json');
# Save transaction
$data = $this->input->post();
# Clean up a bit
$data['till_no'] = $data['business_number'];
$data['provider'] = 'KOPOKOPO';
$data['tr_code'] = $data['transaction_reference'];
$data['provider_internal_id'] = $data['internal_transaction_id'];
$data['date_recieved'] = date('Y-m-d H:i:s',strtotime($data['transaction_timestamp']));
$data['created_on'] = $this->arena->formatDate();
unset($data['business_number'], $data['transaction_reference'],
$data['internal_transaction_id'], $data['signature'],
$data['transaction_timestamp'], $data['service_name'],
$data['transaction_type'], $data['account_number'],
$data['username'], $data['password']
);
if(!$this->kopokopo_model->addTransaction($data)){
// # Send SMS to customer
// $sms = 'KES.'.$data['amount'].' has been deposited to Blackpay from your M-PESA account. Enter the code to complete payment';
// $this->sms_model->sendSMS($data['sender_phone'], $sms, 'PAYMENT_RECIEVED');
$response = array(
'status' => '01',
'description' => 'Accepted'
);
echo json_encode($response);
} else {
echo 'TR: '.$data['tr_code'].' - IPN Sync Error';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment