Exemplo n.º 1
0
 /**
  * 
  * @return \CityPay\Lib\ApiMessage
  * @throws InvalidGatewayResponseException
  */
 public function completeTransaction()
 {
     //
     //
     //
     $deserializedPayload = null;
     $responseCode = self::invokeRpcAndDeserializeResponse(ApiEndpoints::complete(), ApiEncoding::FORM_URL, ApiEncoding::XML, $deserializedPayload);
     if ($deserializedPayload == null) {
         throw new InvalidGatewayResponseException();
     }
     //
     //  If a connection to the PayPOST API server was successfully
     //  established, the response code returned by the API server
     //  is HttpRpc.HTTP_OK.
     //
     if ($responseCode == Http::HTTP_OK) {
         return (new PayPostResponse())->xmlDeserialize($deserializedPayload)->validate(self::get("merchantid"), self::get("licencekey"));
     } else {
         //  TODO: Determine better result to return
         return null;
     }
 }
Exemplo n.º 2
0
 /**
  * 
  * @return \CityPay\Lib\ApiMessage
  * @throws InvalidGatewayResponseException
  */
 public function notifyAcsResult()
 {
     //
     //
     //
     $deserializedPayload = null;
     $responseCode = self::invokeRpcAndDeserializeResponse(ApiEndpoints::notifyAcsResult(), ApiEncoding::FORM_URL, ApiEncoding::XML, $deserializedPayload);
     if ($deserializedPayload == null) {
         throw new InvalidGatewayResponseException($responseCode);
     }
     //
     //  If a connection to the PayPOST API server was successfully
     //  established, the response code returned by the API server
     //  is HttpRpc.HTTP_OK.
     //
     if ($responseCode == Http::HTTP_OK) {
         try {
             return (new PayPostResponse())->xmlDeserialize($deserializedPayload)->validate($this->merchantId, $this->licenceKey);
         } catch (NamedValueNotFoundException $e) {
             //
             //  TODO: Determine better result to return
             //
             return null;
         }
     } else {
         //
         //  TODO: Determine better result to return
         //
         return null;
     }
 }