Файловый менеджер - Редактировать - /var/www/html/toyyibpay.zip
Ðазад
PK ! �,G�� � ( src/Message/CompletePurchaseResponse.phpnu �[��� <?php namespace Omnipay\ToyyibPay\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RequestInterface; use Omnipay\Common\Message\RedirectResponseInterface; /** * toyyibPay Create a Bill Response */ class CompletePurchaseResponse extends AbstractResponse implements RedirectResponseInterface { private static function paymentStatus($value) { switch ($value) { case 1: $status = 'Successful transaction'; break; case 2: $status = 'Pending transaction'; break; case 3: $status = 'Unsuccessful transaction'; break; case 4: $status = 'Pending'; break; default: $status = 'Sorry, there was an error in getting your Bill Transactions. Please try again later or contact administrator for further assistance.'; } return $status; } public function __construct(RequestInterface $request, $data) { $this->request = $request; $this->data = $data; } public function isSuccessful() { return isset($this->data['billpaymentStatus']) && $this->data['billpaymentStatus'] == 1 ? true : false; } public function getTransactionReference() { return $this->data['billPermalink']; } public function getTransactionId() { return $this->data['billpaymentInvoiceNo']; } /** * Only redirect if the status is not 1 = Successful Transaction. * * @return bool */ public function isRedirect() { return isset($this->data['billpaymentStatus']) && $this->data['billpaymentStatus'] != 1 ? true : false; } /** * @return array empy array; all the data is in the GET URL */ public function getRedirectData() { return []; } /** * @return string Always GET */ public function getRedirectMethod() { return 'GET'; } /** * @return string|null URL if present */ public function getRedirectUrl() { return isset($this->data['billUrl']) ? $this->data['billUrl'] : null; } public function getMessage() { return isset($this->data['billpaymentStatus']) ? self::paymentStatus($this->data['billpaymentStatus']) : 'Bill code is not valid. Please try again later or contact administrator for further assistance.'; } } PK ! TT-� � src/Message/PurchaseResponse.phpnu �[��� <?php namespace Omnipay\ToyyibPay\Message; use Omnipay\Common\Message\AbstractResponse; use Omnipay\Common\Message\RequestInterface; use Omnipay\Common\Message\RedirectResponseInterface; /** * toyyibPay Create a Bill Response */ class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface { /** * The initial Server response is never complete without * redirecting the user. * * @return bool false */ public function isSuccessful() { return false; } /** * Only redirect if the status indicates the pre-auth details are acceptable. * * @return bool */ public function isRedirect() { return isset($this->data['BillCode']) ? true : false; } /** * @return string|null URL if present */ public function getRedirectUrl() { return isset($this->data['redirectUrl']) ? $this->data['redirectUrl'] : null; } /** * @return array empy array; all the data is in the GET URL */ public function getRedirectData() { return []; } /** * @return string Always GET */ public function getRedirectMethod() { return 'GET'; } public function getMessage() { return 'Sorry, there was an error in creating your bill payment. Please try again later or contact administrator for further assistance.'; } } PK ! \�G� � src/Message/AbstractRequest.phpnu �[��� <?php namespace Omnipay\ToyyibPay\Message; use Omnipay\Common\Message\AbstractRequest as BaseAbstractRequest; abstract class AbstractRequest extends BaseAbstractRequest { protected $productionEndpoint = 'https://toyyibpay.com/'; protected $sandboxEndpoint = 'https://toyyibpay.com/'; public function getUserSecretKey() { return $this->getParameter('userSecretKey'); } public function setUserSecretKey($value) { return $this->setParameter('userSecretKey', $value); } public function getCategoryCode() { return $this->getParameter('categoryCode'); } public function setCategoryCode($value) { return $this->setParameter('categoryCode', $value); } public function getBillName() { return $this->getParameter('billName'); } public function setBillName($value) { return $this->setParameter('billName', $value); } public function getBillDescription() { return $this->getParameter('billDescription'); } public function setBillDescription($value) { return $this->setParameter('billDescription', $value); } public function getBillPriceSetting() { return $this->getParameter('billPriceSetting'); } public function setBillPriceSetting($value) { return $this->setParameter('billPriceSetting', $value); } public function getBillPayorInfo() { return $this->getParameter('billPayorInfo'); } public function setBillPayorInfo($value) { return $this->setParameter('billPayorInfo', $value); } public function getBillAmount() { return $this->getParameter('billAmount')*100; } public function setBillAmount($value) { return $this->setParameter('billAmount', $value); } public function getBillReturnUrl() { return $this->getParameter('billReturnUrl'); } public function setBillReturnUrl($value) { return $this->setParameter('billReturnUrl', $value); } public function getBillCallbackUrl() { return $this->getParameter('billCallbackUrl'); } public function setBillCallbackUrl($value) { return $this->setParameter('billCallbackUrl', $value); } public function getBillExternalReferenceNo() { return $this->getParameter('billExternalReferenceNo'); } public function setBillExternalReferenceNo($value) { return $this->setParameter('billExternalReferenceNo', $value); } public function getBillTo() { return $this->getParameter('billTo'); } public function setBillTo($value) { return $this->setParameter('billTo', $value); } public function getBillEmail() { return $this->getParameter('billEmail'); } public function setBillEmail($value) { return $this->setParameter('billEmail', $value); } public function getBillPhone() { return $this->getParameter('billPhone'); } public function setBillPhone($value) { return $this->setParameter('billPhone', $value); } public function getBillSplitPayment() { return $this->getParameter('billSplitPayment'); } public function setBillSplitPayment($value) { return $this->setParameter('billSplitPayment', $value); } public function getBillSplitPaymentArgs() { return $this->getParameter('billSplitPaymentArgs'); } public function setBillSplitPaymentArgs($value) { return $this->setParameter('billSplitPaymentArgs', $value); } public function getBillPaymentChannel() { return $this->getParameter('billPaymentChannel'); } public function setBillPaymentChannel($value) { return $this->setParameter('billPaymentChannel', $value); } public function getBillDisplayMerchant() { return $this->getParameter('billDisplayMerchant'); } public function setBillDisplayMerchant($value) { return $this->setParameter('billDisplayMerchant', $value); } public function getBillContentEmail() { return $this->getParameter('billContentEmail'); } public function setBillContentEmail($value) { return $this->setParameter('billContentEmail', $value); } public function getBillAdditionalField() { return $this->getParameter('billAdditionalField'); } public function setBillAdditionalField($value) { return $this->setParameter('billAdditionalField', json_encode($value)); } public function getBillChargeToCustomer() { return $this->getParameter('billChargeToCustomer'); } public function setBillChargeToCustomer($value) { return $this->setParameter('billChargeToCustomer', $value); } public function getBillCode() { return $this->getParameter('billCode'); } public function setBillCode($value) { return $this->setParameter('billCode', $value); } public function getBillpaymentStatus() { return $this->getParameter('billpaymentStatus'); } public function setBillpaymentStatus($value) { return $this->setParameter('billpaymentStatus', $value); } public function sendRequest($data) { $curl = curl_init(); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_URL, $this->getEndpoint() . $data['apiEndpoint']); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $result = curl_exec($curl); curl_close($curl); $response = json_decode($result, true); return $response; } public function getHttpMethod() { return 'POST'; } public function getEndpoint() { return $this->getTestMode() ? $this->sandboxEndpoint : $this->productionEndpoint; } } PK ! l�� � src/Message/PurchaseRequest.phpnu �[��� <?php namespace Omnipay\ToyyibPay\Message; /** * toyyibPay Create a Bill Request */ class PurchaseRequest extends AbstractRequest { protected $apiEndpoint = 'index.php/api/createBill'; protected function guardParameters() { $this->validate( 'userSecretKey', 'categoryCode', 'billName', 'billDescription', 'billPriceSetting', 'billPayorInfo', 'billAmount', 'billReturnUrl', 'billCallbackUrl', 'billExternalReferenceNo', 'billTo', 'billEmail', 'billPhone' ); } protected function createResponse($data) { return $this->response = new PurchaseResponse($this, $data); } public function getData() { $this->guardParameters(); $data = array( 'userSecretKey' => $this->getUserSecretKey(), 'categoryCode' => $this->getCategoryCode(), 'billName' => $this->getBillName(), 'billDescription' => $this->getBillDescription(), 'billPriceSetting' => $this->getBillPriceSetting(), 'billPayorInfo' => $this->getBillPayorInfo(), 'billAmount' => $this->getBillAmount(), 'billReturnUrl' => $this->getBillReturnUrl(), 'billCallbackUrl' => $this->getBillCallbackUrl(), 'billExternalReferenceNo' => $this->getBillExternalReferenceNo(), 'billTo' => $this->getBillTo(), 'billEmail' => $this->getBillEmail(), 'billPhone' => $this->getBillPhone() ); return $data; } public function sendData($data) { $data['apiEndpoint'] = $this->apiEndpoint; $httpResponse = $this->sendRequest($data); $dataResponse['BillCode'] = $httpResponse[0]['BillCode']; $dataResponse['redirectUrl'] = $this->getEndpoint() . $httpResponse[0]['BillCode']; return $this->createResponse($dataResponse); } } PK ! ��� '