dc
Showing
... | ... | @@ -298,140 +298,141 @@ class Api extends CI_Controller { |
} | ||
} | ||
public function paymentGateway(){ | ||
BayanPayPayment(); | ||
// Please read the documentation and readme.txt file before implementing the code | ||
$BayanPayArray = array('BayanPay_Online_setting' => array( | ||
'merchantKey' => "+Hu4bL6iVk943JmFAvGtWEYMODFry4fad2I+iM0X2m0=", // Your key provided by BayanPay | ||
'merchantId' => '201901291000002', // Your merchant ID ex: 201408191000001 | ||
'collaboratorId' => 'BAYANPAY', // Constant used by BayanPay | ||
'iv' => '0123456789abcdef', // Used for initializing CBC encryption mode | ||
'url' => false // Set to false if you are using testing environment , set to true if you are using live environment | ||
), | ||
'Block_Existence_Indicator' => array( | ||
'transactionDataBlock' => true, | ||
'billingDataBlock' => true, | ||
'shippingDataBlock' => true, | ||
'paymentDataBlock' => false, | ||
'merchantDataBlock' => false, | ||
'otherDataBlock' => false, | ||
'DCCDataBlock' => false | ||
), | ||
'Field_Existence_Indicator_Transaction' => array( | ||
'merchantOrderNumber' => time(), | ||
'amount' => '100.00', | ||
'successUrl' => $this->baseurl(), | ||
'failureUrl' => $this->baseurl(), | ||
'transactionMode' => 'INTERNET', | ||
'payModeType' => 'CC', | ||
'transactionType' => '01', | ||
'currency' => 'SAR' | ||
), | ||
'Field_Existence_Indicator_Billing' => array( | ||
'billToFirstName' => 'Soloman', | ||
'billToLastName' => 'Vandy', | ||
'billToStreet1' => '123,ParkStreet', | ||
'billToStreet2' => 'Park Street', | ||
'billToCity' => 'Riyadh', | ||
'billToState' => 'Riyadh', | ||
'billtoPostalCode' => '400081', | ||
'billToCountry' => 'IN', | ||
'billToEmail' => '[email protected]', | ||
'billToMobileNumber' => '9820998209', | ||
'billToPhoneNumber1' => '', | ||
'billToPhoneNumber2' => '', | ||
'billToPhoneNumber3' => '' | ||
), | ||
'Field_Existence_Indicator_Shipping' => array( | ||
'shipToFirstName' => 'Soloman', | ||
'shipToLastName' => 'Vandy', | ||
'shipToStreet1' => '123ParkStreet', | ||
'shipToStreet2' => 'parkstreet', | ||
'shipToCity' => 'Riyadh', | ||
'shipToState' => 'Riyadh', | ||
'shipToPostalCode' => '400081', | ||
'shipToCountry' => 'IN', | ||
'shipToPhoneNumber1' => '', | ||
'shipToPhoneNumber2' => '', | ||
'shipToPhoneNumber3' => '', | ||
'shipToMobileNumber' => '9820998209' | ||
), | ||
'Field_Existence_Indicator_Payment' => array( | ||
'cardNumber' => '4111111111111111', // 1. Card Number | ||
'expMonth' => '08', // 2. Expiry Month | ||
'expYear' => '2020', // 3. Expiry Year | ||
'CVV' => '123', // 4. CVV | ||
'cardHolderName' => 'Soloman', // 5. Card Holder Name | ||
'cardType' => 'Visa', // 6. Card Type | ||
'custMobileNumber'=> '9820998209', // 7. Customer Mobile Number | ||
'paymentID' => '123456', // 8. Payment ID | ||
'OTP' => '123456', // 9. OTP field | ||
'gatewayID' => '1026', // 10.Gateway ID | ||
'cardToken' => '1202' // 11.Card Token | ||
), | ||
'Field_Existence_Indicator_Merchant' => array( | ||
'UDF1' => '115.121.181.112', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF2' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF3' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF4' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF5' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF6' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF7' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF8' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF9' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF10' => 'abc' // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
), | ||
'Field_Existence_Indicator_OtherData' => array( | ||
'custID' => '12345', | ||
'transactionSource' => 'IVR', | ||
'productInfo' => 'Book', | ||
'isUserLoggedIn' => 'Y', | ||
'itemTotal' => '500.00, 1000.00', | ||
'itemCategory' => 'CD, Book', | ||
'ignoreValidationResult' => 'FALSE' | ||
), | ||
'Field_Existence_Indicator_DCC' => array( | ||
'DCCReferenceNumber' => '09898787', // DCC Reference Number | ||
'foreignAmount' => '240.00', // Foreign Amount | ||
'ForeignCurrency' => 'USD' // Foreign Currency | ||
) | ||
); | ||
$BayanPayOnlineObject = new BayanPayBitmapPaymentIntegration($BayanPayArray); | ||
if(isset($_REQUEST['responseParameter']) && $_REQUEST['responseParameter'] != ''){ | ||
$networkOnlineArray = | ||
array('Network_Online_setting' => | ||
array( | ||
'merchantKey' => "+Hu4bL6iVk943JmFAvGtWEYMODFry4fad2I+iM0X2m0=", | ||
'merchantId' => '201901291000002', | ||
'collaboratorId' => 'NI', | ||
'iv' => '0123456789abcdef', | ||
'url' => false | ||
), | ||
'Block_Existence_Indicator' => array( | ||
'transactionDataBlock' => true, | ||
'billingDataBlock' => true, | ||
'shippingDataBlock' => true, | ||
'paymentDataBlock' => false, | ||
'merchantDataBlock' => false, | ||
'otherDataBlock' => false, | ||
'DCCDataBlock' => false | ||
), | ||
'Field_Existence_Indicator_Transaction' => array( | ||
'merchantOrderNumber' => time(), | ||
'amount' => '100.00', | ||
'successUrl' => $this->baseurl(), | ||
'failureUrl' => $this->baseurl(), | ||
'transactionMode' => 'INTERNET', | ||
'payModeType' => 'CC', | ||
'transactionType' => '01', | ||
'currency' => 'AED' | ||
), | ||
'Field_Existence_Indicator_Billing' => array( | ||
'billToFirstName' => 'Soloman', | ||
'billToLastName' => 'Vandy', | ||
'billToStreet1' => '123,ParkStreet', | ||
'billToStreet2' => 'Park Street', | ||
'billToCity' => 'Mumbai', | ||
'billToState' => 'Maharashtra', | ||
'billtoPostalCode' => '400081', | ||
'billToCountry' => 'IN', | ||
'billToEmail' => '[email protected]', | ||
'billToMobileNumber' => '9820998209', | ||
'billToPhoneNumber1' => '', | ||
'billToPhoneNumber2' => '', | ||
'billToPhoneNumber3' => '' | ||
), | ||
'Field_Existence_Indicator_Shipping' => array( | ||
'shipToFirstName' => 'Soloman', | ||
'shipToLastName' => 'Vandy', | ||
'shipToStreet1' => '123ParkStreet', | ||
'shipToStreet2' => 'parkstreet', | ||
'shipToCity' => 'Mumbai', | ||
'shipToState' => 'Maharashtra', | ||
'shipToPostalCode' => '400081', | ||
'shipToCountry' => 'IN', | ||
'shipToPhoneNumber1' => '', | ||
'shipToPhoneNumber2' => '', | ||
'shipToPhoneNumber3' => '', | ||
'shipToMobileNumber' => '9820998209' | ||
), | ||
'Field_Existence_Indicator_Payment' => array( | ||
'cardNumber' => '4111111111111111', // 1. Card Number | ||
'expMonth' => '08', // 2. Expiry Month | ||
'expYear' => '2020', // 3. Expiry Year | ||
'CVV' => '123', // 4. CVV | ||
'cardHolderName' => 'Soloman', // 5. Card Holder Name | ||
'cardType' => 'Visa', // 6. Card Type | ||
'custMobileNumber'=> '9820998209', // 7. Customer Mobile Number | ||
'paymentID' => '123456', // 8. Payment ID | ||
'OTP' => '123456', // 9. OTP field | ||
'gatewayID' => '1026', // 10.Gateway ID | ||
'cardToken' => '1202' // 11.Card Token | ||
), | ||
'Field_Existence_Indicator_Merchant' => | ||
array( | ||
'UDF1' => '115.121.181.112', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF2' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF3' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF4' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF5' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF6' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF7' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF8' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF9' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
'UDF10' => 'abc' // This is a ‘user-defined field’ that can be used to send additional information about the transaction. | ||
), | ||
'Field_Existence_Indicator_OtherData' => | ||
array( | ||
'custID' => '12345', | ||
'transactionSource' => 'IVR', | ||
'productInfo' => 'Book', | ||
'isUserLoggedIn' => 'Y', | ||
'itemTotal' => '500.00, 1000.00', | ||
'itemCategory' => 'CD, Book', | ||
'ignoreValidationResult' => 'FALSE' | ||
), | ||
'Field_Existence_Indicator_DCC' => | ||
array( | ||
'DCCReferenceNumber' => '09898787', // DCC Reference Number | ||
'foreignAmount' => '240.00', // Foreign Amount | ||
'ForeignCurrency' => 'USD' // Foreign Currency | ||
) | ||
); | ||
$response = $BayanPayOnlineObject->decryptData($_REQUEST['responseParameter'],$BayanPayOnlineObject->merchantKey,$BayanPayOnlineObject->iv); | ||
$BayanPayOnlineObject->AddLog('BayanPay Response : '.print_r($response, TRUE),'16'); | ||
} | ||
$networkOnlineObject = new NetworkonlieBitmapPaymentIntegration($networkOnlineArray); | ||
$requestParameter = $BayanPayOnlineObject->BayanPostData; | ||
if(isset($_REQUEST['responseParameter']) && $_REQUEST['responseParameter'] != ''){ | ||
$response = $networkOnlineObject->decryptData($_REQUEST['responseParameter'],$networkOnlineObject->merchantKey,$networkOnlineObject->iv); | ||
$networkOnlineObject->AddLog('Network Online Response : '.print_r($response, TRUE),'16'); | ||
} | ||
// // if($BayanPayOnlineObject->url) | ||
// $requestUrl = 'https://payments.bayanpay.sa/direcpay/secure/PaymentTxnServlet'; | ||
// else | ||
$requestUrl = 'https://staging.bayanpay.sa/direcpay/secure/PaymentTxnServlet'; | ||
$requestParameter = $networkOnlineObject->NeoPostData; | ||
// if($networkOnlineObject->url) | ||
// $requestUrl = 'https://www.timesofmoney.com/direcpay/secure/PaymentTxnServlet'; | ||
// else | ||
$requestUrl = 'https://staging.bayanpay.sa/direcpay/secure/PaymentTxnServlet'; | ||
?> | ||
<form action="<?php echo $requestUrl; ?>" method="post" name="BayanPay_online_payment" | ||
id="BayanPay_online_payment"> | ||
<?php echo '<input type="hidden" name="requestParameter" value='.$requestParameter.'>'; ?> | ||
<input type="submit" value="Submit"> | ||
</form> | ||
<?php | ||
echo '<form action="'.$requestUrl.'" method="post" name="network_online_payment" | ||
id="network_online_payment"> | ||
<input type="hidden" name="requestParameter" value='.$requestParameter.'> | ||
<input type="submit" value="Submit"> | ||
</form>'; | ||
} | ||
function baseurl(){ | ||
if(isset($_SERVER['HTTPS'])){ | ||
$protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; | ||
} | ||
else{ | ||
$protocol = 'http'; | ||
} | ||
return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | ||
} | ||
function baseurl(){ | ||
if(isset($_SERVER['HTTPS'])) | ||
$protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; | ||
else | ||
$protocol = 'http'; | ||
return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | ||
} | ||
} | ||
\ No newline at end of file |
Please
register
or
sign in
to comment