public function fromJson($responseData)
 {
     $paymentCompleteResponse = new PaymentCompleteResponse();
     $paymentCompleteResponse->setClientId($responseData[responseData][clientId]);
     $paymentCompleteResponse->setClientIdHash($responseData[responseData][clientIdHash]);
     $paymentCompleteResponse->setTransactionType($responseData[responseData][transactionType]);
     $creditCard = new CreditCard();
     $creditCard->setType($responseData[responseData][creditCard][type]);
     $creditCard->setHolderName($responseData[responseData][creditCard][holderName]);
     $creditCard->setNumber($responseData[responseData][creditCard][number]);
     $creditCard->setExpiry($responseData[responseData][creditCard][expiry]);
     $paymentCompleteResponse->setCreditCard($creditCard);
     $transactionAmount = new TransactionAmount();
     $transactionAmount->setTotalAmount($responseData[responseData][transactionAmount][totalAmount]);
     $transactionAmount->setPaymentAmount($responseData[responseData][transactionAmount][paymentAmount]);
     $transactionAmount->setServiceFeeAmount($responseData[responseData][transactionAmount][serviceFeeAmount]);
     $transactionAmount->setWithholdingAmount($responseData[responseData][transactionAmount][withholdingAmount]);
     $transactionAmount->setCurrency($responseData[responseData][transactionAmount][currency]);
     $paymentCompleteResponse->setTransactionAmount($transactionAmount);
     $paymentCompleteResponse->setClientRef($responseData[responseData][clientRef]);
     $paymentCompleteResponse->setComment($responseData[responseData][comment]);
     $paymentCompleteResponse->setTxnReference($responseData[responseData][txnReference]);
     $paymentCompleteResponse->setFeeReference($responseData[responseData][feeReference]);
     $paymentCompleteResponse->setResponseCode($responseData[responseData][responseCode]);
     $paymentCompleteResponse->setResponseText($responseData[responseData][responseText]);
     $paymentCompleteResponse->setSettlementDate($responseData[responseData][settlementDate]);
     $paymentCompleteResponse->setToken($responseData[responseData][token]);
     $paymentCompleteResponse->setTokenized($responseData[responseData][tokenized]);
     $paymentCompleteResponse->setTokenResponseText($responseData[responseData][tokenResponseText]);
     $paymentCompleteResponse->setAuthCode($responseData[responseData][authCode]);
     $paymentCompleteResponse->setCvcResponse($responseData[responseData][cvcResponse]);
     return $paymentCompleteResponse;
 }
Example #2
0
    /* ------------------------------------------------------------------------------
       STEP2: Build PaycorpClient object
       ------------------------------------------------------------------------------ */
    $client = new GatewayClient($clientConfig);
    /* ------------------------------------------------------------------------------
       STEP3: Build PaymentInitRequest object
       ------------------------------------------------------------------------------ */
    $initRequest = new PaymentInitRequest();
    $initRequest->setClientId($clientId);
    $initRequest->setTransactionType(TransactionType::$PURCHASE);
    $initRequest->setClientRef($clientRef);
    $initRequest->setComment($comment);
    $initRequest->setTokenize(TRUE);
    $initRequest->setExtraData(array("msisdn" => "{$msisdn}", "sessionId" => "{$sessionId}"));
    // sets transaction-amounts details (all amounts are in cents)
    $transactionAmount = new TransactionAmount($paymentAmount);
    $transactionAmount->setTotalAmount($totalAmount);
    $transactionAmount->setServiceFeeAmount($serviceFeeAmount);
    //$transactionAmount->setPaymentAmount((float) $paymentAmount);
    $transactionAmount->setCurrency($currency);
    $initRequest->setTransactionAmount($transactionAmount);
    // sets redirect settings
    $redirect = new Redirect($returnUrl);
    // $redirect->setReturnUrl($returnUrl);
    $redirect->setReturnMethod($returnMethod);
    $initRequest->setRedirect($redirect);
    /* ------------------------------------------------------------------------------
       STEP4: Process PaymentInitRequest object
       ------------------------------------------------------------------------------ */
    $initResponse = $client->getPayment()->init($initRequest);
}
Example #3
0
    $realTimeRequest->setOriginalTxnReference($originalTxnReference);
    $realTimeRequest->setClientRef("cvdb-123");
    $realTimeRequest->setComment("testing");
    $extraData = array("invoice-no" => "I99999", "job-no" => "J10101");
    $realTimeRequest->setExtraData($exData);
    // sets credit-card details
    $creditCard = new CreditCard();
    $creditCard->setType($cardType);
    $creditCard->setHolderName("Bob Marley");
    $creditCard->setExpiry($expiryDate);
    $creditCard->setNumber($cardNo);
    $creditCard->setSecureId($secureId);
    $creditCard->setSecureIdSupplied(TRUE);
    $realTimeRequest->setCreditCard($creditCard);
    // sets transaction-amounts details (all amounts are in cents)
    $transactionAmount = new TransactionAmount($paymentAmount);
    $transactionAmount->setTotalAmount();
    //$transactionAmount->setPaymentAmount($paymentAmount);
    $transactionAmount->setServiceFeeAmount();
    $transactionAmount->setCurrency($currency);
    $realTimeRequest->setTransactionAmount($transactionAmount);
    /* ------------------------------------------------------------------------------
       STEP4: Process PaycorpRealTimeRequest object
       ------------------------------------------------------------------------------ */
    $realTimeResponse = $client->getPayment()->realTime($realTimeRequest);
}
?>

<html>
    <head>
        <meta charset="UTF-8">
Example #4
0
 public static function fromArray($data)
 {
     if (!is_null($data)) {
         $capture = new Bill();
         foreach ($data as $key => $value) {
             if (property_exists(get_class($capture), $key)) {
                 if ($key == "billingReferences") {
                     $capture->{$key} = BillingReferences::fromArray($value);
                 } elseif ($key == "tax_amount" || $key == "base_amount" || $key == "totalAmount" || $key == "shipping_amount") {
                     $capture->{$key} = TransactionAmount::fromArray($value);
                 } else {
                     $capture->{$key} = $value;
                 }
             }
         }
         return $capture;
     }
 }