Created
January 7, 2019 03:59
-
-
Save ProdigyView/40cadb73009d36b334833ffa2b8a757f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Router::post('/products/purchase', array('callback'=>function(Request $request){ | |
$response = array(); | |
//RETRIEVE Data From The Request | |
$data = $request->getRequestData('array'); | |
if ($data) { | |
$data['type']='charge'; | |
//Send The Message | |
$result = sendToPurchaseService($data); | |
//Create a response from the microservice | |
$response = array('status' => $result); | |
} else { | |
$response = array('status' => 'Unable To Send Email'); | |
} | |
//Send response to client who accessed the API | |
sendResponse(json_encode($response)); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment