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