This commit is contained in:
Jonathan Lui 2018-06-21 11:19:28 -07:00
parent 7a6edd751d
commit c7e7692057

View file

@ -13,24 +13,24 @@ class HipsterShopServer {
* Handler for PaymentService.Charge. * Handler for PaymentService.Charge.
* @param {*} call { ChargeRequest } * @param {*} call { ChargeRequest }
* @param {*} callback fn(err, ChargeResponse) * @param {*} callback fn(err, ChargeResponse)
*/ */
static ChargeServiceHandler(call, callback) { static ChargeServiceHandler(call, callback) {
try { try {
const response = this.charge(call.request) const response = this.charge(call.request)
callback(null, response); callback(null, response);
} catch (err) { } catch (err) {
callback(err); callback(err);
}
} }
}
/** /**
* Charge function * Charge function
* @param {*} request * @param {*} request
* @return transaction_id * @return transaction_id
*/ */
static charge(request) { static charge(request) {
return { transaction_id: -1 } return { transaction_id: -1 }
} }
listen() { listen() {
this.server.bind(`0.0.0.0:${this.port}`, grpc.ServerCredentials.createInsecure()); this.server.bind(`0.0.0.0:${this.port}`, grpc.ServerCredentials.createInsecure());