Файловый менеджер - Редактировать - /home/digilove/public_html/41423/realex_hpp_api.tar
Назад
language/en-GB/en-GB.plg_vmpayment_realex_hpp_api.ini 0000644 00000062567 15232603237 0016554 0 ustar 00 ; $Id: en-GB.plg_vmpayment_realex_hpp_api.ini 10671 2022-06-01 20:07:36Z jjk $ ; @package ; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php ; Note : All ini files need to be saved as UTF-8 - No BOM VMPAYMENT_REALEX_HPP_API_PAYMENT_TITLE="Global Payments" VMPAYMENT_REALEX_HPP_API_DOCUMENTATION="Documentation" VMPAYMENT_REALEX_HPP_API_REGISTER="Sign Up at Global Payments" VMPAYMENT_REALEX_HPP_API_ACCOUNT_PARAMS="Account Credentials" VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS="Account Options" VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_3DSECURE="3D secure" VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_REALVAULT="Realvault" VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_DCC="Dynamic Currency Conversion" VMPAYMENT_REALEX_HPP_API_FRAUD_SECTION="Fraud management" VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_3DSECURE_REALVAULT="3DSecure for <strong>Realvault</strong> transactions" VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_3DSECURE_REALEX="For the Redirect - Hosted Payment Page integration your 3DSecure settings are configured by Global Payments. Please contact your account manager." VMPAYMENT_REALEX_HPP_API_URLS_SECTION="URLs" VMPAYMENT_REALEX_HPP_API_REFERRING_URL_TIP="The default Global Payments URLs. You may edit these if you're a customer of one of our whitelabel payment gateways" VMPAYMENT_REALEX_HPP_API_INTEGRATION="Integration Type" VMPAYMENT_REALEX_HPP_API_INTEGRATION_TIP="Redirect Integration: customers will be redirected to Global Payments' secure Hosted Payment Page to enter their card details; alleviating merchant PCI Compliance requirements. The Remote Integration affords the merchant greater control of the transaction process but requires that they maintain their own secure server; card details will be captured by the merchant and passed to Global Payments via XML messages." VMPAYMENT_REALEX_HPP_API_INTEGRATION_REDIRECT="Redirect - HPP" VMPAYMENT_REALEX_HPP_API_INTEGRATION_REMOTE="Remote - API" VMPAYMENT_REALEX_HPP_API_SHOP_MODE="Mode" VMPAYMENT_REALEX_HPP_API_SHOP_MODE_TIP="Select whether your Global Payments account is set to Sandbox or Live." VMPAYMENT_REALEX_HPP_API_LIVE="Live" VMPAYMENT_REALEX_HPP_API_SANDBOX="Sandbox" VMPAYMENT_REALEX_HPP_API_MERCHANT_ID="Merchant ID" VMPAYMENT_REALEX_HPP_API_MERCHANT_ID_TIP="Your Global Payments assigned Merchant ID" VMPAYMENT_REALEX_HPP_API_SHARED_SECRET="Shared Secret" VMPAYMENT_REALEX_HPP_API_SHARED_SECRET_TIP="The Shared Secret for your account as provided by your Global Payments account manager. Please note this information is highly sensitive should never be emailed." VMPAYMENT_REALEX_HPP_API_SUBACCOUNT="Sub-account" VMPAYMENT_REALEX_HPP_API_CREDITCARDS="Accepted Card Types" VMPAYMENT_REALEX_HPP_API_CREDITCARDS_TIP="The list of Accepted Card Types will be determined by your Merchant Services Agreement and your particular Global Payments Sub-account" VMPAYMENT_REALEX_HPP_API_3DSECURE="Enable 3D Secure Cardholder Authentication" VMPAYMENT_REALEX_HPP_API_3DSECURE_TIP="Verified by Visa, Mastercard SecureCode, American Express SafeKey. Please ensure to check with your Global Payments account manager before enabling or disabling this feature." VMPAYMENT_REALEX_HPP_API_LIABILITY_SHIFT="Liability Shift Required" VMPAYMENT_REALEX_HPP_API_LIABILITY_SHIFT_TIP="Enable this to only accept transactions which provide additional chargeback protection under 3D Secure rules. Transactions failing this criteria will be blocked and the customer returned to the checkout page. Please ensure to check with your Global Payments account manager before enabling or disabling this feature. You should also check with your Acquiring Bank regarding their own chargeback rules." VMPAYMENT_REALEX_HPP_API_REALVAULT="RealVault - Secure Card Storage" VMPAYMENT_REALEX_HPP_API_REALVAULT_TIP="Allow customers to save their card for easy re-use using Global Payments' secure card storage solution; RealVault. All card data is handled by Global Payments. Please ensure to check with your Global Payments account manager before enabling or disabling this feature." VMPAYMENT_REALEX_HPP_API_OFFER_SAVE_CARD="Offer 'Save Card Details' choice to the customer" VMPAYMENT_REALEX_HPP_API_OFFER_SAVE_CARD_TIP="Select whether or not to show the 'Save Card Details' tick box to the customer. If disabled, customers' cards will be automatically saved to Global Payments' secure card storage solution; RealVault." VMPAYMENT_REALEX_HPP_API_OPTIONAL_PARAMS="Optional parameters" VMPAYMENT_REALEX_HPP_API_TEMPLATE_SECTION="Template" VMPAYMENT_REALEX_HPP_API_LOGOS="Logos" VMPAYMENT_REALEX_HPP_API_CVV_IMAGES="CVV images" VMPAYMENT_REALEX_HPP_API_DEBUG_SECTION="Debug Mode" VMPAYMENT_REALEX_HPP_API_DEBUG_SECTION_DESC="When debug is enabled, requests, responses and debugging error messages from Global Payments will be displayed on the front-end" VMPAYMENT_REALEX_HPP_API_LOG="Log debug in file" VMPAYMENT_REALEX_HPP_API_LOG_DESC="When log is enabled, debug info will be logged in a file placed in the Virtuemart log folder." VMPAYMENT_REALEX_HPP_API_REBATE_PASSWORD="Rebate Password" VMPAYMENT_REALEX_HPP_API_REBATE_PASSWORD_TIP="The Rebate Password for your account, please note this information is highly sensitive should never be emailed." VMPAYMENT_REALEX_HPP_API_REQUIRE_LIABILITY="Liability Shift Required" VMPAYMENT_REALEX_HPP_API_REQUIRE_LIABILITY_TIP="Enable this to only accept transactions which provide additional chargeback protection under 3D Secure rules. Please ensure to check with your Global Payments account manager before enabling or disabling this feature. You should also check with your Acquiring Bank about their own policy regarding chargebacks." VMPAYMENT_REALEX_HPP_API_SETTLEMENT="Settlement Type" VMPAYMENT_REALEX_HPP_API_SETTLEMENT_TIP="Automatic Settlement captures the funds on the customer's card immediately. Delayed Settlement allows you to reserve the funds on the customer's card and then capture them within 28 days. You can settle transactions from the Virtuemart orders section." VMPAYMENT_REALEX_HPP_API_SETTLEMENT_AUTO="Automatic Settlement" VMPAYMENT_REALEX_HPP_API_SETTLEMENT_DELAYED="Delayed Settlement" VMPAYMENT_REALEX_HPP_API_SETTLEMENT_WARNING="When DCC is enabled, the Settlement Type must be Automatic" VMPAYMENT_REALEX_HPP_API_CARD_PAYMENT_BUTTON="Payment Button Text" VMPAYMENT_REALEX_HPP_API_CARD_PAYMENT_BUTTON_TIP="Use this to set what text is displayed on the payment button. If this field is not set, “Pay Now” is displayed on the button by default. In case of a multilingual website, you can use a key" VMPAYMENT_REALEX_HPP_API_TSS="Enable Transaction Suitability Score" VMPAYMENT_REALEX_HPP_API_TSS_TIP="This will return the Transaction Suitability Score for this transaction based on the rules you can setup in RealControl. For more information please see the Global Payments Fraud Management User Guide." VMPAYMENT_REALEX_HPP_API_REFERRING_URL="Referring URL" VMPAYMENT_REALEX_HPP_API_REFERRING_URL_TIP="Please supply this URL to your Global Payments account manager. You must do this before your account can be set live."; VMPAYMENT_REALEX_HPP_API_DCC="Enable Dynamic Currency Conversion (DCC)" VMPAYMENT_REALEX_HPP_API_DCC_TIP="Dynamic Currency Conversion (DCC) provides your customers with the choice to pay in the local currency of their card. Global Payments will automatically check the currency of the customer’s card and display the appropriate choice. Please ensure to check with your Global Payments account manager before enabling or disabling this feature." VMPAYMENT_REALEX_HPP_API_DCC_EUROCONEX="Elavon" VMPAYMENT_REALEX_HPP_API_DCC_FEXCO="Fexco" VMPAYMENT_REALEX_HPP_API_DCC_PAY_NOW="Pay Now" VMPAYMENT_REALEX_HPP_API_GATEWAY_URL="Gateway URL" VMPAYMENT_REALEX_HPP_API_GATEWAY_URL_TIP="Gateway URL" VMPAYMENT_REALEX_HPP_API_SANDBOX_GATEWAY_URL="Sandbox Gateway URL" VMPAYMENT_REALEX_HPP_API_SANDBOX_GATEWAY_URL_TIP="Sandbox Gateway URL" VMPAYMENT_REALEX_HPP_API_CVN_CHECKING="Enable Security Check on Tokenised Transactions" VMPAYMENT_REALEX_HPP_API_CVN_CHECKING_TIP="This will require users to enter the security code associated with their card when processing a tokenised (RealVault) transaction." VMPAYMENT_REALEX_HPP_API_NO_PLUGIN_INSTALLED="The plugin of type vmuserfield Global Payments is not installed" VMPAYMENT_REALEX_HPP_API_CREATE_USERFIELD_OK="Global Payments User Field created" VMPAYMENT_REALEX_HPP_API_CREATE_USERFIELD_FAILED="Could not create Global Payments user field" VMPAYMENT_REALEX_HPP_API_CC_VISA="Visa" VMPAYMENT_REALEX_HPP_API_CC_MC="Mastercard" VMPAYMENT_REALEX_HPP_API_CC_DELTA="Delta" VMPAYMENT_REALEX_HPP_API_CC_AMEX="American Express" VMPAYMENT_REALEX_HPP_API_CC_LASER="Laser" VMPAYMENT_REALEX_HPP_API_CC_DINERS="Diners Club" VMPAYMENT_REALEX_HPP_API_CC_MAESTRO="Maestro" VMPAYMENT_REALEX_HPP_API_CC_SWITCH="Switch/Solo" VMPAYMENT_REALEX_HPP_API_RESPONSE_TYPE="type" VMPAYMENT_REALEX_HPP_API_DCC_SERVICE="DCC service" VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY="Pay In Your Own Currency" VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_TIP="The total amount due is <strong>%2$s %1$s</strong>. We notice that you have a %4$s card. For your convenience we can charge this to you as <strong>%3$s %4$s</strong>" VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_EXCHANGE_RATE="(Exchange rate used: %1$s %2$s = %3$s %4$s)" VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_WARNING="I understand that I have been offered a choice of currencies for payment. I accept the conversion rate and final amount and that the final selected transaction currency is the cardholder's chosen currency, %1$s" VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_CHARGED="The total amount due is %2$s %1$s. You are charged as <strong>%3$s %4$s</strong>." VMPAYMENT_REALEX_HPP_API_DCC_PAY_MERCHANT_CURRENCY="You are charged as %1$s %2$s." VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_NO="NO, Please charge me %1$s %2$s" VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_YES="YES, Please charge me %1$s %2$s" VMPAYMENT_REALEX_HPP_API_CC_SANDBOX_INFO="You are using the Sandbox mode." VMPAYMENT_REALEX_HPP_API_CC_COMPLETE_FORM="Please enter your card details: " VMPAYMENT_REALEX_HPP_API_CC_ADD_NEW="Use another card:" VMPAYMENT_REALEX_HPP_API_CC_CCTYPE="Card Type: " VMPAYMENT_REALEX_HPP_API_CC_EXPDATE="Expiration Date: " VMPAYMENT_REALEX_HPP_API_CC_CCNUM="Card Number: " VMPAYMENT_REALEX_HPP_API_CC_CVV2="Security Code: " VMPAYMENT_REALEX_HPP_API_CC_EXDATE="Expiry Date: " VMPAYMENT_REALEX_HPP_API_CC_CCNAME="Card Name: " VMPAYMENT_REALEX_HPP_API_CC_CARD_TYPE_INVALID="Card Type Invalid" VMPAYMENT_REALEX_HPP_API_CC_CARD_NUMBER_INVALID="Card Number Invalid" VMPAYMENT_REALEX_HPP_API_CC_CARD_EXPIRATION_DATE_INVALID="Expiry Date Invalid" VMPAYMENT_REALEX_HPP_API_CC_CARD_CVV_INVALID="Card Security Code Number Invalid or Missing" VMPAYMENT_REALEX_HPP_API_CC_NAME_INVALID="Card Name is missing" VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV="What is Security Code?" VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV_TOOLTIP="Security Code (CVV / CVN / CV2) is the three or four-digit number on the back of a card (on the front for American Express).%1$s" VMPAYMENT_REALEX_HPP_API_CC_YOUR_CC="Card Information" VMPAYMENT_REALEX_HPP_API_PARAMETER_REQUIRED="The parameter <em>%1$s</em> is required for the payment <em>%2$s</em> (<em>%3$s</em>)" VMPAYMENT_REALEX_HPP_API_PLEASE_SELECT="Please select your saved card(s)" VMPAYMENT_REALEX_HPP_API_USE_ANOTHER_CC="Use another card" VMPAYMENT_REALEX_HPP_API_PLEASE_SELECT_OPTION="Please select an option" VMPAYMENT_REALEX_HPP_API_OFFERSAVECARD="We can securely save your card details for future use." VMPAYMENT_REALEX_HPP_API_OFFERSAVECARD_YES="Save my card details" VMPAYMENT_REALEX_HPP_API_NOTIFY_SUCCESS="Your order %1$s has been successfully processed" VMPAYMENT_REALEX_HPP_API_NOTIFY_DECLINED="There was a problem processing your order %1$s" VMPAYMENT_REALEX_HPP_API_NOTIFY_RETURN_URL="Click here to return to %1$s" VMPAYMENT_REALEX_HPP_API_COMMENT1="Payment of %1$s for order %2$s on %3$s" VMPAYMENT_REALEX_HPP_API_COMMENT2="Return to %1$s" VMPAYMENT_REALEX_HPP_API_ORDER_STATUS_SECTION="Order status" VMPAYMENT_REALEX_HPP_API_ORDER_STATUS_SECTION_DESC="Select the order status that will be applied based on transaction result" VMPAYMENT_REALEX_HPP_API_STATUS_CANCEL="Unsuccessful Orders" VMPAYMENT_REALEX_HPP_API_STATUS_CANCEL_TIP="Select the status for orders which have been unsuccessful. If you are using Delayed Settlement and the order status is set to 'Pending' this will trigger a Void request. This will release the reserved funds from the customers card." VMPAYMENT_REALEX_HPP_API_STATUS_PENDING="Pending Orders" VMPAYMENT_REALEX_HPP_API_STATUS_PENDING_TIP="Select the status for orders which have not been processed yet. The order was not cancelled in this case; it is just pending and waiting for completion or to be settled." VMPAYMENT_REALEX_HPP_API_STATUS_REBATE="Rebated Orders" VMPAYMENT_REALEX_HPP_API_STATUS_REBATE_TIP="Select the status for orders to trigger a Rebate request. Orders may only be rebated within 180 days of the original authorization. This will return the captured funds to the customer's card." VMPAYMENT_REALEX_HPP_API_STATUS_PARTIAL_REFUND="Partially Rebated Orders" VMPAYMENT_REALEX_HPP_API_STATUS_PARTIAL_REFUND_TIP="Select the status for orders to trigger a Partial Rebate request. Orders may only be rebated within 180 days of the original authorization. This will return the captured funds to the customer's card." VMPAYMENT_REALEX_HPP_API_STATUS_SUCCESS="Successful Orders" VMPAYMENT_REALEX_HPP_API_STATUS_SUCCESS_TIP="Select the status for orders which have been successful. If using 'Download' selling options: select the status which enables the download (then the customer is instantly notified about the download via e-mail)." VMPAYMENT_REALEX_HPP_API_STATUS_CAPTURE="Settled Orders" VMPAYMENT_REALEX_HPP_API_STATUS_CAPTURE_TIP="Select the order status to trigger a Settle request. Orders may only be settled within 28 days of the original authorization." VMPAYMENT_REALEX_HPP_API_NO_ACTION="No action performed on payment" VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED="Your order of <strong>%1$s</strong> for <strong>%2$s</strong> was successful." VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED="There was a problem processing your order, please try again or contact the store administrator." VMPAYMENT_REALEX_HPP_API_PAYMENT_DECLINED="There was a problem processing your order %1$s, please try again or contact the store administrator." VMPAYMENT_REALEX_HPP_API_PAYMENT_TOTAL="Payment of %1$s" ;-------------------- ; Currencies ;-------------------- VMPAYMENT_REALEX_HPP_API_CURRENCIES_SECTION="Currencies" VMPAYMENT_REALEX_HPP_API_CURRENCIES_SECTION_DESC="Select the payment and email currencies for this payment method" VMPAYMENT_REALEX_HPP_API_CURRENCY="Payment Currency" VMPAYMENT_REALEX_HPP_API_CURRENCY_DESC="Currency accepted for the payment" VMPAYMENT_REALEX_HPP_API_EMAIL_CURRENCY="Email Currency" VMPAYMENT_REALEX_HPP_API_EMAIL_CURRENCY_DESC="Email currency" VMPAYMENT_REALEX_HPP_API_EMAIL_CURRENCY_PAYMENT="Payment currency" VMPAYMENT_REALEX_HPP_API_EMAIL_CURRENCY_VENDOR="Vendor currency" ;-------------- ; Restrictions ;-------------- VMPAYMENT_REALEX_HPP_API_RESTRICTIONS_SECTION="Restrictions" VMPAYMENT_REALEX_HPP_API_RESTRICTIONS_SECTION_DESC="Fill out filters to disable the payment option based on customer and his cart.<br/>Amount are based on the vendor currency" VMPAYMENT_REALEX_HPP_API_COUNTRIES="Countries" VMPAYMENT_REALEX_HPP_API_COUNTRIES_DESC="Please select the countries for which this payment method applies. If no country is selected, this payment method will be applied for all countries" VMPAYMENT_REALEX_HPP_API_MIN_AMOUNT="Minimum Amount" VMPAYMENT_REALEX_HPP_API_MIN_AMOUNT_TIP="Minimum Order Amount to offer this Payment" VMPAYMENT_REALEX_HPP_API_MAX_AMOUNT="Maximum Amount" VMPAYMENT_REALEX_HPP_API_MAX_AMOUNT_TIP="Maximum Order Amount to offer this Payment" ;-------------------- ; Discounts ;-------------------- VMPAYMENT_REALEX_HPP_API_DISCOUNT_FEE_SECTION="Discounts and Fees" VMPAYMENT_REALEX_HPP_API_DISCOUNT_FEE_SECTION_DESC="Enter discounts or Fees that will be applied when the payment option is selected" VMPAYMENT_REALEX_HPP_API_WARNING="<font color='red'><b>Warning</b></font> - For subscriptions and Payment plans, if the payment method adds discounts, they will be collected as an initial non-recurring payment." VMPAYMENT_REALEX_HPP_API_COST_PERCENT_TOTAL="Percent of the total amount" VMPAYMENT_REALEX_HPP_API_COST_PERCENT_TOTAL_TIP="Percent to apply to the total product amount. Shipment cost are not included" VMPAYMENT_REALEX_HPP_API_COST_PER_TRANSACTION="Fee per transaction" VMPAYMENT_REALEX_HPP_API_COST_PER_TRANSACTION_TIP="Flat amount to apply per transaction" VMPAYMENT_REALEX_HPP_API_TAX="Tax" VMPAYMENT_REALEX_HPP_API_TAX_TIP="Tax to apply to the fee" VMPAYMENT_REALEX_HPP_API_DATE="Date" VMPAYMENT_REALEX_HPP_API_VIEW_TRANSACTION_LOG="View transaction log" VMPAYMENT_REALEX_HPP_API_REDIRECT_MESSAGE="Please wait while redirecting" ;---------- ; messages ;---------- VMPAYMENT_REALEX_HPP_API_SAVE_CARD_DETAILS="Save my Card Details" VMPAYMENT_REALEX_HPP_API_SAVE_CARD_DETAILS_TIP="We'll securely store your card details for future orders. To avail of this service please tick the checkbox." VMPAYMENT_REALEX_HPP_API_SAVE_CARD_DETAILS_YES="My card details will be stored for future orders." VMPAYMENT_REALEX_HPP_API_ERROR_NO_SECRET="The parameter 'Shared Secret' is missing" VMPAYMENT_REALEX_HPP_API_ERROR_TRY_AGAIN="There was a problem processing your order, please try again or contact the store administrator." VMPAYMENT_REALEX_HPP_API_ERROR_CHOOSE_ANOTHER_PAYMENT="There was a problem processing your order. Please try again or contact the store administrator." VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_SUCCESS="Card Details Successfully Saved" VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_FAILED="An error occurred, your card details have not been saved. Please contact the store administrator." VMPAYMENT_REALEX_HPP_API_ERROR_DELETE_CC="An error occurred, your card details were not deleted. Please try again or contact the store administrator."; VMPAYMENT_REALEX_HPP_API_ERROR_WRONG_HASH="Hash has not been validated: calculated hash %1$s, received hash:%2$s"; VMPAYMENT_REALEX_HPP_API_ERROR_NOT_SETTLE="There was a problem processing the Settle request. The order has not be settled." VMPAYMENT_REALEX_HPP_API_ERROR_REBATE_SETTLE_FIRST="You can't Rebate a transaction that hasn't been Settled yet (order number %1$s)." VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_REBATE="There was a problem processing the Rebate request. The order has not be rebated." VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_SETTLE="Cannot settle your transaction" VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_VOID="Cannot void your transaction" VMPAYMENT_REALEX_HPP_API_3DS_VERIFICATION="3D Secure Cardholder Authentication" VMPAYMENT_REALEX_HPP_API_UPDATE_STATUS_REBATE="The order has been successfully rebated" VMPAYMENT_REALEX_HPP_API_UPDATE_STATUS_CANCELED="The order has been successfully voided" VMPAYMENT_REALEX_HPP_API_UPDATE_STATUS_CAPTURE="The order has been successfully settled" VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_VOID_LAST_TRANSACTION_NOT_AUTH="Cannot Void order: Last transaction is not a Authorization transaction" VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_VOID_TIME="Cannot Void order. Authorization request was done: %1$s" VMPAYMENT_REALEX_HPP_API_ERROR_REBATE_DCC_TRANSACTION="Cannot rebate this order: the transaction uses DCC" VMPAYMENT_REALEX_HPP_API_ORDER_BE_CAPTURE="Settle" VMPAYMENT_REALEX_HPP_API_ORDER_BE_REBATE="Rebate" VMPAYMENT_REALEX_HPP_API_ORDER_BE_AMOUNT="Amount" VMPAYMENT_REALEX_HPP_API_UPDATEPAYMENT_UNKNOWN_ACTION="Unknown action. Please try again" ;-------------------- ; Response codes ;-------------------- VMPAYMENT_REALEX_HPP_API_RESPONSE_PASREF="Transaction Reference" VMPAYMENT_REALEX_HPP_API_RESPONSE_CVNRESULT="Security Code Check" VMPAYMENT_REALEX_HPP_API_RESPONSE_CVNRESULT_M="Security Code Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_CVNRESULT_N="Security Code Not Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_CVNRESULT_I="Security Code not checked due to circumstances" VMPAYMENT_REALEX_HPP_API_RESPONSE_CVNRESULT_U="CVV Not checked – issuer not certified" VMPAYMENT_REALEX_HPP_API_RESPONSE_CVNRESULT_P="CVV Not Processed" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCCHOICE="DCC option" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCRATE="Exchange rate" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCMERCHANTAMOUNT="Original amount of the transaction" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCCARDHOLDERAMOUNT="Amount of the transaction in the cardholder’s card currency" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCMERCHANTCURRENCY="Original currency of the transaction" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCMARGINRATEPERCENTAGE="Foreign exchange margin that is applied to the transaction" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCEXCHANGERATESOURCENAME="Source of the exchange rate" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCCOMMISSIONPERCENTAGE="Commission percentage" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCEXCHANGERATESOURCETIMESTAMP="Timestamp" VMPAYMENT_REALEX_HPP_API_RESPONSE_DCCCARDHOLDERCURRENCY="Currency of the cardholder’s card" VMPAYMENT_REALEX_HPP_API_RESPONSE_AUTHCODE="Authcode" VMPAYMENT_REALEX_HPP_API_NO_RESPONSE="No response from payment gateway" VMPAYMENT_REALEX_HPP_API_RESPONSE_REALWALLET_CHOSEN="Card details saved" VMPAYMENT_REALEX_HPP_API_RESPONSE_REALWALLET_CHOSEN_1="Yes" VMPAYMENT_REALEX_HPP_API_RESPONSE_REALWALLET_CHOSEN_0="No" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESULT="Post Code Check" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESULT_M="Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESULT_N="Not Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESULT_I="Problem with check" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESULT_U="Unable to check (not certified etc)" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESULT_P="Partial Match" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESULT="Address Verification Service" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESULT_M="Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESULT_N="Not Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESULT_I="Problem with check" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESULT_U="Unable to check (not certified etc)" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESULT_P="Partial Match" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESPONSE="Post Code Check" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESPONSE_M="Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESPONSE_N="Not Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESPONSE_I="Problem with check" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESPONSE_U="Unable to check (not certified etc)" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSPOSTCODERESPONSE_P="Partial Match" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESPONSE="Address Verification Service" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESPONSE_M="Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESPONSE_N="Not Matched" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESPONSE_I="Problem with check" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESPONSE_U="Unable to check (not certified etc)" VMPAYMENT_REALEX_HPP_API_RESPONSE_AVSADDRESSRESPONSE_P="Partial Match" VMPAYMENT_REALEX_HPP_API_RESPONSE_THREEDSECURE="3D Secure" VMPAYMENT_REALEX_HPP_API_RESPONSE_THREEDSECURE_STATUS="3D Secure status" VMPAYMENT_REALEX_HPP_API_RESPONSE_THREEDSECURE_STATUS_Y="Cardholder successfully authenticated" VMPAYMENT_REALEX_HPP_API_RESPONSE_THREEDSECURE_STATUS_N="Cardholder did not authenticate successfully" VMPAYMENT_REALEX_HPP_API_RESPONSE_THREEDSECURE_STATUS_A="Cardholder is enrolled and the bank acknowledges the attempted authentication." VMPAYMENT_REALEX_HPP_API_RESPONSE_THREEDSECURE_STATUS_U="Cardholder authentication temporarily unavailable – no liability shift available." VMPAYMENT_REALEX_HPP_API_RESPONSE_THREEDSECURE_ECI="ECI" VMPAYMENT_REALEX_HPP_API_RESPONSE_CAVV="Cardholder Authentication Verification Value" VMPAYMENT_REALEX_HPP_API_RESPONSE_TSS="Transaction Suitability Score" VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT="Result" VMPAYMENT_REALEX_HPP_API_RESPONSE_MESSAGE="Message" VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_00="Successful" VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_1="A failed transaction." VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_101="Declined by Bank – generally insufficient funds or incorrect expiry date." VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_102="Referral by Bank (treat as decline in automated system such as internet)" VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_103="Card reported lost or stolen" VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_107="Your fraud checks blocked the transaction." VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_2="Error with bank systems" VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_3="Error with Global Payments systems" VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_5="Incorrect XML message formation or content.Configuration issue – check the message. You may need to contact Global Payments support to fix these issues." VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_508="Development issue – check the message and correct your integration." VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_509="Customer issue – check the message and ask the customer to confirm their payment details and try again." VMPAYMENT_REALEX_HPP_API_RESPONSE_RESULT_666="Client deactivated – your Global Payments account has been suspended. Contact Global Payments support for further information." VMPAYMENT_REALEX_HPP_API_INVALID_PAYMENT_DETAILS="There was an error processing your payment.<br />%1$s.<br />Please check your payment details and try again." VMPAYMENT_REALEX_HPP_API_INVALID_PAYMENT_DETAILS_REALVAULT="There was an error processing your payment.<br />%1$s.<br />Please check <a href='%2$s'>your payment details</a> and try again." realex_hpp_api/assets/css/admin.css 0000644 00000000734 15232603237 0013427 0 ustar 00 .realex_title { margin: 10px 0 5px 0; font-weight: bold; padding: 5px; float: none; clear: both; background-color: #FFFFFF !important; height: 40px; padding-left: 100px !important; } .level1 { background-color: #7c7d7f !important; } .level2, .level1 { margin: 10px 0 5px 0; font-weight: bold; padding: 5px; float: none; clear: both; } .level2 { background-color: #cacaca; } .level3 { font-weight: bold; } realex_hpp_api/assets/css/realex.css 0000644 00000004254 15232603237 0013620 0 ustar 00 .remote_cc_form .vmpayment_label { width: 30%; display: inline-table; } .remote_cc_form .vmpayment_cardinfo { font-size: 100% !important; line-height: 170%; } .remote_cc_form .vmpayment_cardinfo_text { font-weight: bold; border-bottom: 1px solid #CCC; margin-top: 15px; margin-bottom: 10px; color: #333; } .vmpayment_cc_cvv_realvault .vmpayment_label { font-weight: bold; margin-top: 15px; margin-bottom: 10px; } .creditcardsDropDown input { margin: 5px; } .remote_cc_form .inputbox { width: 220px; background-position: 0 -160px; border: solid lightgray 1px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; font-size: 12px; cursor: pointer; letter-spacing: 1px; display: inline-block; text-decoration: none; padding: 3px 12px 1px; } .remote_cc_form .cc_cvv { width: 100px; } .remote_cc_form .remote_save_card { font-weight: bold; } .vmpayment_enter_cc { color: #00a000; } .vmpayment_description { display: block; font-size: 100%; } .vmpayment_selected_cc { color: gray; } div.dcc_card_payment_button { text-align: center; margin-top: 15px; } .dcc_offer_title, .realex_payment_name { font-weight: bold; border-bottom: 1px solid #CCC; margin-top: 15px; } .dcc_box, .realex_response { min-height: 20px; padding: 19px; margin-bottom: 20px; border: 1px solid #e3e3e3; line-height: 20px; } .dcc_offer_legal { color: #898989; text-align: center; font-style: italic; font-size: 70%; padding-bottom: 0; margin-bottom: -10px; } .dcc_offer_exchange_rate { margin: 10px 0; } .dcc_choices { text-align: center; } .dcc_choice { background: #e8e8e8; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; cursor: pointer; text-align: center; letter-spacing: 1px; display: inline-block; text-decoration: none; margin: 20px; padding: 6px 12px 3px; font-weight: bold; } .dcc_card_payment_button span.addtocart-button { float: none; } .dcc_choice input { margin-right: 10px; } .realex_vieworder { margin-top: 10px; } realex_hpp_api/assets/js/admin.js 0000644 00000010705 15232603237 0013076 0 ustar 00 /** * * Realex payment plugin * * @author Valérie Isaksen * @version $Id: admin.js 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ jQuery().ready(function ($) { /************/ /* Handlers */ /************/ handleIntegrationParameters = function () { var integration = $('#params_integration').val(); $('.redirect, .remote').parents('.control-group').hide(); if (integration == 'redirect') { $('.redirect').parents('.control-group').show(); } else if (integration == 'remote') { $('.remote').parents('.control-group').show(); } } handleRealvault = function () { var realvault = $('#params_realvault').val(); var integration = $('#params_integration').val(); $('.redirect-realvault').parents('.control-group').hide(); $('.redirect-norealvault').parents('.control-group').hide(); $('.realvault-param').parents('.control-group').hide(); $('.realvault').parents('.control-group').hide(); $('.norealvault').parents('.control-group').hide(); if (integration == 'redirect') { if (realvault == 1) { $('.redirect-realvault').parents('.control-group').show(); $('.realvault').parents('.control-group').show(); $('.realvault-param').parents('.control-group').show(); } else { $('.redirect-norealvault').parents('.control-group').show(); $('#params_threedsecure option').eq(0).attr('selected', 'selected'); // depends on the chosen version $('#params_threedsecure').trigger("chosen:updated"); //newer $("#params_threedsecure").trigger("liszt:updated"); // our } } else { if (realvault == 1) { $('.realvault-param').parents('.control-group').show(); } $('.realvault').parents('.control-group').show(); } } handleSettlement = function () { var settlement = $('#params_settlement').val(); $('.settlement').parents('.control-group').hide(); if (settlement == 'delayed') { $('.settlement').parents('.control-group').show(); } } handlethreedsecure = function () { var threedsecure = $('#params_threedsecure').val(); var realvault = $('#params_realvault').val(); var integration = $('#params_integration').val(); $('.threedsecure').parents('.control-group').hide(); if ((threedsecure == 1 && integration == 'redirect' && realvault == 1) || (threedsecure == 1 && integration == 'remote')) { $('.threedsecure').parents('.control-group').show(); } } handleDcc = function () { var dcc = $('#params_dcc').val(); $('.dcc').parents('.control-group').hide(); $('.nodcc').parents('.control-group').hide(); if (dcc == 1) { $('.dcc').parents('.control-group').show(); } if (dcc == 0) { $('.nodcc').parents('.control-group').show(); } } handleAutoComplete = function () { $('#params_merchant_id').attr('autocomplete', 'off'); } /**********/ /* Events */ /**********/ $('#params_integration').change(function () { handleIntegrationParameters(); handleRealvault(); }); $('#params_realvault').change(function () { handleRealvault(); }); $('#params_settlement').change(function () { handleSettlement(); }); $('#params_dcc').change(function () { handleDcc(); }); $('#params_threedsecure').change(function () { handlethreedsecure(); }); /*****************/ /* Initial calls */ /*****************/ handleIntegrationParameters(); handleRealvault(); handleSettlement(); handleDcc(); handlethreedsecure(); handleAutoComplete(); }); realex_hpp_api/assets/js/site.js 0000644 00000003104 15232603237 0012745 0 ustar 00 /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: site.js 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ jQuery().ready(function ($) { /************/ /* Handlers */ /************/ handleRealexRemoteCCForm = function () { var hasCreditcardsDropDownClass = $("#vmpayment_cardinfo > *").hasClass("creditcardsDropDown"); if (hasCreditcardsDropDownClass) { var CCselected = $(".creditcardsDropDown input[type='radio']:checked").val(); $('.realexRemoteCCForm').hide(); $('.vmpayment_cc_cvv_realvault').show(); if (CCselected == -1) { $('.realexRemoteCCForm').show(); $('.vmpayment_cc_cvv_realvault').hide(); } } } /**********/ /* Events */ /**********/ $('.realexListCC').change(function () { handleRealexRemoteCCForm(); }); /*****************/ /* Initial calls */ /*****************/ handleRealexRemoteCCForm(); }); realex_hpp_api/fields/creditcards.php 0000644 00000004066 15232603237 0014003 0 ustar 00 <?php defined('_JEXEC') or die('Restricted access'); /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: creditcards.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'config.php'); if (!class_exists('ShopFunctions')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php'); } if (!class_exists('vmPSPlugin')) { require(VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php'); } if (!class_exists('RealexHelperRealex')) { require(VMPATH_ROOT . DS.'plugins'. DS .'vmpayment'. DS .'realex_hpp_api'. DS .'realex_hpp_api'. DS .'helpers'. DS .'helper.php'); } /** * @copyright Copyright (C) 2009 Open Source Matters. All rights reserved. * @license GNU/GPL */ // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); /** * Renders a multiple item select element * */ JFormHelper::loadFieldClass('list'); jimport('joomla.form.formfield'); class JFormFieldCreditCards extends JFormFieldList { /** * Element name * * @access protected * @var string */ public $type = 'creditcards'; protected function getOptions() { $creditcards = RealexHelperRealex::getRealexCreditCards(); $prefix = 'VMPAYMENT_REALEX_HPP_API_CC_'; foreach ($creditcards as $creditcard) { $options[] = JHtml::_('select.option', $creditcard, vmText::_($prefix . strtoupper($creditcard))); } return $options; } } realex_hpp_api/fields/getrealex.php 0000644 00000003142 15232603237 0013466 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: getrealex.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('JPATH_BASE') or die(); jimport('joomla.form.formfield'); class JFormFieldGetRealex extends JFormField { /** * Element name * * @access protected * @var string */ public $type = 'getrealex'; protected function getInput() { vmJsApi::addJScript( '/plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/js/admin.js'); vmJsApi::css( 'admin','plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/css/'); $url = "http://www.realexpayments.com/partner-referral?id=virtuemart"; $html = ''; $html .= '<p><a target="_blank" href="' . $url . '" class="signin-button-link">' . vmText::_('VMPAYMENT_REALEX_HPP_API_REGISTER') . '</a>'; $html .= ' <a target="_blank" href="http://docs.virtuemart.net/manual/shop-menu/payment-methods/realex-hpp-and-api.html" class="signin-button-link">' . vmText::_('VMPAYMENT_REALEX_HPP_API_DOCUMENTATION') . '</a></p>'; return $html; } } realex_hpp_api/fields/referringurl.php 0000644 00000002672 15232603237 0014223 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: referringurl.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); /** * Renders a label element */ jimport('joomla.form.formfield'); class JFormFieldReferringurl extends JFormField { /** * Element name * * @access protected * @var string */ public $type = 'referringurl'; protected function getInput() { $this->value = JURI::root() . 'plugins/vmpayment/realex_hpp_api/jump.php'; $class = !empty($this->class) ? 'class="' . $this->class . '"' : 'class="text_area"'; $size = ($this->size) ? 'size="' . $this->size . '"' : ''; return '<input type="text" name="' . $this->name . '" id="' . $this->name . '" value="' . $this->value . '" ' . $class . ' ' . $size . ' />'; } } realex_hpp_api/helpers/customerdata.php 0000644 00000013400 15232603237 0014373 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: customerdata.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('_JEXEC') or die('Restricted access'); class RealexHelperCustomerData { const REALEX_FOLDERNAME = "realex"; const REALEX_SESSION = "RealexCustomerData"; private $_cc_name = ''; private $_cc_type = ''; private $_cc_number = ''; private $_cc_cvv = ''; private $_cc_cvv_realvault = ''; private $_cc_expire_month = ''; private $_cc_expire_year = ''; private $_cc_valid = false; private $_selected_method = ''; private $_saved_cc_selected = ''; private $_save_card = ''; private $_dcc_choice = ''; public function load () { //$this->_clear(); /* TODO $store = 'none'; $options['expire']= 60* 60; $session = JFactory::getSession($store,$options); */ $session = JFactory::getSession(); $sessionData = $session->get(self::REALEX_SESSION, 0, 'vm'); if (!class_exists('vmCrypt')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php'); } if (!empty($sessionData)) { $data = (object)json_decode($sessionData, true); $this->_saved_cc_selected = $data->saved_cc_selected; $this->_save_card = $data->save_card; $this->_selected_method = $data->selected_method; $this->_dcc_choice = $data->dcc_choice; $this->_cc_cvv_realvault = $data->cc_cvv_realvault; $this->_cc_type = $data->cc_type; // card information are not saved in session } } public function loadPost () { $this->_selected_method = vRequest::getInt('virtuemart_paymentmethod_id', 0); $saved_cc_selected = vRequest::getInt('saved_cc_selected', 0); //$saved_cc_selected = vRequest::getInt('saved_cc_selected' , 0); if ($saved_cc_selected) { $this->_saved_cc_selected = $saved_cc_selected; } $this->_save_card = vRequest::getInt('save_card', 0); $dcc_choice = vRequest::getInt('dcc_choice', ''); if ($dcc_choice) { $this->_dcc_choice = $dcc_choice; } $cctype = vRequest::getString('cc_type', ''); if ($cctype) { $this->_cc_type = $cctype; } /** * name on CC should be restricted to letters only. */ $cc_name = vRequest::getString('cc_name', ''); if ($cc_name) { $this->_cc_name = $cc_name; } $cc_number = vRequest::getString('cc_number', ''); if ($cc_number) { $this->_cc_number = $cc_number; } $cc_cvv = vRequest::getInt('cc_cvv', ''); if ($cc_cvv) { $this->_cc_cvv = $cc_cvv; } $cc_expire_month = vRequest::getInt('cc_expire_month', ''); if ($cc_expire_month) { $this->_cc_expire_month = $cc_expire_month; } $cc_expire_year = vRequest::getInt('cc_expire_year', ''); if ($cc_expire_year) { $this->_cc_expire_year = $cc_expire_year; } $cc_cvv_realvault = vRequest::getInt('cc_cvv_realvault', ''); if ($cc_cvv_realvault) { $this->_cc_cvv_realvault = $cc_cvv_realvault; } $this->save(); } /** * save CustomerData when realvault * @param $data * */ public function saveCustomerRealVaultData ($data) { if (isset($data['realex_hpp_api_saved_pmt_type'])) { $this->_cc_type = $data['realex_hpp_api_saved_pmt_type']; } if (isset($data['realex_hpp_api_saved_pmt_digits'])) { $this->_cc_number = $data['realex_hpp_api_saved_pmt_digits']; } if (isset($data['realex_hpp_api_saved_pmt_name'])) { $this->_cc_name = $data['realex_hpp_api_saved_pmt_name']; } $this->save(); } /** * save the cc infos returned in the md (3DSverifySig) * @param $md */ public function saveCustomerMDData ($md) { $this->_cc_type = $md['cc_type']; $this->_cc_number = $md['cc_number']; $this->_cc_name = $md['cc_name']; $this->_cc_cvv = $md['cc_cvv']; $this->_cc_expire_month = $md['cc_expire_month']; $this->_cc_expire_year = $md['cc_expire_year']; $this->save(); } /** * */ public function unsetCustomerData () { $this->_cc_type = ''; $this->_cc_name = ''; $this->_cc_number = ''; $this->_cc_cvv = ''; $this->_cc_expire_month = ''; $this->_cc_expire_year = ''; } /** * save data in session */ public function save () { $session = JFactory::getSession(); $sessionData = new stdClass(); $sessionData->selected_method = $this->_selected_method; $sessionData->saved_cc_selected = $this->_saved_cc_selected; $sessionData->save_card = $this->_save_card; $sessionData->dcc_choice = $this->_dcc_choice; $sessionData->cc_cvv_realvault = $this->_cc_cvv_realvault; $sessionData->cc_type = $this->_cc_type; // card information should not be saved in session $session->set(self::REALEX_SESSION, json_encode($sessionData), 'vm'); } /** * @param $var * @return mixed */ public function getVar ($var) { $this->load(); return $this->{'_' . $var}; } /** * @param $var * @param $val */ public function setVar ($var, $val) { $this->{'_' . $var} = $val; } public function clear () { $session = JFactory::getSession(); $session->clear(self::REALEX_SESSION, 'vm'); } /** * Remove some numbers from the CC when displaying it * when debug or log option is on * */ function getMaskedCCnumber () { if (!class_exists('shopFunctionsF')) { require(VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'); } return shopFunctionsF::mask_string($this->getVar('cc_number'), '*'); $this->getVar('cc_number'); } } realex_hpp_api/helpers/helper.php 0000644 00000247250 15232603237 0013173 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: helper.php 10812 2023-04-12 09:27:41Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2016 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('_JEXEC') or die('Restricted access'); /** * @property request_type */ class RealexHelperRealex { var $_method; var $cart; var $order; var $vendor; var $customerData; var $context; var $total; var $post_variables; var $post_string; var $requestData; var $response; var $currency_code_3; var $currency_display; var $plugin; const REQUEST_TYPE_AUTH = "auth"; const REQUEST_TYPE_RECEIPT_IN = 'receipt-in'; const REQUEST_TYPE_REBATE = "rebate"; const REQUEST_TYPE_SETTLE = "settle"; const REQUEST_TYPE_VOID = "void"; const REQUEST_TYPE_REALVAULT_3DS_VERIFYENROLLED = "realvault-3ds-verifyenrolled"; const REQUEST_TYPE_3DS_VERIFYENROLLED = "3ds-verifyenrolled"; const REQUEST_TYPE_3DS_VERIFYSIG = "3ds-verifysig"; const REQUEST_TYPE_DCCRATE = "dccrate"; const REQUEST_TYPE_REALVAULT_DCCRATE = "realvault-dccrate"; const REQUEST_TYPE_CARD_CANCEL_CARD = "card-cancel-card"; const REQUEST_TYPE_CARD_UPDATE_CARD = "card-update-card"; const REQUEST_TYPE_PAYER_NEW = "payer-new"; const REQUEST_TYPE_CARD_NEW = "card-new"; const RESPONSE_DCC_CHOICE_YES = "Yes"; const DCCRATE_RESULT_SUCCESS = '00'; const RESPONSE_CODE_SUCCESS = '00'; const RESPONSE_CODE_DECLINED = '101'; const RESPONSE_CODE_REFERRAL_B = '102'; const RESPONSE_CODE_REFERRAL_A = '103'; const RESPONSE_CODE_NOT_VALIDATED = '110'; const RESPONSE_CODE_INVALID_ORDER_ID = '501'; // This order ID has already been used - please use another one const RESPONSE_CODE_PAYER_REF_NOTEXIST = '501'; // This Payer Ref payerref does not exist const RESPONSE_CODE_INVALID_PAYER_REF_USED = '501'; // This Payer Ref payerref has already been used - please use another one const RESPONSE_CODE_INVALID_PAYMENT_DETAILS = '509'; const PAYER_SETUP_SUCCESS = "00"; const PMT_SETUP_SUCCESS = "00"; const ENROLLED_RESULT_ENROLLED = '00'; const ENROLLED_RESULT_NOT_ENROLLED = '110'; const ENROLLED_RESULT_INVALID_RESPONSE = '5xx'; const ENROLLED_RESULT_FATAL_ERROR = '220'; const ENROLLED_TAG_ENROLLED = 'Y'; const ENROLLED_TAG_UNABLE_TO_VERIFY = 'U'; const ENROLLED_TAG_NOT_ENROLLED = 'N'; /** * Response results from threedsecure = "3ds-verifysig"; */ const THREEDSECURE_STATUS_AUTHENTICATED = 'Y'; const THREEDSECURE_STATUS_NOT_AUTHENTICATED = 'N'; const THREEDSECURE_STATUS_ACKNOWLEDGED = 'A'; const THREEDSECURE_STATUS_UNAVAILABLE = 'U'; const ECI_AUTHENTICATED_VISA = 5; const ECI_LIABILITY_SHIFT_VISA = 6; const ECI_NO_LIABILITY_SHIFT_VISA = 7; const ECI_AUTHENTICATED_MASTERCARD = '2'; const ECI_LIABILITY_SHIFT_MASTERCARD = '1'; const ECI_NO_LIABILITY_SHIFT_MASTERCARD = '0'; /** * Response results REQUEST_TYPE_3DS_VERIFYSIG = "3ds-verifysig"; */ const VERIFYSIG_RESULT_VALIDATED = '00'; const VERIFYSIG_RESULT_NOT_VALIDATED = '110'; const VERIFYSIG_RESULT_INVALID_ACS_RESPONSE = '5xx'; function __construct ($method, $plugin) { if ($method->dcc) { $method->settlement = 'auto'; //$method->rebate_password = ""; } if (!$method->realvault) { $method->offer_save_card = 0; } $this->_method = $method; $this->_method->shared_secret=trim($this->_method->shared_secret); $this->_method->merchant_id=trim($this->_method->merchant_id); $this->plugin = $plugin; $session = JFactory::getSession(); $this->context = $session->getId(); } public function setTotalInPaymentCurrency ($total) { if (!class_exists('CurrencyDisplay')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php'); } $this->total = vmPSPlugin::getAmountValueInCurrency($total, $this->_method->payment_currency) * 100; $cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency); } public function getTotalInPaymentCurrency () { return $this->total; } public function setPaymentCurrency () { vmPSPlugin::getPaymentCurrency($this->_method); $this->currency_code_3 = shopFunctions::getCurrencyByID($this->_method->payment_currency, 'currency_code_3'); } public function getPaymentCurrency () { return $this->currency_code_3; } public function setContext ($context) { $this->context = $context; } public function getContext () { return $this->context; } public function setCart ($cart, $doGetCartPrices = true) { $this->cart = $cart; if ($doGetCartPrices AND !isset($this->cart->cartPrices)) { $this->cart->getCartPrices(); } } public function setOrder ($order) { $this->order = $order; } /** * The digits from the first line of the address should be concatenated with the post code digits with a '|' in the middle. * * For example: Flat 123, No. 7 Grove Park, E98 7QJ * Billing Code: '987|123', the number of digits on each side of the '|' should also be restricted to 5. * @param $address */ public function getCode ($address) { // get first digits of the address line, $digits_addr = $this->stripnonnumeric($address->address_1, 5); // get digits from zip, $digits_zip = $this->stripnonnumeric($address->zip, 5); // concatenate with | return $digits_zip . "|" . $digits_addr; } private function stripnonnumeric ($code, $maxLg) { $code = preg_replace("/[^0-9]/", "", $code); $code = substr($code, 0, $maxLg); return $code; } function _getRealexUrl () { if ($this->_method->shop_mode == 'sandbox') { //return 'https://realcontrol.sandbox.realexpayments.com'; return $this->_method->sandbox_gateway_url; } else { //return ' https://realcontrol.realexpayments.com'; return $this->_method->gateway_url; } } function redirect3DSRequest ($response) { $xml_response = simplexml_load_string($response); // Merchant Data. Any data that you would like echoed back to you by the ACS. // Useful data here is your order id and the card details (so that you can send the authorisation message on receipt of a positive authentication). // Any information in this field must be encrypted then compressed and base64 encoded. $md = $this->setMd(); // The URL that the ACS should reply to. This should be on your website and must be an HTTPS address. $url_validation = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification¬ificationTask=handle3DSRequest&order_number=' . $this->order['details']['BT']->order_number . '&pm=' . $this->order['details']['BT']->virtuemart_paymentmethod_id . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''); $this->display3DSForm((string)$xml_response->url, (string)$xml_response->pareq, $md, $url_validation); } function setMd () { if (!class_exists('vmCrypt')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php'); } $md = array( 'cc_type' => $this->customerData->getVar('cc_type'), 'cc_name' => $this->customerData->getVar('cc_name'), 'cc_number' => $this->customerData->getVar('cc_number'), 'cc_cvv' => $this->customerData->getVar('cc_cvv'), 'cc_expire_month' => $this->customerData->getVar('cc_expire_month'), 'cc_expire_year' => $this->customerData->getVar('cc_expire_year'), ); $jsonencodeMd = json_encode($md); $encryptMd = vmCrypt::encrypt($jsonencodeMd); return $encryptMd; } function getMd ($cryptedMd) { if (!class_exists('vmCrypt')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'vmcrypt.php'); } $decryptedMd = vmCrypt::decrypt($cryptedMd); $md = json_decode($decryptedMd, true); return $md; } /** * 4a. Realex send the URL of the cardholder’s bank ACS * (this is the webpage that the cardholder uses to enter their password). Also included is the PAReq (this is needed by the ACS). * POST this encoded PAReq (along with the TermURL and any merchant data you require). * This will result in the cardholder being presented with the authenticaton page where they will be asked to confirm the amount and enter their password. * 6. Once the cardholder enters their password, the ACS POSTS the encoded PARes to the merchants TermURL. * @param $url_redirect * @param $pareq * @param $md64 */ public function display3DSForm ($url_redirect, $pareq, $md, $url_validation) { ?> <HTML> <HEAD> <TITLE><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_3DS_VERIFICATION') ?></TITLE> <SCRIPT LANGUAGE="Javascript"> <!-- function OnLoadEvent() { document.form.submit(); } //--> </SCRIPT> </HEAD> <BODY onLoad="OnLoadEvent()"> <FORM NAME="form" ACTION="<?php echo $url_redirect ?>" METHOD="POST"> <INPUT TYPE="hidden" NAME="PaReq" VALUE="<?php echo $pareq ?>"> <INPUT TYPE="hidden" NAME="TermUrl" VALUE="<?php echo $url_validation ?>"> <INPUT TYPE="hidden" NAME="MD" VALUE="<?php echo $md ?>"> <NOSCRIPT><INPUT TYPE="submit"></NOSCRIPT> </FORM> </BODY> </HTML> <?php exit; } function getRemoteDCCFormParams ($xml_response_dcc) { $params = $this->getRemoteCCFormParams($xml_response_dcc); return $params; } /** * Checking if a card is 3D Secure enabled * @return bool|mixed */ function request3DSVerifyEnrolled ($realvault = false) { if ($realvault) { $response = $this->requestRealVault3DSVerifyEnrolled($realvault); } else { $response = $this->requestCard3DSVerifyEnrolled(); } return $response; } /** * Checking if a card is 3D Secure enabled * @return bool|mixed */ function requestCard3DSVerifyEnrolled () { $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_3DS_VERIFYENROLLED); $xml_request .= $this->getXmlRequestCard(); $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), $this->getCCnumber()); $xml_request .= $this->setSha1($sha1); $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } /** * Checking if a card is 3D Secure enabled in case of A card stored in RealVault * @param $realvault * @return bool|mixed */ function requestRealVault3DSVerifyEnrolled ($realvault) { $payerRef = $this->getSavedPayerRef(); $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_REALVAULT_3DS_VERIFYENROLLED); $xml_request .= '<payerref>' . $payerRef . '</payerref> <paymentmethod>' . $realvault->realex_hpp_api_saved_pmt_ref . '</paymentmethod>'; $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), $payerRef); $xml_request .= $this->setSha1($sha1); $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } /** * const VERIFYSIG_RESULT_VALIDATED = '00'; const VERIFYSIG_RESULT_NOT_VALIDATED = '110'; const VERIFYSIG_RESULT_INVALID_ACS_RESPONSE = '5xx'; * * /** * Response results from threedsecure = "3ds-verifysig"; const THREEDSECURE_STATUS_AUTHENTICATED = 'Y'; const THREEDSECURE_STATUS_NOT_AUTHENTICATED = 'N'; const THREEDSECURE_STATUS_ACKNOWLEDGED = 'A'; const THREEDSECURE_STATUS_UNAVAILABLE = 'U'; * 6. Take these values returned from the issuer, and create a 3ds-verifysig request. Send it to Realex. 7. Depending on the result take the following action: a. If the result is “00” the message has not been tampered with. Continue: i. If the status is “Y”, the cardholder entered their passphrase correctly. * This is a full 3DSecure transaction, go to step 8b. ii. If the status is “N”, the cardholder entered the wrong passphrase. * No shift in liability, do not proceed to authorisation. iii. If the status is “U”, then the Issuer was having problems with their systems at the time * and was unable to check the passphrase. You may continue with the transaction (go to step 8c) but there will be no shift in liability. iv. If the status is “A” the issuing bank acknowledges the attempt made by the merchant and accepts the liability shift. Continue to step 8a. 19  8. b. If the result is “110”, the digital signatures do not match the message and most likely the message has been tampered with. No shift in liability, do not proceed to authorisation. * @param $response * @return bool|int|string */ function getEciFrom3DSVerifysig ($response, $requireLiabilityShift = true) { $xml_response = simplexml_load_string($response); $result = (string)$xml_response->result; if (substr($result, 0, 1) == '5') { $result = '5xx'; } $allowLiabilityShift = false; $threedsecure = $xml_response->threedsecure; $threedsecure_status = (string)$threedsecure->status; if ($result == self::VERIFYSIG_RESULT_VALIDATED) { switch ($threedsecure_status) { case self::THREEDSECURE_STATUS_AUTHENTICATED: $allowLiabilityShift = true; $threedSecureAuthentication = true; break; case self::THREEDSECURE_STATUS_ACKNOWLEDGED: /** * If the status is “A” the issuing bank acknowledges the attempt made by the merchant and * accepts the liability shift. * Continue to step 8a. * a. Send a normal Realex authorisation message (set the ECI field to 6 or 1). * The merchant will not be liable for repudiation chargebacks. * */ $allowLiabilityShift = true; $threedSecureAuthentication = false; break; case self::THREEDSECURE_STATUS_NOT_AUTHENTICATED: /** * If the status is “N”, the cardholder entered the wrong passphrase. * No shift in liability, do not proceed to authorisation. * if the merchants chooses "Require liability shift" as "No" * then the transaction will proceed to authorisation * but there will not be a liability shift and the ECI value should be 7 */ $allowLiabilityShift = false; $threedSecureAuthentication = false; break; default: case self::THREEDSECURE_STATUS_UNAVAILABLE: /** * If the status is “U”, then the Issuer was having problems with their systems at the time * and was unable to check the passphrase. * You may continue with the transaction (go to step 8c) but there will be no shift in liability. * Send a normal Realex authorisation message (set the ECI field to 7 or 0). * The merchant will be liable for repudiation chargebacks. */ $allowLiabilityShift = false; $threedSecureAuthentication = false; break; } } else { /** * If the result is “110”, the digital signatures do not match the message * and most likely the message has been tampered with. No shift in liability, do not proceed to authorisation. */ $allowLiabilityShift = false; $threedSecureAuthentication = false; } if (!$allowLiabilityShift and $requireLiabilityShift) { return false; } $eci = $this->getEciValue($allowLiabilityShift, $threedSecureAuthentication); return $eci; } /** * 4. Depending on the response take the following action: a. If the response code is “00” and the enrolled tag is “Y” there will also be a URL returned. Redirect the cardholder to this URL using a hidden form. b. If the response code is “110” and the enrolled tag is “N” the cardholder is not enrolled. Skip to step 8a. c. If the enrolled tag is “U” the enrolled status could not be verified. Skip to step 8c. d. If the response is “220” the card scheme directory server may be unavailable. You may still proceed to authorisation but no liability shift will be received. Skip to step 8c. * @param $xml_response * @return bool|int|null */ public function getEciFrom3DSVerifyEnrolled ($response) { $xml_response = simplexml_load_string($response); $result = (string)$xml_response->result; if (substr($result, 0, 1) == '5') { $result = '5xx'; } switch ($result) { case self::ENROLLED_RESULT_ENROLLED: $liabilityShift = true; break; case self::ENROLLED_RESULT_NOT_ENROLLED: if ($xml_response->enrolled == self::ENROLLED_TAG_NOT_ENROLLED) { $liabilityShift = true; } else { $liabilityShift = false; } break; default: case self::ENROLLED_RESULT_INVALID_RESPONSE: case self::ENROLLED_RESULT_FATAL_ERROR: $liabilityShift = false; break; } // if there is no liability shift, and it is required by the client, throw exception $eci = false; if (!$liabilityShift && $this->_method->require_liability) { return $eci; } // determine the eci value to use if the card is not enrolled in the 3D Secure scheme if ($xml_response->enrolled != self::ENROLLED_TAG_ENROLLED) { $eci = $this->getEciValue($liabilityShift); } return $eci; } /** * Retrieve the ECI value for the provided card type, liability and 3D Secure result. * */ public function getEciValue ($allowLiabilityShift, $threedSecureAuthentication = false) { $eci_value = false; $cc_type = $this->customerData->getVar('cc_type'); if ($cc_type == '') { $this->debugLog('CC TYPE IS EMPTY', 'getEciValue', 'debug'); } if ($cc_type == 'VISA' or $cc_type == 'AMEX') { if ($threedSecureAuthentication === true) { $eci_value = self::ECI_AUTHENTICATED_VISA; } else { if ($allowLiabilityShift === true) { $eci_value = self::ECI_LIABILITY_SHIFT_VISA; } else { $eci_value = self::ECI_NO_LIABILITY_SHIFT_VISA; } } } else { if ($threedSecureAuthentication === true) { $eci_value = self::ECI_AUTHENTICATED_MASTERCARD; } else { if ($allowLiabilityShift === true) { $eci_value = self::ECI_LIABILITY_SHIFT_MASTERCARD; } else { $eci_value = self::ECI_NO_LIABILITY_SHIFT_MASTERCARD; } } } return $eci_value; } /** * @param $response * @param $order * @return null|string */ private function manageResponse3DSecure ($response) { $this->_storeRealexInternalData($response, $this->_currentMethod->virtuemart_paymentmethod_id, $this->order['details']['BT']->virtuemart_order_id, $this->order['details']['BT']->order_number, $this->request_type); $xml_response_3DSecure = simplexml_load_string($response); $responseAuth = ''; $BT = $this->order['details']['BT']; $order_number = $BT->order_number; $success = $this->isResponseSuccess($xml_response_3DSecure); $eci = $this->getEciFrom3DSVerifyEnrolled($xml_response_3DSecure); if ($eci == NULL) { return NULL; } if (!$eci) { $this->redirect3DSRequest($xml_response_3DSecure); } else { $xml_response_3DSecure->addChild('eci', $eci); $responseAuth = $this->requestAuth(NULL, $xml_response_3DSecure); $this->manageResponseRequestAuth($response); } return $responseAuth; } /** * @return bool|mixed */ function request3DSVerifysig ($realvault = false) { $paRes = vRequest::getVar('PaRes', ''); if (empty($paRes)) { $this->plugin->redirectToCart(vmText::_('VMPAYMENT_REALEX_HPP_API_ERROR_TRY_AGAIN')); } $jsonencodeMd = vRequest::getVar('MD', ''); $md = $this->getMd($jsonencodeMd); $this->customerData->saveCustomerMDData($md); $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_3DS_VERIFYSIG); if (!$realvault) { $xml_request .= $this->getXmlRequestCard(); $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), $this->getCCnumber()); } else { $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), ""); } $xml_request .= '<pares>' . $paRes . '</pares> '; $xml_request .= $this->setSha1($sha1); $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } /** * @param null $xml_response_dcc * @param null $xml_3Dresponse * @return bool|mixed */ function requestAuth ($xml_response_dcc = NULL, $xml_3Dresponse = NULL) { $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_AUTH); $xml_request .= '<card> <number>' . $this->getCCnumber() . '</number> <expdate>' . $this->getFormattedExpiryDateForRequest() . '</expdate> <chname>' . $this->sanitize($this->customerData->getVar('cc_name')) . '</chname> <type>' . $this->getCCtype($this->customerData->getVar('cc_type')) . '</type> <issueno></issueno> <cvn> <number>' . $this->customerData->getVar('cc_cvv') . '</number> <presind>1</presind> </cvn> </card> '; if ($this->_method->dcc) { $xml_request .= '<autosettle flag="1" /> '; } else { $xml_request .= '<autosettle flag="' . $this->getSettlement() . '" /> '; } $xml_request .= $this->setMpi($xml_3Dresponse); if ($this->_method->dcc) { $xml_request .= $this->setDccInfo($xml_response_dcc); } $xml_request .= $this->setComments(); $xml_request .= $this->setTssInfo(); $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), $this->getCCnumber()); $xml_request .= $this->setSha1($sha1); $xml_request .= '<md5hash></md5hash>'; $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } /** * *7. Depending on the result take the following action: a. If the result is “00” the message has not been tampered with. Continue: i. If the status is “Y”, the cardholder entered their passphrase correctly. This is a full 3DSecure transaction, go to step 8b. ii. If the status is “N”, the cardholder entered the wrong passphrase. No shift in liability, do not proceed to authorisation. iii. If the status is “U”, then the Issuer was having problems with their systems at the time and was unable to check the passphrase. You may continue with the transaction (go to step 8c) but there will be no shift in liability. iv. If the status is “A” the issuing bank acknowledges the attempt made by the merchant and accepts the liability shift. Continue to step 8a. 19  8. b. If the result is “110”, the digital signatures do not match the message and most likely the message has been tampered with. No shift in liability, do not proceed to authorisation. * * @param $response3D * @return bool|mixed */ function manageResponse3DSVerifyEnrolled ($response3D) { $this->manageResponseRequest($response3D); } function manageResponse3DSVerifysig ($response3DSVerifysig) { $this->manageResponseRequest($response3DSVerifysig); } /** * @param $response */ function manageResponseRequestAuth ($response) { $this->manageResponseRequest($response); } /** * @param $response */ function manageResponseRequest3DSecure ($response) { $this->manageResponseRequest($response); } /** * @param $xml_response_dcc * @return string */ function setDCCInfo ($xml_response_dcc) { $dcc_choice = $this->customerData->getVar('dcc_choice'); if ($dcc_choice) { $rate = $xml_response_dcc->dccinfo->cardholderrate; $currency = $xml_response_dcc->dccinfo->cardholdercurrency; $amount = $xml_response_dcc->dccinfo->cardholderamount; } else { $rate = 1; if ($xml_response_dcc AND $this->isResponseSuccess($xml_response_dcc)) { $currency = $xml_response_dcc->dccinfo->merchantcurrency; $amount = $xml_response_dcc->dccinfo->merchantamount; } else { $currency = $this->getPaymentCurrency(); $amount = $this->getTotalInPaymentCurrency(); } } $xml_request = '<dccinfo> <ccp>' . $this->_method->dcc_service . '</ccp> <type>1</type> <rate>' . $rate . '</rate> <ratetype>S</ratetype> <amount currency="' . $currency . '">' . $amount . '</amount> </dccinfo> '; return $xml_request; } /** * @param bool $realvault * @return bool|mixed */ public function requestDccrate ($realvault = false) { $payerRef = $this->getSavedPayerRef(); $request_type = ($realvault) ? self::REQUEST_TYPE_REALVAULT_DCCRATE : self::REQUEST_TYPE_DCCRATE; $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, $request_type); if ($realvault) { $xml_request .= '<payerref>' . $payerRef . '</payerref> <paymentmethod>' . $realvault->realex_hpp_api_saved_pmt_ref . '</paymentmethod> '; $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), $payerRef); } else { $xml_request .= $this->getXmlRequestCard(); $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), $this->getCCnumber()); } $xml_request .= '<dccinfo> <ccp>' . $this->_method->dcc_service . '</ccp> <type>1</type> </dccinfo> '; $xml_request .= $this->setComments(); $xml_request .= $this->setSha1($sha1); $xml_request .= '<md5hash></md5hash>'; $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } /** * possible results: * 105: Card not supported by DCC * 00: Card supported by eDCC * @param $response * @param $order * @return null|string */ function manageResponseDccRate ($response) { $this->manageResponseRequest($response); } function getXmlRequestCard () { $xml_request = '<card> <number>' . $this->getCCnumber() . '</number> <expdate>' . $this->getFormattedExpiryDateForRequest() . '</expdate> <chname>' . $this->sanitize($this->customerData->getVar('cc_name')) . '</chname> <type>' . $this->getCCtype($this->customerData->getVar('cc_type')) . '</type> </card>'; return $xml_request; } function getCCnumber () { return str_replace(" ", "", $this->customerData->getVar('cc_number')); } /*********************/ /* Log and Reporting */ /*********************/ public function debug ($subject, $title = '', $echo = true) { $debug = '<div style="display:block; margin-bottom:5px; border:1px solid red; padding:5px; text-align:left; font-size:10px;white-space:nowrap; overflow:scroll;">'; $debug .= ($title) ? '<br /><strong>' . $title . ':</strong><br />' : ''; //$debug .= '<pre>'; if (is_array($subject)) { $debug .= str_replace("=>", "⇒", str_replace("Array", "<font color=\"red\"><b>Array</b></font>", nl2br(str_replace(" ", " ", print_r($subject, true))))); } else { $debug .= str_replace("=>", "⇒", str_replace("Array", "<font color=\"red\"><b>Array</b></font>", (str_replace(" ", " ", print_r($subject, true))))); } //$debug .= '</pre>'; $debug .= '</div>'; if ($echo) { echo $debug; } else { return $debug; } } function highlight ($string) { return '<span style="color:red;font-weight:bold">' . $string . '</span>'; } public function debugLog ($message, $title = '', $type = 'message', $echo = false, $doVmDebug = false) { //Nerver log the full credit card number nor the CVV code. if (is_array($message)) { if (array_key_exists('REALEX_SAVED_PMT_DIGITS', $message)) { $message['REALEX_SAVED_PMT_DIGITS'] = "**** **** **** " . substr($message['REALEX_SAVED_PMT_DIGITS'], -4); } if (array_key_exists('SHA1HASH', $message)) { $message['SHA1HASH'] = '**MASKED**'; } if (array_key_exists('CVV2', $message)) { $message['CVV2'] = str_repeat('*', strlen($message['CVV2'])); } if (array_key_exists('signature', $message)) { $message['signature'] = '**MASKED**'; } if (array_key_exists('api_password', $message)) { $message['api_password'] = '**MASKED**'; } } if ($this->_method->debug) { $this->debug($message, $title, true); } if ($echo) { echo $message . '<br/>'; } $this->plugin->debugLog($message, $title, $type, $doVmDebug); } function getPaymentLang () { $available_languages = array( 'en-GB' => 'en', 'es-ES' => 'es', ); $default_language = 'en'; $language = JFactory::getLanguage(); if (array_key_exists($language->getTag(), $available_languages)) { return $available_languages[$language->getTag()]; } else { return $default_language; } } function getCardPaymentButton ($card_payment_button) { $lang = JFactory::getLanguage(); if ($lang->hasKey($card_payment_button)) { return vmText::_($card_payment_button); } else { return $card_payment_button; } } /** * @param $response */ function manageResponseRequest ($response) { if ($response == NULL) { $this->plugin->redirectToCart(vmText::_('VMPAYMENT_REALEX_HPP_API_ERROR_TRY_AGAIN')); } if (!$this->validateResponseHash($response)) { $this->plugin->redirectToCart(vmText::_('VMPAYMENT_REALEX_HPP_API_ERROR_TRY_AGAIN')); } $xml_response = simplexml_load_string($response); if ($this->isResponseInvalidPaymentDetails($xml_response)) { $msgToShopper=vmText::sprintf('VMPAYMENT_REALEX_HPP_API_INVALID_PAYMENT_DETAILS',$xml_response->message); $this->plugin->redirectToCart($msgToShopper); } $this->plugin->_storeRealexInternalData($response, $this->_method->virtuemart_paymentmethod_id, $this->order['details']['BT']->virtuemart_order_id, $this->order['details']['BT']->order_number, $this->request_type); /* $xml_response = simplexml_load_string($response); $success = $this->isResponseSuccess($xml_response); $reponse_enrolled=($xml_response->result==self::ENROLLED_RESULT_NOT_ENROLLED); $not_enrolled = ($xml_response->enrolled == self::ENROLLED_TAG_NOT_ENROLLED); if (! ($success OR $reponse_enrolled)) { $error = (string)$xml_response->message . " (" . (string)$xml_response->result . ")"; $this->displayError($error); $this->plugin->redirectToCart(vmText::_('VMPAYMENT_REALEX_HPP_API_ERROR_TRY_AGAIN')); } */ } /** * @param $response */ function manageResponseRequestReceiptIn ($response) { $xml_response = simplexml_load_string($response); if ($this->isResponseInvalidPaymentDetails($xml_response)) { $accountURL=JRoute::_('index.php?option=com_virtuemart&view=user&layout=edit'); $msgToShopper=vmText::sprintf('VMPAYMENT_REALEX_HPP_API_INVALID_PAYMENT_DETAILS_REALVAULT',$xml_response->message, $accountURL); $this->plugin->redirectToCart($msgToShopper); } $this->manageResponseRequest($response); } public function validateConfirmedOrder ($enqueueMessage = true) { return true; } public function validateSelectCheckPayment ($enqueueMessage = true) { return true; } /** * @param bool $enqueueMessage * @return bool */ function validateCheckoutCheckDataPayment () { return true; } function getOrderBEFields () { $showOrderBEFields = array( 'RESULT' => 'result', 'PASREF' => 'pasref', 'AUTHCODE' => 'authcode', 'MESSAGE' => 'message', 'TSS' => 'tss->result', 'CAVV' => 'cavv', 'CVNRESULT' => 'cvnresult', 'AVSPOSTCODERESULT' => 'avspostcoderesult', 'AVSPOSTCODERESPONSE' => 'avspostcoderesponse', 'AVSADDRESSRESPONSE' => 'avsaddressresponse', 'DCCCHOICE' => 'dccchoice', 'REALWALLET_CHOSEN' => 'realwallet_chosen', ); return $showOrderBEFields; } function getOrderBEFieldsDcc () { $showOrderBEFields = array( 'DCCRATE' => 'dccrate', 'DCCMERCHANTAMOUNT' => 'merchantamount', 'DCCMERCHANTCURRENCY' => 'merchantcurrency', 'DCCCARDHOLDERAMOUNT' => 'cardholderamount', 'DCCCARDHOLDERCURRENCY' => 'cardholdercurrency', ); return $showOrderBEFields; } function getOrderBEFields3DS () { $showOrderBEFields = array( 'status' => 'status', 'eci' => 'eci', ); return $showOrderBEFields; } function onShowOrderBEPayment ($data, $format, $request_type_response, $virtuemart_order_id) { $showOrderBEFields = $this->getOrderBEFields(); $prefix = 'REALEX_HPP_API_RESPONSE_'; $html = ''; if ($request_type_response == 'receipt-in_request') { if (!class_exists('VirtueMartModelOrders')) { require(VMPATH_ADMIN . DS . 'models' . DS . 'orders.php'); } $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $usedCC = $this->getStoredCCByPmt_ref($order['details']['BT']->virtuemart_user_id, $data->paymentmethod); $this->loadJLangThis('plg_vmuserfield_realex_hpp_api'); $display_fields = array( 'realex_hpp_api_saved_pmt_type', 'realex_hpp_api_saved_pmt_digits', 'realex_hpp_api_saved_pmt_expdate', 'realex_hpp_api_saved_pmt_name' ); foreach ($display_fields as $display_field) { $complete_key = strtoupper('VMUSERFIELD_' . $display_field); $value = $usedCC->$display_field; $key_text = vmText::_($complete_key); $value = vmText::_($value); if (!empty($value)) { $html .= "<tr>\n<td>" . $key_text . "</label></td>\n <td align='left'>" . $value . "</td>\n</tr>\n"; } } } else { foreach ($showOrderBEFields as $key => $showOrderBEField) { if ($format == "xml") { $showOrderBEField = strtolower($showOrderBEField); } else { $showOrderBEField=$key; } if (isset($data->$showOrderBEField) and !empty($data->$showOrderBEField)) { $key = $prefix . $key; $html .= $this->plugin->getHtmlRowBE($key, $data->$showOrderBEField); } } if (isset($data->DCCCHOICE) or isset($data->dccinfo)) { if ($format == "xml") { $dccinfo=$data->dccinfo; } else { $dccinfo=$data; } $showOrderBEFields = $this->getOrderBEFieldsDcc(); foreach ($showOrderBEFields as $key => $showOrderBEField) { if ($format == "xml") { $showOrderBEField = strtolower($showOrderBEField); } else { $showOrderBEField=$key; } if (isset($dccinfo->$showOrderBEField)) { $key = $prefix . $key; $html .= $this->plugin->getHtmlRowBE($key, $dccinfo->$showOrderBEField); } } } if (isset($data->threedsecure)) { $showOrderBEFields = $this->getOrderBEFields3DS(); $prefix = 'REALEX_HPP_API_RESPONSE_THREEDSECURE_'; foreach ($showOrderBEFields as $key => $showOrderBEField) { if (isset($data->threedsecure->$showOrderBEField)) { $key = $prefix . $key; $html .= $this->plugin->getHtmlRowBE($key, $data->threedsecure->$showOrderBEField); } } } } return $html; } /** * @param $response * @param $order * @return null|string */ function getResponseParams ($payments) { $dcc_info = ""; $payer_info = ""; $auth_info = ""; $order_history = $this->order['history']; $last_history = end($order_history); if ($last_history->order_status_code == $this->_method->status_canceled) { $auth_info = $last_history->comments; $success = false; } else { } vmLanguage::loadJLang('com_virtuemart_orders', TRUE); // FROM PAYMENT LOG??? why not from history if ($payments) { foreach ($payments as $payment) { if (isset($payment->realex_hpp_api_fullresponse) and !empty($payment->realex_hpp_api_fullresponse)) { if ($payment->realex_hpp_api_fullresponse_format == 'xml') { $xml_response = simplexml_load_string($payment->realex_hpp_api_fullresponse); if ($payment->realex_hpp_api_request_type_response == $this::REQUEST_TYPE_AUTH OR $payment->realex_hpp_api_request_type_response == $this::REQUEST_TYPE_RECEIPT_IN) { $success = $this->isResponseSuccess($xml_response); if ($success) { if (isset($xml_response->dccinfo) AND isset($xml_response->dccinfo->cardholderrate)) { if ($xml_response->dccinfo->cardholderrate != 1.0) { $dcc_info = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_CHARGED', $this->plugin->getCardHolderAmount($xml_response->dccinfo->merchantamount), $xml_response->dccinfo->merchantcurrency, $this->plugin->getCardHolderAmount($xml_response->dccinfo->cardholderamount), $xml_response->dccinfo->cardholdercurrency); } else { $dcc_info = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_MERCHANT_CURRENCY', $this->plugin->getCardHolderAmount($xml_response->dccinfo->merchantamount), $xml_response->dccinfo->merchantcurrency); } } $amountValue = vmPSPlugin::getAmountInCurrency($this->order['details']['BT']->order_total, $this->order['details']['BT']->order_currency); //$currencyDisplay = CurrencyDisplay::getInstance($this->cart->pricesCurrency); $auth_info = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED', $amountValue['display'], $this->order['details']['BT']->order_number); $pasref = $payment->realex_hpp_api_response_pasref; } else { if ($this->isResponseDeclined($xml_response)) { $auth_info = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_DECLINED', $this->order['details']['BT']->order_number); } else { $auth_info = vmText::_('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED'); } } } elseif ($payment->realex_hpp_api_request_type_response == $this::REQUEST_TYPE_CARD_NEW) { $success = $this->isResponseSuccess($xml_response); if ($success) { $payer_info = vmText::_('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_SUCCESS'); } else { $payer_info = vmText::_('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_FAILED'); } } } else { if ($payment->realex_hpp_api_fullresponse_format == 'json') { $realex_data = json_decode($payment->realex_hpp_api_fullresponse, false); $result = $payment->realex_hpp_api_response_result; $payer_info = ''; $success = ($result == self::RESPONSE_CODE_SUCCESS); if ($success) { $amountValue = vmPSPlugin::getAmountInCurrency($this->order['details']['BT']->order_total, $this->order['details']['BT']->order_currency); //$currencyDisplay = CurrencyDisplay::getInstance($this->cart->pricesCurrency); $auth_info = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED', $amountValue['display'], $this->order['details']['BT']->order_number); if (isset($realex_data->DCCCHOICE) and $realex_data->DCCCHOICE == $this::RESPONSE_DCC_CHOICE_YES) { $dcc_info = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_CHARGED', $this->plugin->getCardHolderAmount($realex_data->DCCMERCHANTAMOUNT), $realex_data->DCCMERCHANTCURRENCY, $this->plugin->getCardHolderAmount($realex_data->DCCCARDHOLDERAMOUNT), $realex_data->DCCCARDHOLDERCURRENCY); } if (isset($realex_data->REALWALLET_CHOSEN) and $realex_data->REALWALLET_CHOSEN == 1) { if ((isset($realex_data->PMT_SETUP) and $realex_data->PMT_SETUP == self::PMT_SETUP_SUCCESS)) { $payer_info = vmText::_('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_SUCCESS'); } else { $payer_info = vmText::_('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_FAILED'); } } $pasref = $realex_data->PASREF; } else { if ($this->isResponseDeclined($xml_response)) { $auth_info = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_DECLINED', $this->order['details']['BT']->order_number); } else { $auth_info = vmText::_('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED'); } } } } } } } $params= array( "success" => $success, "dcc_info" => $dcc_info, "auth_info" => $auth_info, "payer_info" => $payer_info, "pasref" => $pasref, "order_number" => $this->order['details']['BT']->order_number, "order_pass" => $this->order['details']['BT']->order_pass, ); return $params; } function handleCardStorage ($saved_cc_selected) { $userfield = false; // if no card are already saved, then if ($saved_cc_selected == -1 OR empty($saved_cc_selected)) { if ($this->doRealVault()) { $setNewPayerSuccess = true; $payerRef = $this->getSavedPayerRef(); if (!$payerRef) { $payerRef = $this->getNewPayerRef(); $responseNewPayer = $this->setNewPayer($payerRef); $setNewPayerSuccess = $this->manageSetNewPayer($responseNewPayer); if ($setNewPayerSuccess) { $this->saveNewPayerRef($payerRef, $this->order['details']['BT']->virtuemart_user_id); } } if ($setNewPayerSuccess) { $newPaymentRef = ""; $responseNewPayment = $this->setNewPayment($payerRef, $newPaymentRef); $userfield = $this->manageSetNewPayment($responseNewPayment, $payerRef, $newPaymentRef); } } } return $userfield; } /** * @param $response * @param $realexInterface * @return bool */ function manageSetNewPayer ($response) { $this->plugin->_storeRealexInternalData($response, $this->_currentMethod->virtuemart_paymentmethod_id, $this->order['details']['BT']->virtuemart_order_id, $this->order['details']['BT']->order_number, $this->request_type); $xml_response = simplexml_load_string($response); $success = $this->isResponseSuccess($xml_response); if (!$success) { $error = $xml_response->message . " (" . (string)$xml_response->result . ")"; $this->displayError($error); vmInfo('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_FAILED'); return false; } return true; } /** * @param $response * @param $realexInterface * @return bool */ function manageSetNewPayment ($response, $newPayerRef, $newPaymentRef) { $this->plugin->_storeRealexInternalData($response, $this->_method->virtuemart_paymentmethod_id, $this->order['details']['BT']->virtuemart_order_id, $this->order['details']['BT']->order_number, $this->request_type); $xml_response = simplexml_load_string($response); $success = $this->isResponseSuccess($xml_response); if (!$success) { $error = $xml_response->message . " (" . (string)$xml_response->result . ")"; $this->displayError($error); vmInfo('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_FAILED'); return false; } $userfield['virtuemart_user_id'] = $this->order['details']['BT']->virtuemart_user_id; $userfield['merchant_id'] = $this->_method->merchant_id; $userfield['realex_hpp_api_saved_pmt_ref'] = $newPaymentRef; //$userfield['realex_saved_payer_ref'] = $newPayerRef; $userfield['realex_hpp_api_saved_pmt_type'] = $this->customerData->getVar('cc_type'); if (!class_exists('shopFunctionsF')) { require(VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'); } $userfield['realex_hpp_api_saved_pmt_digits'] = shopFunctionsF::mask_string($this->customerData->getVar('cc_number'), '*'); $userfield['realex_hpp_api_saved_pmt_name'] = $this->customerData->getVar('cc_name'); $userfield['realex_hpp_api_saved_pmt_expdate'] = $this->getFormattedExpiryDateForRequest(); return $userfield; } /** * Customer number gets sanitize to make sure that it contains only valid characters * @return mixed */ function getNewPayerRef () { return $this->getUniqueId($this->order['details']['BT']->customer_number); } /** * If Realvault, and new card, store after Authorization the card */ function storeNewPayment ($userfield) { if (!$userfield) { return; } if (!class_exists('VmTableData')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'vmtabledata.php'); } JLoader::import('joomla.plugin.helper'); JPluginHelper::importPlugin('vmuserfield'); $app = JFactory::getApplication(); $value = ''; $userfield['fromPayment'] = true; $app->triggerEvent('plgVmPrepareUserfieldDataSave', array( 'pluginrealex_hpp_api', 'realex_hpp_api', &$userfield, &$value, $userfield )); //vmInfo('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_SUCCESS'); } public function loadCustomerData ($loadCDFromPost = true) { if (!class_exists('RealexHelperCustomerData')) { require(JPATH_SITE . '/plugins/vmpayment/realex_hpp_api/realex_hpp_api/helpers/customerdata.php'); } $this->getCustomerData(); if ($loadCDFromPost) { $this->customerData->loadPost(); } } public function getCustomerData () { if (!class_exists('RealexHelperCustomerData')) { require(JPATH_SITE . '/plugins/vmpayment/realex_hpp_api/realex_hpp_api/helpers/customerdata.php'); } $this->customerData = new RealexHelperCustomerData(); $this->customerData->load(); } /** * @param bool $enqueueMessage * @return bool */ function validateCvv ($enqueueMessage = true) { if (!class_exists('Creditcard')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'creditcard.php'); } if (!$this->_method->cvn_checking) { return true; } $cc_cvv_realvault = vRequest::getInt('cc_cvv_realvault', ''); if (!Creditcard::validate_credit_card_cvv('', $cc_cvv_realvault, true)) { $app = JFactory::getApplication(); $app->enqueueMessage(vmText::_('VMPAYMENT_REALEX_HPP_API_CC_CARD_CVV_INVALID'), 'error'); return false; } return true; } /** * @param $saved_cc_selected * @return mixed */ function getStoredCCsData ($saved_cc_selected) { $realvault = false; $storedCCs = $this->getStoredCCs(JFactory::getUser()->id); foreach ($storedCCs as $storedCC) { if ($storedCC->id == $saved_cc_selected) { $realvault = $storedCC; break; } } return $realvault; } /** * @return array */ static function getRealexCreditCards () { return array( 'VISA', 'MC', 'AMEX', 'MAESTRO', 'DINERS', ); } function getVendorInfo ($field) { $virtuemart_vendor_id = 1; $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($virtuemart_vendor_id); return $vendor->$field; } /** * the reference to use for the payment method saved. * If this field is not present an alphanumeric reference will be automatically generated. * @return string */ function getPmtRef () { return ''; } /** * This field contains the payer reference used for this cardholder. * If this field is empty or missing and PAYER_EXIST = 0, then a PAYER_REF will be automatically generated. * To add another card to an existing payer the PAYER_REF field should be set to their existing payer reference. * This field is mandatory if the CARD_STORAGE_ENABLE is set to 1 and * the PAYER_EXIST flag is set to 1. If PAYER_EXIST = 1 and CARD_STORAGE_ENABLE = 1, a 5xx error will be returned if the field is empty or missing: * 5xx “Mandatory field missing. PAYER_REF not present in request” * @return string */ function saveNewPayerRef ($payerRef) { $virtuemart_user_id = $this->order['details']['BT']->virtuemart_user_id; if (!$this->getSavedPayerRef($virtuemart_user_id)) { $PayerRefTableName = $this->plugin->getPayerRefTableName(); $q = 'INSERT INTO `' . $PayerRefTableName . '` (`virtuemart_user_id`,`payer_ref`, `merchant_id`) VALUES ("' . $virtuemart_user_id . '","' . $payerRef . '","' . $this->_method->merchant_id . '")'; $db = JFactory::getDBO(); $db->setQuery($q); $db->execute(); $err = $db->getErrorMsg(); if (!empty($err)) { vmError('Database error: Realex saveNewPayerRef ' . $err); } } } /** * PayerRef is the customer number which is unique * @return mixed */ function getSavedPayerRef ($userId = '') { if (empty($userId)) { if (JFactory::getApplication()->isSite()) { $userId = $this->order['details']['BT']->virtuemart_user_id; } else { $userId = vRequest::getVar('virtuemart_user_id', 0); if (is_array($userId)) { $userId = $userId[0]; } } } $PayerRefTableName = $this->plugin->getPayerRefTableName(); $q = 'SELECT `payer_ref` FROM `' . $PayerRefTableName . '` WHERE `virtuemart_user_id`="' . $userId . '" AND `merchant_id`="' . $this->_method->merchant_id . '" '; $db = JFactory::getDBO(); $db->setQuery($q); $payer_ref = $db->loadResult(); return $payer_ref; } /** * @param $storedCCs * @param $selected * @return null */ function getSelectedCC ($storedCCs, $selected) { if (empty($storedCCs)) { return NULL; } foreach ($storedCCs as $storedCC) { if ($storedCC->id == $selected) { return $storedCC; } } } /** * @param $selected_cc_id * @return null|stdClass */ function getSelectedCCParams ($selected_cc_id) { if ($selected_cc_id == -1) { $selectedCCParams = new stdClass(); $selectedCCParams->addNew = true; return $selectedCCParams; } $storedCCs = $this->getStoredCCs(JFactory::getUser()->id); $selectedCC = $this->getSelectedCC($storedCCs, $selected_cc_id); if ($selectedCC == NULL) { return NULL; } $selectedCCParams = $selectedCC; $selectedCCParams->addNew = false; return $selectedCCParams; } /** * @var */ static $_storedCCsCache; function getStoredCCs ($virtuemart_user_id) { //$this->debugLog( $virtuemart_user_id, 'getStoredCCs', 'debug'); if (!empty(self::$_storedCCsCache)) { if (isset(self::$_storedCCsCache[$virtuemart_user_id])) { $storedCCs = self::$_storedCCsCache[$virtuemart_user_id]['storedCC']; //$this->debugLog('from cache', 'getStoredCCs', 'debug'); return $storedCCs; } } JLoader::import('joomla.plugin.helper'); JPluginHelper::importPlugin('vmuserfield'); $app = JFactory::getApplication(); $storedCCs = ""; $app->triggerEvent('plgVmOnPaymentDisplay', array('pluginrealex_hpp_api', $virtuemart_user_id, &$storedCCs)); //$this->debugLog(var_export($storedCCs, true), 'getStoredCCs after plgVmOnPaymentDisplay', 'debug'); if (empty(self::$_storedCCsCache)) { self::$_storedCCsCache = array(); } if (empty(self::$_storedCCsCache[$virtuemart_user_id])) { self::$_storedCCsCache[$virtuemart_user_id] = array(); } self::$_storedCCsCache[$virtuemart_user_id]['storedCC'] = $storedCCs; return $storedCCs; } function getStoredCCsByPaymentMethod ($virtuemart_user_id, $virtuemart_paymentmethod_id) { $storedCCsByPaymentMethod = array(); $storeCCs = $this->getStoredCCs($virtuemart_user_id); if ($storeCCs) { foreach ($storeCCs as $storeCC) { if ($storeCC->virtuemart_paymentmethod_id == $virtuemart_paymentmethod_id) { $storedCCsByPaymentMethod[] = $storeCC; } } } return $storedCCsByPaymentMethod; } function getStoredCCByPmt_ref ($virtuemart_user_id, $pmt_ref) { $storedCCByPmt_ref = array(); $storeCCs = $this->getStoredCCs($virtuemart_user_id); if ($storeCCs) { foreach ($storeCCs as $storeCC) { if ($storeCC->realex_hpp_api_saved_pmt_ref == $pmt_ref) { $storedCCByPmt_ref = $storeCC; break; } } } return $storedCCByPmt_ref; } function getRemoteCCFormParams ($xml_response_dcc = NULL, $error = FALSE) { $realvault = false; $useSSL = $this->useSSL(); $submit_url = JRoute::_('index.php?option=com_virtuemart&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''), $this->cart->useXHTML, $useSSL); $card_payment_button = $this->getPaymentButton(); if (!empty($xml_response_dcc)) { $notificationTask = "handleRemoteDccForm"; } elseif ($this->_method->threedsecure AND $this->isCC3DSVerifyEnrolled() AND !$error) { $notificationTask = "handleVerify3D"; } else { $notificationTask = "handleRemoteCCForm"; } if (empty($this->_method->creditcards)) { $this->_method->creditcards = RealexHelperRealex::getRealexCreditCards(); } elseif (!is_array($this->_method->creditcards)) { $this->_method->creditcards = (array)$this->_method->creditcards; } $ccDropdown = ""; $offer_save_card = false; if (!JFactory::getUser()->guest AND $this->_method->realvault) { $selected_cc = $this->customerData->getVar('saved_cc_selected'); if (empty($selected_cc)) { $selected_cc = -1; } $use_another_cc = true; $ccDropdown = $this->getCCDropDown($this->_method->virtuemart_paymentmethod_id, JFactory::getUser()->id, $selected_cc, $use_another_cc, true); if ($selected_cc > 0) { $realvault = $this->getStoredCCsData($selected_cc); } $offer_save_card = $this->_method->offer_save_card; } $amountInCurrency = vmPSPlugin::getAmountInCurrency($this->order['details']['BT']->order_total, $this->_method->payment_currency); $order_amount = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_TOTAL', $amountInCurrency['display']); $cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency); $payment_name = $this->plugin->renderPluginName($this->_method); $cvv_images = $this->_method->cvv_images; $cvv_info = ""; $dccinfo = ""; if ($xml_response_dcc) { $success = $this->isResponseSuccess($xml_response_dcc); if ($success AND isset($xml_response_dcc->dccinfo)) { $dccinfo = $xml_response_dcc->dccinfo; } } if ($xml_response_dcc AND $realvault) { $ccData['cc_type'] = $realvault->realex_hpp_api_saved_pmt_type; $ccData['cc_number'] = $realvault->realex_hpp_api_saved_pmt_digits; $ccData['cc_number_masked'] = $realvault->realex_hpp_api_saved_pmt_digits; $ccData['cc_name'] = $realvault->realex_hpp_api_saved_pmt_name; $ccData['cc_cvv_realvault'] = $this->customerData->getVar('cc_cvv_realvault'); $ccData['cc_cvv_masked'] = '***'; } else { $ccData['cc_type'] = $this->customerData->getVar('cc_type'); $ccData['cc_number'] = $this->customerData->getVar('cc_number'); $ccData['cc_number_masked'] = $this->customerData->getMaskedCCnumber(); $ccData['cc_cvv'] = $this->customerData->getVar('cc_cvv'); $ccData['cc_cvv_masked'] = '***'; $ccData['cc_expire_month'] = $this->customerData->getVar('cc_expire_month'); $ccData['cc_expire_year'] = $this->customerData->getVar('cc_expire_year'); $ccData['cc_name'] = $this->customerData->getVar('cc_name'); $ccData['save_card'] = $this->customerData->getVar('save_card'); } return array( "order_amount" => $order_amount, "payment_name" => $payment_name, "submit_url" => $submit_url, "card_payment_button" => $card_payment_button, "notificationTask" => $notificationTask, 'creditcardsDropDown' => $ccDropdown, "dccinfo" => $dccinfo, "ccData" => $ccData, 'creditcards' => $this->_method->creditcards, 'offer_save_card' => $offer_save_card, 'order_number' => $this->order['details']['BT']->order_number, 'virtuemart_paymentmethod_id' => $this->_method->virtuemart_paymentmethod_id, 'integration' => $this->_method->integration, 'cvv_info' => $cvv_info, 'cvn_checking' => $this->_method->cvn_checking, 'cvv_images' => $cvv_images); } /** * Switch and Solo became Maestro * @return bool */ function isCC3DSVerifyEnrolled ($pmt_type = NULL) { $CC3DSVerifyEnrolled = array('VISA', 'MC', 'MAESTRO', 'AMEX'); if ($pmt_type == NULL) { $pmt_type = $this->customerData->getVar('cc_type'); } return in_array($pmt_type, $CC3DSVerifyEnrolled); } /** * @param $virtuemart_paymentmethod_id * @param $virtuemart_user_id * @param $selected_cc * @return mixed|null */ function getCCDropDown ($virtuemart_paymentmethod_id, $virtuemart_user_id, $selected_cc, $use_another_cc = true, $radio = false) { //$storeCCs = $this->getStoredCCsByPaymentMethod($virtuemart_user_id, $virtuemart_paymentmethod_id); $storeCCs = $this->getStoredCCs($virtuemart_user_id); if (empty($storeCCs)) { return null; } if (!class_exists('VmHTML')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'); } $attrs = 'class="inputbox vm-chzn-select"'; $idA = $id = 'saved_cc_selected'; //$idA = $id = 'saved_cc_selected_'; //$options[] = array('value' => '', 'text' => vmText::_('VMPAYMENT_REALEX_HPP_API_PLEASE_SELECT')); if ($use_another_cc) { $options[] = JHTML::_('select.option', -1, vmText::_('VMPAYMENT_REALEX_HPP_API_USE_ANOTHER_CC')); $radioOptions[-1] = vmText::_('VMPAYMENT_REALEX_HPP_API_USE_ANOTHER_CC'); } foreach ($storeCCs as $storeCC) { $cc_type = vmText::_('VMPAYMENT_REALEX_HPP_API_CC_' . $storeCC->realex_hpp_api_saved_pmt_type); $name = $cc_type . ' ' . $storeCC->realex_hpp_api_saved_pmt_digits . ' ' . $this->renderExpDate($storeCC->realex_hpp_api_saved_pmt_expdate) . ' (' . $storeCC->realex_hpp_api_saved_pmt_name . ')'; $options[] = JHTML::_('select.option', $storeCC->id, $name); $radioOptions[$storeCC->id] = $name; } if ($radio) { return VmHTML::radioList($idA, $selected_cc, $radioOptions, 'class="realexListCC"'); } else { return JHTML::_('select.genericlist', $options, $idA, 'class="realexListCC inputbox vm-chzn-select" style="width: 350px;"', 'value', 'text', $selected_cc); } } /** * stored format of the expired date is mmyy * @param $expdate * @return mixed */ function renderExpDate ($expdate) { return substr($expdate, 0, 2) . '/' . substr($expdate, -2); } function getOfferSaveCard ($checked, $paymentmethod_id) { $param = ''; if ($checked) { $param = "checked"; } $id = 'realex_offersavecard_' . $paymentmethod_id; $html = vmText::_('VMPAYMENT_REALEX_HPP_API_OFFERSAVECARD'); $html .= "<br />"; $html .= '<input type="checkbox" name="' . $id . '" id="' . $id . '" value="1" ' . $param . '/>'; $html .= ' <label for="' . $id . '">' . vmText::_('VMPAYMENT_REALEX_HPP_API_OFFERSAVECARD_YES') . '</label>'; return $html; } function doRealVault (&$selectedCCParams) { if (!JFactory::getUser()->guest AND $this->_method->realvault AND $this->_method->integration == 'remote') { if (!($this->_method->offer_save_card) OR ($this->_method->offer_save_card AND $this->customerData->getVar('save_card')) ) { return true; } return false; } return false; } /** * @return string */ function getRemoteURL () { return "https://epage.payandshop.com/epage-remote-plugins.cgi"; } /** * @return string */ function getPaymentButton () { if (empty($this->_method->card_payment_button)) { $card_payment_button = vmText::_('VMPAYMENT_REALEX_HPP_API_DCC_PAY_NOW'); } else { $card_payment_button = $this->_method->card_payment_button; } return $card_payment_button; } /** * Once the payer has been set up on the RealVault system, to raise a payment, use the receipt-in transaction. * @param $selectedCCParams * @param bool $ask_dcc * @param bool $set_dcc * @return bool|mixed */ public function requestReceiptIn ($selectedCCParams, $xml_response_dcc = NULL, $xml_3Dresponse = NULL) { $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_RECEIPT_IN); if (!empty($selectedCCParams->cc_cvv_realvault)) { $xml_request .= '<paymentdata> <cvn> <number>' . $selectedCCParams->cc_cvv_realvault . '</number> </cvn> </paymentdata> '; } if ($this->_method->dcc) { $xml_request .= '<autosettle flag="1" /> '; } else { $xml_request .= '<autosettle flag="' . $this->getSettlement() . '" /> '; } $xml_request .= $this->setMpi($xml_3Dresponse); $payerRef = $this->getSavedPayerRef(); $xml_request .= '<payerref>' . $this->getSavedPayerRef() . '</payerref> <paymentmethod>' . $selectedCCParams->realex_hpp_api_saved_pmt_ref . '</paymentmethod>'; if ($xml_response_dcc) { $xml_request .= $this->setDccInfo($xml_response_dcc); /* $xml_request .= ' <dccinfo> <ccp>' . $this->_method->dcc_service . '</ccp> <type>1</type> <rate>' . $xml_response_dcc->dccinfo->cardholderrate . '</rate> <ratetype>S</ratetype> <amount currency="' . $xml_response_dcc->dccinfo->cardholdercurrency . '">' . $xml_response_dcc->dccinfo->cardholderamount . '</amount> </dccinfo>'; */ } $xml_request .= '<md5hash /> '; $hash = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), $payerRef); $xml_request .= $this->setSha1($hash); $xml_request .= $this->setComments(); $xml_request .= $this->setTSSinfo(); $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } function setMPI ($xml_3Dresponse) { $xml_request = ''; if ($xml_3Dresponse) { if (!empty($xml_3Dresponse->eci) AND isset($xml_3Dresponse->eci)) { $xml_request = '<mpi>' . '<eci>' . $xml_3Dresponse->eci . '</eci> </mpi> '; } /** * MPI: Merchant Plug In - it is the component that communicates with the other components during the actual transaction. */ if ($xml_3Dresponse AND !empty($xml_3Dresponse->threedsecure) AND isset($xml_3Dresponse->threedsecure)) { $xml_request = '<mpi> <eci>' . $xml_3Dresponse->threedsecure->eci . '</eci> <cavv>' . $xml_3Dresponse->threedsecure->cavv . '</cavv> <xid>' . $xml_3Dresponse->threedsecure->xid . '</xid> </mpi> '; } } return $xml_request; } function getSettlement () { return ($this->_method->settlement == 'auto') ? 1 : 0; } /** * Hash Value Syntax: Timestamp.merchantID.payerref.pmtref * @param $storedCC : the stored Credit card to delete * @return bool */ function deleteStoredCard ($storedCC) { $timestamp = $this->getTimestamp(); $payerRef = $this->getSavedPayerRef($storedCC['virtuemart_user_id']); $xml_request = ' <request timestamp="' . $timestamp . '" type="' . self::REQUEST_TYPE_CARD_CANCEL_CARD . '"> <merchantid>' . $this->_method->merchant_id . '</merchantid> <card> <ref>' . $storedCC['realex_hpp_api_saved_pmt_ref'] . '</ref> <payerref>' . $payerRef . '</payerref> </card>'; $sha1_request = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $payerRef, $storedCC['realex_hpp_api_saved_pmt_ref']); $xml_request .= $this->setSha1($sha1_request); $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); $xml_response = simplexml_load_string($response); $result = (string)$xml_response->result; $merchantid = (string)$xml_response->merchantid; $sha1hash = (string)$xml_response->sha1hash; $sha1_temp_response = sha1($timestamp . '.' . $merchantid . '.' . $payerRef . '.' . $storedCC['realex_hpp_api_saved_pmt_ref']); $sha1_response = sha1($sha1_temp_response . '.' . $this->_method->shared_secret); // 501 : Card Ref and Payer combination does not exist: ignore those cases if (($result == '00' || $result == '501') && $sha1_response == $sha1_request) { return true; } else { $this->displayError((string)$xml_response->message); return false; } } /** * To update the Expiry Date or update the Cardholder Name on an existing card: * Hash Value Syntax: Timestamp.merchantID.payerref.pmtref * @param $storedCC : the stored Credit card to delete * @return bool */ function updateStoredCard ($storedCC) { $timestamp = $this->getTimestamp(); $payerRef = $this->getSavedPayerRef($storedCC['virtuemart_user_id']); $xml_request = ' <request timestamp="' . $timestamp . '" type="' . self::REQUEST_TYPE_CARD_UPDATE_CARD . '"> <merchantid>' . $this->_method->merchant_id . '</merchantid> <card> <ref>' . $storedCC['realex_hpp_api_saved_pmt_ref'] . '</ref> <payerref>' . $payerRef . '</payerref> <expdate>' . $storedCC['realex_hpp_api_saved_pmt_expdate'] . '</expdate> <chname>' . $storedCC['realex_hpp_api_saved_pmt_name'] . '</chname> <type>card</type> </card>'; $sha1_request = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $payerRef, $storedCC['realex_hpp_api_saved_pmt_ref'], $storedCC['realex_hpp_api_saved_pmt_expdate'], ""); $xml_request .= $this->setSha1($sha1_request); $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); $xml_response = simplexml_load_string($response); $result = (string)$xml_response->result; $merchantid = (string)$xml_response->merchantid; $sha1hash = (string)$xml_response->sha1hash; $sha1_temp_response = sha1($timestamp . '.' . $merchantid . '.' . $payerRef . '.' . $storedCC['realex_hpp_api_saved_pmt_ref'] . '.' . $storedCC['realex_hpp_api_saved_pmt_expdate'] . '.'); $sha1_response = sha1($sha1_temp_response . '.' . $this->_method->shared_secret); // 501 : Card Ref and Payer combination does not exist: ignore those cases if (($result == '00' || $result == '501') && $sha1_response == $sha1_request) { return true; } else { $this->displayError((string)$xml_response->message); return false; } } /** * set comment in request * @return string */ function setComments () { $xml_request = '<comments> <comment id="2">virtuemart-rlx</comment> </comments> '; return $xml_request; } /** * set TSS info in request * @return string */ function setTSSinfo () { $BT = $this->order['details']['BT']; $ST = ((isset($this->order['details']['ST'])) ? $this->order['details']['ST'] : $this->order['details']['BT']); $xml_request = '<tssinfo> <address type="billing"> <code>' . $this->getCode($BT) . '</code> <country>' . ShopFunctions::getCountryByID($BT->virtuemart_country_id, 'country_2_code') . '</country> </address> <address type="shipping"> <code>' . $this->getCode($ST) . '</code> <country>' . ShopFunctions::getCountryByID($ST->virtuemart_country_id, 'country_2_code') . '</country> </address> <custnum></custnum> <varref></varref> <prodid></prodid> </tssinfo> '; return $xml_request; } /** * @return bool|mixed */ function setNewPayer ($newPayerRef) { $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_PAYER_NEW, false); $BT = $this->order['details']['BT']; $xml_request .= '<payer type="Business" ref="' . $newPayerRef . '"> <firstname>' . $this->sanitize($BT->first_name) . '</firstname> <surname>' . $this->sanitize($BT->last_name) . '</surname> '; if (!empty($BT->company)) { $xml_request .= '<company>' . $BT->company . '</company> '; } $xml_request .= '<address> <line1>' . $BT->address_1 . '</line1> <line2 >' . $BT->address_2 . '</line2> <line3 /> <city>' . $BT->city . '</city> <county>' . ShopFunctions::getCountryByID($BT->virtuemart_country_id, 'country_2_code') . '</county> <postcode>' . $this->stripnonnumeric($BT->zip, 5) . '</postcode> <country code="' . ShopFunctions::getCountryByID($BT->virtuemart_country_id, 'country_2_code') . '"> ' . ShopFunctions::getCountryByID($BT->virtuemart_country_id, 'country_name') . ' </country> </address> <phonenumbers> <home /> <work>' . $BT->phone_1 . '</work> <fax /> <mobile>' . $BT->phone_2 . '</mobile> </phonenumbers> <email>' . $BT->email . '</email> <comments> <comment id="1" /> <comment id="2" /> </comments> </payer> '; $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, '', '', $newPayerRef); $xml_request .= $this->setSha1($sha1); $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } function sanitize ($string) { $string = $this->replaceNonAsciiCharacters($string); $string = vRequest::filterUword($string, ' '); return $string; } /** * @return bool|mixed */ function setNewPayment ($newPayerRef, &$newPaymentRef) { $timestamp = $this->getTimestamp(); $cc_number = str_replace(" ", "", $this->customerData->getVar('cc_number')); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_CARD_NEW, false); $newPaymentRef = $this->getUniqueId($this->order['details']['BT']->order_number); $cc_name = $this->sanitize($this->customerData->getVar('cc_name')); $xml_request .= '<card> <ref>' . $newPaymentRef . '</ref> <payerref>' . $newPayerRef . '</payerref> <number>' . $cc_number . '</number> <expdate>' . $this->getFormattedExpiryDateForRequest() . '</expdate> <chname>' . $cc_name . '</chname> <type>' . $this->getCCtype($this->customerData->getVar('cc_type')). '</type> <issueno /> </card> '; $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, '', '', $newPayerRef, $cc_name, $cc_number); $xml_request .= $this->setSha1($sha1); $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } /** * @param $value * @return string */ function getUniqueId ($value) { $value = $this->sanitize($value); return $value . '-' . time(); } /** * cc_expire_year has format 4 digits * set CC expiry date in required format mmyy * @return string */ function getFormattedExpiryDateForRequest () { return $this->customerData->getVar('cc_expire_month') . substr($this->customerData->getVar('cc_expire_year'), -2); } /** * set header request * @param $timestamp * @param $type * @return string */ function setHeader ($timestamp, $type, $include_amount = true, $include_account=true) { $this->request_type = $type; $xml_request = '<request timestamp="' . $timestamp . '" type="' . $type . '"> <merchantid>' . $this->_method->merchant_id . '</merchantid>'; if ($include_account) { $xml_request .= '<account>' . $this->_method->subaccount . '</account>'; } $xml_request .= '<orderid>' . $this->order['details']['BT']->order_number . '</orderid> '; if ($include_amount) { $xml_request .= '<amount currency="' . $this->getPaymentCurrency() . '">' . $this->getTotalInPaymentCurrency() . '</amount> '; } return $xml_request; } /** * set sha1 in request * @param $sha1hash * @return string */ function setSha1 ($sha1hash) { $xml_request = '<sha1hash>' . $sha1hash . '</sha1hash> '; return $xml_request; } function rebateTransaction ($payments) { $payment = $this->getTransactionData($payments); if ($payment === NULL) { return NULL; } $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_REBATE, true, false); $xml_request .= '<pasref>' . $payment->realex_hpp_api_response_pasref . '</pasref> <authcode>' . $payment->realex_hpp_api_response_authcode . '</authcode> '; $refundhash = sha1($this->_method->rebate_password); $xml_request .= '<refundhash>' . $refundhash . '</refundhash> '; $xml_request .= $this->setComments(); // NOTE: There is no cardnumber included in the rebate so the cardnumber field can be left blank in the hash . $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), ""); $xml_request .= $this->setSha1($sha1); $xml_request .= '<md5hash></md5hash> '; $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } function settleTransaction ($payments) { $payment = $this->getTransactionData($payments); if ($payment === NULL) { return NULL; } $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_SETTLE); $xml_request .= ' <pasref>' . $payment->realex_hpp_api_response_pasref . '</pasref> <authcode>' . $payment->realex_hpp_api_response_authcode . '</authcode> '; $xml_request .= $this->setComments(); $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), ""); $xml_request .= $this->setSha1($sha1); $xml_request .= '<md5hash></md5hash> '; $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } /** * Before settlement, it is possible to void an authorisation, manual, offline, or rebate request. * If the transaction has been settled or batched, then it cannot be voided, although it can be submitted using another authorisation or rebate. * * @param $payments * @return bool|mixed|null */ function voidTransaction ($payments) { $payment = $this->getTransactionData($payments); if ($payment === NULL) { return NULL; } $timestamp = $this->getTimestamp(); $xml_request = $this->setHeader($timestamp, self::REQUEST_TYPE_VOID); $xml_request .= ' <pasref>' . $payment->realex_hpp_api_response_pasref . '</pasref> <authcode>' . $payment->realex_hpp_api_response_authcode . '</authcode> '; $xml_request .= $this->setComments(); // timestamp.merchantid.orderid... $sha1 = $this->getSha1Hash($this->_method->shared_secret, $timestamp, $this->_method->merchant_id, $this->order['details']['BT']->order_number, $this->getTotalInPaymentCurrency(), $this->getPaymentCurrency(), ""); $xml_request .= $this->setSha1($sha1); $xml_request .= '<md5hash></md5hash> '; $xml_request .= '</request>'; $response = $this->getXmlResponse($xml_request); return $response; } /** * @param $payments * @param string $request_type * @return null */ function getTransactionData ($payments, $request_type = array( self::REQUEST_TYPE_AUTH, self::REQUEST_TYPE_RECEIPT_IN )) { foreach ($payments as $payment) { if (in_array($payment->realex_hpp_api_request_type_response, $request_type)) { return $payment; } } return NULL; } function getCCtype($cctype ) { if ($cctype=='MAESTRO') { return 'MC'; } else { return $cctype; } } function getLastTransactionData ($payments, $request_type = array( self::REQUEST_TYPE_AUTH, self::REQUEST_TYPE_RECEIPT_IN )) { $payment = end($payments); if (in_array($payment->realex_hpp_api_request_type_response, $request_type)) { return $payment; } return NULL; } function isResponseSuccess ($xml_response) { $result = (string)$xml_response->result; $success = ($result == self::RESPONSE_CODE_SUCCESS); return $success; } function isResponseDeclined ($xml_response) { $result = (string)$xml_response->result; $result = ($result == self::RESPONSE_CODE_DECLINED); return $result; } function isResponseWrongPhrase ($xml_response) { $threedsecure = $xml_response->threedsecure; $threedsecure_status = (string)$threedsecure->status; $result = (string)$xml_response->result; $result = ($result == self::RESPONSE_CODE_SUCCESS AND $threedsecure_status == self::THREEDSECURE_STATUS_NOT_AUTHENTICATED); return $result; } function isResponseAlreadyProcessed ($xml_response) { $result = (string)$xml_response->result; $result = ($result == self::RESPONSE_CODE_INVALID_ORDER_ID); return $result; } function isResponseNotValidated ($xml_response) { $result = (string)$xml_response->result; $success = ($result == self::RESPONSE_CODE_NOT_VALIDATED); return $success; } function isResponseInvalidPaymentDetails ($xml_response) { $result = (string)$xml_response->result; $success = ($result == self::RESPONSE_CODE_INVALID_PAYMENT_DETAILS); return $success; } /** * get HASH for Realex * @param $secret * @param $args * @return string */ public function getSha1Hash ($secret, $args = null) { if (empty($secret)) { vmError('function getSha1Hash:no secret value for getSha1Hash', 'no secret value for getSha1Hash'); } $args = func_get_args(); array_shift($args); $hash = sha1(implode('.', $args)); //$hash =$hash.$secret; $hash = sha1($hash . '.' . $secret); return $hash; } /** * Validate the response hash from Realex. * is always timestamp.merchantid.orderid.result.message.pasref.authcode * @param $xml_response simplexml_load_string */ protected function validateResponseHash ($response) { $xml_response = simplexml_load_string($response); if (! isset($xml_response->sha1hash)) { return true; } $hash = $this->getSha1Hash($this->_method->shared_secret, $xml_response->attributes()->timestamp, $this->_method->merchant_id, (string)$xml_response->orderid, (string)$xml_response->result, (string)$xml_response->message, (string)$xml_response->pasref, (string)$xml_response->authcode); if ($hash != $xml_response->sha1hash) { $this->displayError(vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ERROR_WRONG_HASH', $hash, $xml_response->sha1hash)); return false; } return true; } /** * @return string */ function getTimestamp () { return strftime("%Y%m%d%H%M%S"); } /** * @param $xml */ function obscureSha1hash ($xml) { if (isset($xml->sha1hash)) { $xml->sha1hash = $this->obscureValue($xml->sha1hash); } return $xml; } /** * @param $value * @return string */ function obscureValue ($value) { $value_length = strlen($value); $value = str_repeat("*", $value_length); return $value; } /** * @param $xml_request * @return bool|mixed */ function getXmlResponse ($xml_request) { $this->xml_request = $xml_request; $requestToLog = $xml_request; $xml_requestToLog = simplexml_load_string($requestToLog); if ($xml_requestToLog) { if (isset($xml_requestToLog->card)) { $card_number = $xml_requestToLog->card->number; $cc_length = strlen($card_number); //$xml_requestToLog->card->number = str_repeat("*", $cc_length); $xml_requestToLog->card->number = $this->obscureValue($xml_requestToLog->card->number); if (isset($xml_requestToLog->card->cvn->number)) { $xml_requestToLog->card->cvn->number = $this->obscureValue($xml_requestToLog->card->cvn->number); } } if (isset($xml_requestToLog->paymentdata->cvn->number)) { $xml_requestToLog->paymentdata->cvn->number = $this->obscureValue($xml_requestToLog->paymentdata->cvn->number); } $xml_requestToLog = $this->obscureSha1hash($xml_requestToLog); //$this->debugLog(print_r($request, true), 'debug'); $this->debugLog('<textarea style="margin: 0px; width: 100%; height: 250px;">' . $xml_requestToLog->asXML() . '</textarea>', 'Request', 'message'); } else { // THIS IS AN ERROR: cannot log there was an error $this->debugLog('<textarea style="margin: 0px; width: 100%; height: 250px;">COULD NOT LOG INT THIS' . $requestToLog . '</textarea>', 'Request', 'error'); // we do not continue because anyway we will have <message>Bad XML formation</message> return NULL; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->getRemoteURL()); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_request); $response = curl_exec($ch); curl_close($ch); $responseToLog = $response; $xml_responseToLog = simplexml_load_string($responseToLog); if (isset($xml_responseToLog->sha1hash)) { $sha1hash = $xml_responseToLog->sha1hash; $sha1hash_length = strlen($sha1hash); $xml_responseToLog->sha1hash = str_repeat("*", $sha1hash_length); } $this->debugLog('<textarea style="margin: 0px; width: 100%; height: 250px;">' . $xml_responseToLog->asXML() . '</textarea>', 'response :', 'message'); if (empty($response)) { $this->displayError(vmText::_('VMPAYMENT_REALEX_HPP_API_EMPTY_RESPONSE')); return FALSE; } if (!$this->validateResponseHash($response)) { return FALSE; } return $response; } function useSSL () { if ($this->_method->shop_mode == 'sandbox') { return false; } return true; } /** * @param $message */ static $displayErrorDone = false; function displayError ($admin, $public = '') { if ($admin == NULL) { $admin = "an error occurred"; } if (empty($public) AND $this->_method->debug) { $public = $admin; } vmError((string)$admin, (string)$public); } /** * Realex requires that non asci characters are removed from the cc name * @param $string * @return string */ function replaceNonAsciiCharacters ($string) { $replacements = $this->getReplacements(); $string = strtr($string, $replacements); return $string; } /** * Return array of URL characters to be replaced. * * @return array */ public function getReplacements () { return array( 'Á' => 'A', 'Â' => 'A', 'Å' => 'A', 'Ă' => 'A', 'Ä' => 'A', 'À' => 'A', 'Æ' => 'A', 'Ć' => 'C', 'Ç' => 'C', 'Č' => 'C', 'Ď' => 'D', 'É' => 'E', 'È' => 'E', 'Ë' => 'E', 'Ě' => 'E', 'Ê' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ĺ' => 'L', 'ľ' => 'l', 'Ľ' => 'L', 'Ń' => 'N', 'Ň' => 'N', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ø' => 'O', 'Ŕ' => 'R', 'Ř' => 'R', 'Š' => 'S', 'Ś' => 'S', 'Ť' => 'T', 'Ů' => 'U', 'Ú' => 'U', 'Ű' => 'U', 'Ü' => 'U', 'Û' => 'U', 'Ý' => 'Y', 'Ž' => 'Z', 'Ź' => 'Z', 'á' => 'a', 'â' => 'a', 'å' => 'a', 'ä' => 'a', 'à' => 'a', 'æ' => 'a', 'ć' => 'c', 'ç' => 'c', 'č' => 'c', 'ď' => 'd', 'đ' => 'd', 'é' => 'e', 'ę' => 'e', 'ë' => 'e', 'ě' => 'e', 'è' => 'e', 'ê' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ĺ' => 'l', 'ń' => 'n', 'ň' => 'n', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'ő' => 'o', 'ö' => 'o', 'ø' => 'o', 'š' => 's', 'ś' => 's', 'ř' => 'r', 'ŕ' => 'r', 'ť' => 't', 'ů' => 'u', 'ú' => 'u', 'ù' => 'u', 'ű' => 'u', 'ü' => 'u', 'û' => 'u', 'ý' => 'y', 'ž' => 'z', 'ź' => 'z', '˙' => '-', 'ß' => 'ss', 'Ą' => 'A', 'µ' => 'u', 'ą' => 'a', 'Ę' => 'E', 'ż' => 'z', 'Ż' => 'Z', 'ł' => 'l', 'Ł' => 'L', 'А' => 'A', 'а' => 'a', 'Б' => 'B', 'б' => 'b', 'В' => 'V', 'в' => 'v', 'Г' => 'G', 'г' => 'g', 'Д' => 'D', 'д' => 'd', 'Е' => 'E', 'е' => 'e', 'Ж' => 'Zh', 'ж' => 'zh', 'З' => 'Z', 'з' => 'z', 'И' => 'I', 'и' => 'i', 'Й' => 'I', 'й' => 'i', 'К' => 'K', 'к' => 'k', 'Л' => 'L', 'л' => 'l', 'М' => 'M', 'м' => 'm', 'Н' => 'N', 'н' => 'n', 'О' => 'O', 'о' => 'o', 'П' => 'P', 'п' => 'p', 'Р' => 'R', 'р' => 'r', 'С' => 'S', 'с' => 's', 'Т' => 'T', 'т' => 't', 'У' => 'U', 'у' => 'u', 'Ф' => 'F', 'ф' => 'f', 'Х' => 'Kh', 'х' => 'kh', 'Ц' => 'Tc', 'ц' => 'tc', 'Ч' => 'Ch', 'ч' => 'ch', 'Ш' => 'Sh', 'ш' => 'sh', 'Щ' => 'Shch', 'щ' => 'shch', 'Ы' => 'Y', 'ы' => 'y', 'Э' => 'E', 'э' => 'e', 'Ю' => 'Iu', 'ю' => 'iu', 'Я' => 'Ia', 'я' => 'ia', 'Ъ' => '', 'ъ' => '', 'Ь' => '', 'ь' => '', 'Ё' => 'E', 'ё' => 'e', 'ου' => 'ou', 'ού' => 'ou', 'α' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd', 'ε' => 'e', 'ζ' => 'z', 'η' => 'i', 'θ' => 'th', 'ι' => 'i', 'κ' => 'k', 'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => 'ks', 'ο' => 'o', 'π' => 'p', 'ρ' => 'r', 'σ' => 's', 'τ' => 't', 'υ' => 'i', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'ps', 'ω' => 'o', 'ά' => 'a', 'έ' => 'e', 'ί' => 'i', 'ή' => 'i', 'ό' => 'o', 'ύ' => 'i', 'ώ' => 'o', 'Ου' => 'ou', 'Ού' => 'ou', 'Α' => 'a', 'Β' => 'b', 'Γ' => 'g', 'Δ' => 'd', 'Ε' => 'e', 'Ζ' => 'z', 'Η' => 'i', 'Θ' => 'th', 'Ι' => 'i', 'Κ' => 'k', 'Λ' => 'l', 'Μ' => 'm', 'Ν' => 'n', 'Ξ' => 'ks', 'Ο' => 'o', 'Π' => 'p', 'Ρ' => 'r', 'Σ' => 's', 'Τ' => 't', 'Υ' => 'i', 'Φ' => 'f', 'Χ' => 'x', 'Ψ' => 'ps', 'Ω' => 'o', 'ς' => 's', 'Ά' => 'a', 'Έ' => 'e', 'Ή' => 'i', 'Ί' => 'i', 'Ό' => 'o', 'Ύ' => 'i', 'Ώ' => 'o', 'ϊ' => 'i', 'ΐ' => 'i', ); } } realex_hpp_api/helpers/redirect.php 0000644 00000060121 15232603237 0013503 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: redirect.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2019 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('_JEXEC') or die('Restricted access'); class RealexHelperRealexRedirect extends RealexHelperRealex { function __construct ($method, $plugin) { parent::__construct($method, $plugin); } public function confirmedOrder (&$postRequest) { $selectedCCParams = array(); if (!$this->doRealvault($selectedCCParams)) { $response = $this->sendPostRequest(); $postRequest = true; } else { $response = $this->realvaultReceiptIn($selectedCCParams); } return $response; } function doRealVault (&$selectedCCParams) { //$saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); //$selectedCCParams = $this->getSelectedCCParams($saved_cc_selected, $this->cart->virtuemart_paymentmethod_id); $doRealVault = false; if (!JFactory::getUser()->guest AND $this->_method->realvault and $this->getStoredCCs(JFactory::getUser()->id)) { //if (!$selectedCCParams->addNew) { $doRealVault = true; //} } $this->debugLog((int)$doRealVault, 'Realex doRealVault:', 'debug'); return $doRealVault; } function sendPostRequest () { $post_variables = $this->getPostVariables(); $jump_url = $this->getJumpUrl(); $html = ''; if ($this->_method->debug) { $html .= '<form action="' . $jump_url . '" method="post" name="vm_realex_form" target="realex">'; } else { if (VmConfig::get('css')) { $msg = vmText::_('VMPAYMENT_REALEX_HPP_API_REDIRECT_MESSAGE', true); } else { $msg=''; } vmJsApi::addJScript('vm.paymentFormAutoSubmit', ' jQuery(document).ready(function($){ jQuery("body").addClass("vmLoading"); var msg="'.$msg.'"; jQuery("body").append("<div class=\"vmLoadingDiv\"><div class=\"vmLoadingDivMsg\">"+msg+"</div></div>"); jQuery("#vmPaymentForm").submit(); }) '); $html .= '<form action="' . $jump_url . '" method="post" name="vm_realex_form" id="vmPaymentForm" accept-charset="UTF-8">'; } $html .= '<input type="hidden" name="charset" value="utf-8">'; foreach ($post_variables as $name => $value) { $html .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />'; } if ($this->_method->debug) { $html .= '<div style="background-color:red;color:white;padding:10px;"> <input type="submit" value="The method is in debug mode. Click here to be redirected to Realex" /> </div>'; $this->debugLog($post_variables, 'sendPostRequest:', 'debug'); } $html .= '</form>'; return $html; } function getPostVariables () { $BT = $this->order['details']['BT']; $ST = ((isset($this->order['details']['ST'])) ? $this->order['details']['ST'] : $this->order['details']['BT']); // prepare postdata $post_variables = array(); $post_variables['MERCHANT_ID'] = $this->_method->merchant_id; $post_variables['ACCOUNT'] = $this->_method->subaccount; $post_variables['ORDER_ID'] = $BT->order_number; $post_variables['AMOUNT'] = $this->getTotalInPaymentCurrency(); $post_variables['CURRENCY'] = $this->getPaymentCurrency(); $post_variables['LANG'] = $this->getPaymentLang(); $post_variables['TIMESTAMP'] = $this->getTimestamp(); $post_variables['DCC_ENABLE'] = $this->_method->dcc; // $post_variables['COMMENT1'] = $this->setComment1(); // $post_variables['COMMENT2'] = 'virtuemart-rlx'; $post_variables['MERCHANT_RESPONSE_URL'] = JURI::root() . 'index.php?option=com_virtuemart&format=raw&view=pluginresponse&task=pluginnotification¬ificationTask=handleRedirect&tmpl=component'; $post_variables['AUTO_SETTLE_FLAG'] = $this->getSettlement(); if ($BT->virtuemart_user_id != 0) { //$post_variables['VAR_REF'] = $BT->order_number; $post_variables['CARD_STORAGE_ENABLE'] = $this->_method->realvault; if ($this->_method->realvault) { $payerRef = $this->getSavedPayerRef(); if (!$payerRef) { $post_variables['PAYER_EXIST'] = 0; $post_variables['PMT_REF'] = ''; $post_variables['PAYER_REF'] = $this->getNewPayerRef(); } else { $post_variables['PAYER_REF'] = $payerRef; $post_variables['PAYER_EXIST'] = 1; $saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); // -1: use another card, empty no CC are stored if ($saved_cc_selected == -1 or empty($saved_cc_selected)) { $post_variables['PMT_REF'] = ''; } else { $post_variables['PMT_REF'] = $this->getPmtRef(); } } $post_variables['OFFER_SAVE_CARD'] = $this->_method->offer_save_card; } else { $post_variables['OFFER_SAVE_CARD'] = 0; } } else { $post_variables['OFFER_SAVE_CARD'] = 0; $post_variables['CARD_STORAGE_ENABLE'] = 0; } if ($this->_method->card_payment_button) { $post_variables['CARD_PAYMENT_BUTTON'] = $this->getCardPaymentButton($this->_method->card_payment_button); } if ($this->_method->realvault and $BT->virtuemart_user_id != 0) { $post_variables['SHA1HASH'] = $this->getSha1Hash($this->_method->shared_secret, $post_variables['TIMESTAMP'], $post_variables['MERCHANT_ID'], $post_variables['ORDER_ID'], $post_variables['AMOUNT'], $post_variables['CURRENCY'], $post_variables['PAYER_REF'], $post_variables['PMT_REF']); } else { $post_variables['SHA1HASH'] = $this->getSha1Hash($this->_method->shared_secret, $post_variables['TIMESTAMP'], $post_variables['MERCHANT_ID'], $post_variables['ORDER_ID'], $post_variables['AMOUNT'], $post_variables['CURRENCY']); } // use_tss? if uk if ($this->_method->tss) { $post_variables['RETURN_TSS'] = 1; // Transaction Suitability Score // <digits from postcode>|<digits from address> $post_variables['BILLING_CODE'] = $this->getCode($BT); $post_variables['BILLING_CO'] = ShopFunctions::getCountryByID($BT->virtuemart_country_id, 'country_2_code'); $post_variables['SHIPPING_CODE'] = $this->getCode($ST); $post_variables['SHIPPING_CO'] = ShopFunctions::getCountryByID($ST->virtuemart_country_id, 'country_2_code'); } $post_variables['gateway_url'] = $this->_getRealexUrl(); $additionalHppData = array( "HPP_VERSION" => 2, "COMMENT1" => "virtuemart" ); // billing address is guaranteed to be present $billingAddress = $BT; $additionalHppData[] = array( // customer fields "HPP_CUSTOMER_EMAIL" => $billingAddress->email ?: '', // Magento 1 does not have any phone number ); $phoneCodes = $this->getCountryPhoneCodes(); $billingPhoneNumber = $billingAddress->phone_1 ?: ($billingAddress->phone_2 ?: false); $billingCountryAlpha2Code = ShopFunctions::getCountryByID($billingAddress->virtuemart_country_id, 'country_2_code'); if ($billingPhoneNumber && $billingCountryAlpha2Code && isset($phoneCodes[$billingCountryAlpha2Code])) { $phoneCode = $phoneCodes[$billingCountryAlpha2Code]; $formattedPhoneNumber = preg_replace("/^0+|[^\d]/", '', $billingPhoneNumber); if (substr($formattedPhoneNumber, 0, strlen($phoneCode)) === $phoneCode) { $formattedPhoneNumber = substr($formattedPhoneNumber, strlen($phoneCode)); } if (is_string($formattedPhoneNumber)) { $additionalHppData["HPP_CUSTOMER_PHONENUMBER_MOBILE"] = $phoneCode . '|' . $formattedPhoneNumber; } } $hppBillingFields = array( "HPP_BILLING_STREET1" => $billingAddress->address_1, "HPP_BILLING_STREET2" => $billingAddress->address_2, "HPP_BILLING_STREET3" => '', "HPP_BILLING_CITY" => $billingAddress->city, "HPP_BILLING_STATE" => $billingCountryAlpha2Code && in_array($billingCountryAlpha2Code, array('US', 'CA')) ? ShopFunctions::getStateByID($billingAddress->virtuemart_state_id, 'state_2_code') : '', "HPP_BILLING_POSTALCODE" => $billingAddress->zip, "HPP_BILLING_COUNTRY" => $billingCountryAlpha2Code ? $this->getCountryNumericCode($billingCountryAlpha2Code) : '', ); $additionalHppData[] = $hppBillingFields; $isOrderVirtual = false; $shippingAddress = isset($this->order['details']['ST']) ? $this->order['details']['ST'] : false; $shippingCountryAlpha2Code = ShopFunctions::getCountryByID($shippingAddress->virtuemart_country_id, 'country_2_code'); $hppShippingFields = array( "HPP_SHIPPING_STREET1" => !$isOrderVirtual && $shippingAddress ? $shippingAddress->address_1 : '', "HPP_SHIPPING_STREET2" => !$isOrderVirtual && $shippingAddress ? $shippingAddress->address_2 : '', "HPP_SHIPPING_STREET3" => '', "HPP_SHIPPING_CITY" => !$isOrderVirtual && $shippingAddress ? $shippingAddress->city : '', "HPP_SHIPPING_STATE" => !$isOrderVirtual && $shippingAddress && $shippingCountryAlpha2Code ? (in_array($shippingCountryAlpha2Code, array('US', 'CA')) ? ShopFunctions::getStateByID($shippingAddress->virtuemart_state_id, 'state_2_code') : '') : '', "HPP_SHIPPING_POSTALCODE" => !$isOrderVirtual && $shippingAddress ? $shippingAddress->zip : '', "HPP_SHIPPING_COUNTRY" => !$isOrderVirtual && $shippingAddress && $shippingCountryAlpha2Code ? $this->getCountryNumericCode($shippingCountryAlpha2Code) : '' ); // order and type matter if (array_values($hppBillingFields) === array_values($hppShippingFields)) { $additionalHppData["HPP_ADDRESS_MATCH_INDICATOR"] = "TRUE"; $additionalHppData[] = $hppShippingFields; } else { $additionalHppData["HPP_ADDRESS_MATCH_INDICATOR"] = "FALSE"; $additionalHppData[] = $hppShippingFields; } foreach ($additionalHppData as $additionalHppProp => $additionalHppValue) { if (is_array($additionalHppValue)) { foreach ($additionalHppValue as $additionalHppPropChild => $additionalHppValueChild) { $post_variables[$additionalHppPropChild] = $additionalHppValueChild; } } else { $post_variables[$additionalHppProp] = $additionalHppValue; } } return $post_variables; } /** * @param $realex_data * @return bool */ function cardStorageResponse ($realex_data) { $userfield=false; if (isset($realex_data['REALWALLET_CHOSEN']) and $realex_data['REALWALLET_CHOSEN'] == 0) { return false; } if (isset($realex_data['PAYER_SETUP']) and $realex_data['PAYER_SETUP'] != self::PAYER_SETUP_SUCCESS) { $this->debugLog('cardStorageResponse PAYER_SETUP not successfull:' . $realex_data['PAYER_SETUP'] . ' ' . $realex_data['PAYER_SETUP_MSG'], 'debug'); return false; } if ((isset($realex_data['PAYER_SETUP']) and $realex_data['PAYER_SETUP'] == self::PAYER_SETUP_SUCCESS)) { $this->saveNewPayerRef($realex_data['SAVED_PAYER_REF']); } if ((isset($realex_data['PMT_SETUP']) and $realex_data['PMT_SETUP'] != self::PMT_SETUP_SUCCESS)) { $this->debugLog('cardStorageResponse PMT_SETUP not successfull:' . $realex_data['PMT_SETUP'] . ' ' . $realex_data['PMT_SETUP_MSG'], 'debug'); return false; } if ((isset($realex_data['PMT_SETUP']) and $realex_data['PMT_SETUP'] == self::PMT_SETUP_SUCCESS)) { $userfield = $this->getPaymentRef($realex_data); //$this->storeNewPayment($userfield); } return $userfield; } /** * @param $realex_data * @return mixed */ function getPaymentRef ($realex_data) { $fields = array( 'SAVED_PMT_TYPE', 'SAVED_PMT_REF', 'SAVED_PMT_DIGITS', 'SAVED_PMT_EXPDATE', 'SAVED_PMT_NAME', ); $userfield['virtuemart_user_id'] = $this->order['details']['BT']->virtuemart_user_id; $userfield['merchant_id'] = $this->_method->merchant_id; foreach ($fields as $field) { if (isset($realex_data[$field])) { if ($field == 'SAVED_PMT_DIGITS') { $realex_data[$field] = shopFunctionsF::mask_string($realex_data[$field], '*'); } $userfield['realex_hpp_api_' . strtolower($field)] = $realex_data[$field]; } } return $userfield; } /** * @param bool $enqueueMessage * @return bool */ function validateConfirmedOrder ($enqueueMessage = true) { return $this->validate(); } /** * @param bool $enqueueMessage * @return bool */ public function validate ($enqueueMessage = true) { if (!JFactory::getUser()->guest AND $this->_method->realvault) { if ($storedCCs = $this->getStoredCCs(JFactory::getUser()->id)) { $saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); if ($this->customerData->getVar('selected_method') AND empty($saved_cc_selected)) { vmInfo('VMPAYMENT_REALEX_HPP_API_PLEASE_SELECT_OPTION'); return false; } } } return true; } /** * @param bool $enqueueMessage * @return bool */ public function validateSelectCheckPayment ($enqueueMessage = true) { return $this->validate(); } /** * @return bool */ function validateCheckoutCheckDataPayment () { return $this->validate(); } function getExtraPluginInfo () { $extraPluginInfo = array(); $saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); if ($saved_cc_selected != -1) { $selected_cc = $this->getSelectedCCParams($saved_cc_selected); if (!empty($selected_cc)) { $extraPluginInfo['cc_type'] = $selected_cc->realex_hpp_api_saved_pmt_type; $extraPluginInfo['cc_number'] = $selected_cc->realex_hpp_api_saved_pmt_digits; $extraPluginInfo['cc_name'] = $selected_cc->realex_hpp_api_saved_pmt_name; $extraPluginInfo['cc_expire_month'] = ""; $extraPluginInfo['cc_expire_year'] = ""; } } else { $extraPluginInfo['cc_number'] = vmText::_('VMPAYMENT_REALEX_HPP_API_USE_ANOTHER_CC'); } return $extraPluginInfo; } /** * Validate the response hash from Realex. * timestamp.merchantid.orderid.amount.curr.payerref.pmtref */ function validateResponseHash ($post) { if (is_array($post)) { $message = stripslashes($post['MESSAGE']); $message = str_replace(''', "'", $message); $hash = $this->getSha1Hash($this->_method->shared_secret, $post['TIMESTAMP'], $post['MERCHANT_ID'], $post['ORDER_ID'], $post['RESULT'], $message, isset($post['PASREF']) ? $post['PASREF'] : "", isset($post['AUTHCODE']) ? $post['AUTHCODE'] : ""); if ($hash != $post['SHA1HASH']) { $this->debugLog('validateResponseHash :' . var_export($post, true), 'debug'); //$this->displayError(vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ERROR_WRONG_HASH', $hash, print_r($post, true))); //echo vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ERROR_WRONG_HASH', $hash, $post['SHA1HASH']); //print_r($_POST); return FALSE; } } else { return parent::validateResponseHash($post); } return true; } function setComment1 () { $amountValue = vmPSPlugin::getAmountInCurrency($this->order['details']['BT']->order_total, $this->order['details']['BT']->order_currency); $currencyDisplay = CurrencyDisplay::getInstance($this->cart->pricesCurrency); $shop_name = $this->getVendorInfo('vendor_store_name'); return vmText::sprintf('VMPAYMENT_REALEX_HPP_API_COMMENT1', $amountValue['display'], $this->order['details']['BT']->order_number, $shop_name); } /** * JumpUrl is a prefined URL that must be configurated in Realex * @return string */ function getJumpUrl () { return $this->_method->referring_url; } /** * @return array */ private function getCountryNumericCodes() { return array( 'AF' => '004', 'AX' => '248', 'AL' => '008', 'DZ' => '012', 'AS' => '016', 'AD' => '020', 'AO' => '024', 'AI' => '660', 'AQ' => '010', 'AG' => '028', 'AR' => '032', 'AM' => '051', 'AW' => '533', 'AU' => '036', 'AT' => '040', 'AZ' => '031', 'BS' => '044', 'BH' => '048', 'BD' => '050', 'BB' => '052', 'BY' => '112', 'BE' => '056', 'BZ' => '084', 'BJ' => '204', 'BM' => '060', 'BT' => '064', 'BO' => '068', 'BQ' => '535', 'BA' => '070', 'BW' => '072', 'BV' => '074', 'BR' => '076', 'IO' => '086', 'BN' => '096', 'BG' => '100', 'BF' => '854', 'BI' => '108', 'CV' => '132', 'KH' => '116', 'CM' => '120', 'CA' => '124', 'KY' => '136', 'CF' => '140', 'TD' => '148', 'CL' => '152', 'CN' => '156', 'CX' => '162', 'CC' => '166', 'CO' => '170', 'KM' => '174', 'CG' => '178', 'CD' => '180', 'CK' => '184', 'CR' => '188', 'CI' => '384', 'HR' => '191', 'CU' => '192', 'CW' => '531', 'CY' => '196', 'CZ' => '203', 'DK' => '208', 'DJ' => '262', 'DM' => '212', 'DO' => '214', 'EC' => '218', 'EG' => '818', 'SV' => '222', 'GQ' => '226', 'ER' => '232', 'EE' => '233', 'ET' => '231', 'SZ' => '748', 'FK' => '238', 'FO' => '234', 'FJ' => '242', 'FI' => '246', 'FR' => '250', 'GF' => '254', 'PF' => '258', 'TF' => '260', 'GA' => '266', 'GM' => '270', 'GE' => '268', 'DE' => '276', 'GH' => '288', 'GI' => '292', 'GR' => '300', 'GL' => '304', 'GD' => '308', 'GP' => '312', 'GU' => '316', 'GT' => '320', 'GG' => '831', 'GN' => '324', 'GW' => '624', 'GY' => '328', 'HT' => '332', 'HM' => '334', 'VA' => '336', 'HN' => '340', 'HK' => '344', 'HU' => '348', 'IS' => '352', 'IN' => '356', 'ID' => '360', 'IR' => '364', 'IQ' => '368', 'IE' => '372', 'IM' => '833', 'IL' => '376', 'IT' => '380', 'JM' => '388', 'JP' => '392', 'JE' => '832', 'JO' => '400', 'KZ' => '398', 'KE' => '404', 'KI' => '296', 'KP' => '408', 'KR' => '410', 'KW' => '414', 'KG' => '417', 'LA' => '418', 'LV' => '428', 'LB' => '422', 'LS' => '426', 'LR' => '430', 'LY' => '434', 'LI' => '438', 'LT' => '440', 'LU' => '442', 'MO' => '446', 'MK' => '807', 'MG' => '450', 'MW' => '454', 'MY' => '458', 'MV' => '462', 'ML' => '466', 'MT' => '470', 'MH' => '584', 'MQ' => '474', 'MR' => '478', 'MU' => '480', 'YT' => '175', 'MX' => '484', 'FM' => '583', 'MD' => '498', 'MC' => '492', 'MN' => '496', 'ME' => '499', 'MS' => '500', 'MA' => '504', 'MZ' => '508', 'MM' => '104', 'NA' => '516', 'NR' => '520', 'NP' => '524', 'NL' => '528', 'NC' => '540', 'NZ' => '554', 'NI' => '558', 'NE' => '562', 'NG' => '566', 'NU' => '570', 'NF' => '574', 'MP' => '580', 'NO' => '578', 'OM' => '512', 'PK' => '586', 'PW' => '585', 'PS' => '275', 'PA' => '591', 'PG' => '598', 'PY' => '600', 'PE' => '604', 'PH' => '608', 'PN' => '612', 'PL' => '616', 'PT' => '620', 'PR' => '630', 'QA' => '634', 'RE' => '638', 'RO' => '642', 'RU' => '643', 'RW' => '646', 'BL' => '652', 'SH' => '654', 'KN' => '659', 'LC' => '662', 'MF' => '663', 'PM' => '666', 'VC' => '670', 'WS' => '882', 'SM' => '674', 'ST' => '678', 'SA' => '682', 'SN' => '686', 'RS' => '688', 'SC' => '690', 'SL' => '694', 'SG' => '702', 'SX' => '534', 'SK' => '703', 'SI' => '705', 'SB' => '090', 'SO' => '706', 'ZA' => '710', 'GS' => '239', 'SS' => '728', 'ES' => '724', 'LK' => '144', 'SD' => '729', 'SR' => '740', 'SJ' => '744', 'SE' => '752', 'CH' => '756', 'SY' => '760', 'TW' => '158', 'TJ' => '762', 'TZ' => '834', 'TH' => '764', 'TL' => '626', 'TG' => '768', 'TK' => '772', 'TO' => '776', 'TT' => '780', 'TN' => '788', 'TR' => '792', 'TM' => '795', 'TC' => '796', 'TV' => '798', 'UG' => '800', 'UA' => '804', 'AE' => '784', 'GB' => '826', 'US' => '840', 'UM' => '581', 'UY' => '858', 'UZ' => '860', 'VU' => '548', 'VE' => '862', 'VN' => '704', 'VG' => '092', 'VI' => '850', 'WF' => '876', 'EH' => '732', 'YE' => '887', 'ZM' => '894', 'ZW' => '716', ); } private function getCountryPhoneCodes() { return array ( 'AD' => '376', 'AE' => '971', 'AF' => '93', 'AG' => '1268', 'AI' => '1264', 'AL' => '355', 'AM' => '374', 'AN' => '599', 'AO' => '244', 'AQ' => '672', 'AR' => '54', 'AS' => '1684', 'AT' => '43', 'AU' => '61', 'AW' => '297', 'AZ' => '994', 'BA' => '387', 'BB' => '1246', 'BD' => '880', 'BE' => '32', 'BF' => '226', 'BG' => '359', 'BH' => '973', 'BI' => '257', 'BJ' => '229', 'BL' => '590', 'BM' => '1441', 'BN' => '673', 'BO' => '591', 'BR' => '55', 'BS' => '1242', 'BT' => '975', 'BW' => '267', 'BY' => '375', 'BZ' => '501', 'CA' => '1', 'CC' => '61', 'CD' => '243', 'CF' => '236', 'CG' => '242', 'CH' => '41', 'CI' => '225', 'CK' => '682', 'CL' => '56', 'CM' => '237', 'CN' => '86', 'CO' => '57', 'CR' => '506', 'CU' => '53', 'CV' => '238', 'CX' => '61', 'CY' => '357', 'CZ' => '420', 'DE' => '49', 'DJ' => '253', 'DK' => '45', 'DM' => '1767', 'DO' => '1809', 'DZ' => '213', 'EC' => '593', 'EE' => '372', 'EG' => '20', 'ER' => '291', 'ES' => '34', 'ET' => '251', 'FI' => '358', 'FJ' => '679', 'FK' => '500', 'FM' => '691', 'FO' => '298', 'FR' => '33', 'GA' => '241', 'GB' => '44', 'GD' => '1473', 'GE' => '995', 'GH' => '233', 'GI' => '350', 'GL' => '299', 'GM' => '220', 'GN' => '224', 'GQ' => '240', 'GR' => '30', 'GT' => '502', 'GU' => '1671', 'GW' => '245', 'GY' => '592', 'HK' => '852', 'HN' => '504', 'HR' => '385', 'HT' => '509', 'HU' => '36', 'ID' => '62', 'IE' => '353', 'IL' => '972', 'IM' => '44', 'IN' => '91', 'IQ' => '964', 'IR' => '98', 'IS' => '354', 'IT' => '39', 'JM' => '1876', 'JO' => '962', 'JP' => '81', 'KE' => '254', 'KG' => '996', 'KH' => '855', 'KI' => '686', 'KM' => '269', 'KN' => '1869', 'KP' => '850', 'KR' => '82', 'KW' => '965', 'KY' => '1345', 'KZ' => '7', 'LA' => '856', 'LB' => '961', 'LC' => '1758', 'LI' => '423', 'LK' => '94', 'LR' => '231', 'LS' => '266', 'LT' => '370', 'LU' => '352', 'LV' => '371', 'LY' => '218', 'MA' => '212', 'MC' => '377', 'MD' => '373', 'ME' => '382', 'MF' => '1599', 'MG' => '261', 'MH' => '692', 'MK' => '389', 'ML' => '223', 'MM' => '95', 'MN' => '976', 'MO' => '853', 'MP' => '1670', 'MR' => '222', 'MS' => '1664', 'MT' => '356', 'MU' => '230', 'MV' => '960', 'MW' => '265', 'MX' => '52', 'MY' => '60', 'MZ' => '258', 'NA' => '264', 'NC' => '687', 'NE' => '227', 'NG' => '234', 'NI' => '505', 'NL' => '31', 'NO' => '47', 'NP' => '977', 'NR' => '674', 'NU' => '683', 'NZ' => '64', 'OM' => '968', 'PA' => '507', 'PE' => '51', 'PF' => '689', 'PG' => '675', 'PH' => '63', 'PK' => '92', 'PL' => '48', 'PM' => '508', 'PN' => '870', 'PR' => '1', 'PT' => '351', 'PW' => '680', 'PY' => '595', 'QA' => '974', 'RO' => '40', 'RS' => '381', 'RU' => '7', 'RW' => '250', 'SA' => '966', 'SB' => '677', 'SC' => '248', 'SD' => '249', 'SE' => '46', 'SG' => '65', 'SH' => '290', 'SI' => '386', 'SK' => '421', 'SL' => '232', 'SM' => '378', 'SN' => '221', 'SO' => '252', 'SR' => '597', 'ST' => '239', 'SV' => '503', 'SY' => '963', 'SZ' => '268', 'TC' => '1649', 'TD' => '235', 'TG' => '228', 'TH' => '66', 'TJ' => '992', 'TK' => '690', 'TL' => '670', 'TM' => '993', 'TN' => '216', 'TO' => '676', 'TR' => '90', 'TT' => '1868', 'TV' => '688', 'TW' => '886', 'TZ' => '255', 'UA' => '380', 'UG' => '256', 'US' => '1', 'UY' => '598', 'UZ' => '998', 'VA' => '39', 'VC' => '1784', 'VE' => '58', 'VG' => '1284', 'VI' => '1340', 'VN' => '84', 'VU' => '678', 'WF' => '681', 'WS' => '685', 'XK' => '381', 'YE' => '967', 'YT' => '262', 'ZA' => '27', 'ZM' => '260', 'ZW' => '263', ); } /** * @param $alpha2 * * @return mixed|string */ private function getCountryNumericCode($alpha2) { $countries = $this->getCountryNumericCodes(); return isset($countries[$alpha2]) ? $countries[$alpha2] : ''; } } realex_hpp_api/helpers/remote.php 0000644 00000007744 15232603237 0013211 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: remote.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('_JEXEC') or die('Restricted access'); class RealexHelperRealexRemote extends RealexHelperRealex { function __construct ($method, $plugin) { parent::__construct($method, $plugin); } public function confirmedOrder (&$postRequest, &$request3DSecure) { $postRequest = false; $request3DSecure = false; if ($this->_method->dcc) { $response = $this->requestDccRate(); } elseif ($this->_method->threedsecure and $this->isCC3DSVerifyEnrolled()) { $request3DSecure = true; $response = $this->request3DSecure(); } else { $response = $this->requestAuth(); } return $response; } /** * @return array */ function getExtraPluginInfo () { return NULL; } function confirmedOrderDccRequest ($response_dcc) { $request3DSecure = false; if ($this->_method->threedsecure and $this->isCC3DSVerifyEnrolled()) { $request3DSecure = true; $response = $this->request3DSecure(); } else { $selectedCCParams = array(); if ($this->doRealVault($selectedCCParams)) { $newPayerRef = ""; $responseNewPayer = $this->setNewPayer($newPayerRef); $setNewPayerSuccess = $this->manageSetNewPayer($responseNewPayer); if ($setNewPayerSuccess) { $newPaymentRef = ""; $responseNewPayment = $this->setNewPayment($newPayerRef, $newPaymentRef); $setNewPaymentSuccess = $this->manageSetNewPayment($responseNewPayment, $newPayerRef, $newPaymentRef); } } $xml_response_dcc = simplexml_load_string($response_dcc); // TODO if using CC stored? $response = $this->requestAuth($xml_response_dcc); $this->manageResponseRequestAuth($response); } } /** * @return string */ function displayExtraPluginInfo () { return NULL; } /** * @param bool $enqueueMessage * @return bool */ function validateRemoteCCForm ($enqueueMessage = true) { if (!class_exists('Creditcard')) { require(VMPATH_ADMIN . DS . 'helpers' . DS . 'creditcard.php'); } $html = ''; $cc_valid = true; $errormessages = array(); $saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); $cc_type = $this->customerData->getVar('cc_type'); $cc_number = $this->customerData->getVar('cc_number'); $cc_name = $this->customerData->getVar('cc_name'); $cc_cvv = $this->customerData->getVar('cc_cvv'); $cc_expire_month = $this->customerData->getVar('cc_expire_month'); $cc_expire_year = $this->customerData->getVar('cc_expire_year'); if (!Creditcard::validate_credit_card_number($cc_type, $cc_number)) { $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_NUMBER_INVALID'; $cc_valid = false; } if ($this->_method->cvn_checking AND !Creditcard::validate_credit_card_cvv($cc_type, $cc_cvv, true, $cc_number)) { $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_CVV_INVALID'; $cc_valid = false; } if (!Creditcard::validate_credit_card_date($cc_type, $cc_expire_month, $cc_expire_year)) { $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_EXPIRATION_DATE_INVALID'; $cc_valid = false; } if (empty($cc_name)) { $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_NAME_INVALID'; $cc_valid = false; } if (!$cc_valid) { foreach ($errormessages as $msg) { $html .= vmText::_($msg) . "<br/>"; } } if (!$cc_valid) { $app = JFactory::getApplication(); $app->enqueueMessage($html, 'error'); return false; } return true; } } realex_hpp_api/tmpl/redirect_form.php 0000644 00000003615 15232603237 0014045 0 ustar 00 <?php defined('_JEXEC') or die(); /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: redirect_form.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ ?> <input type="radio" name="virtuemart_paymentmethod_id" id="payment_id_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>" value="<?php echo $viewData['virtuemart_paymentmethod_id']; ?>" <?php echo $viewData ['checked']; ?>> <label for="payment_id_<?php echo $viewData['virtuemart_paymentmethod_id']; ?>"> <span class="vmpayment"> <?php if (!empty($viewData['payment_logo'])) { ?> <span class="vmpayment_logo"><?php echo $viewData ['payment_logo']; ?> </span> <?php } ?> <span class="vmpayment_name"><?php echo $viewData['payment_name']; ?></span> <?php if (!empty($viewData['payment_cost'])) { ?> <span class="vmpayment_cost"><?php echo vmText::_('COM_VIRTUEMART_PLUGIN_COST_DISPLAY') . $viewData['payment_cost'] ?></span> <?php } ?> </span> <?php /* if (!empty($viewData['creditcardsDropDown'])) { ?> <div class="creditcardsDropDown"> <?php echo $viewData['creditcardsDropDown']; ?> </div> <?php } */ if (!empty($viewData['offerSaveCard'])) { ?> <div class="realex_offerSaveCard"> <?php echo $viewData['offerSaveCard']; ?> </div> <?php } ?> </label> realex_hpp_api/tmpl/remote_cc_form.php 0000644 00000032410 15232603237 0014177 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: remote_cc_form.php 10798 2023-03-20 09:56:06Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('_JEXEC') or die(); $ccData = $viewData['ccData']; JHtml::_('bootstrap.tooltip'); JHTML::script('vmcreditcard.js', 'components/com_virtuemart/assets/js/', false); vmLanguage::loadJLang('com_virtuemart', true); vmJsApi::jCreditCard(); vmJsApi::jQuery(); vmJsApi::chosenDropDowns(); vmJsApi::addJScript( '/plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/js/site.js'); vmJsApi::css( 'realex','plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/css/'); vmJsApi::addJScript ('vmRealexSumit'," jQuery(document).ready(function($) { jQuery(this).vm2front('stopVmLoading'); jQuery('#checkoutRealexFormSubmitButton').bind('click dblclick', function(e){ jQuery(this).vm2front('startVmLoading'); e.preventDefault(); jQuery(this).attr('disabled', 'true'); jQuery(this).removeClass( 'vm-button-correct' ); jQuery(this).addClass( 'vm-button' ); jQuery('#checkoutRealexFormSubmit').submit(); }); }); "); $attribute = ''; if ($viewData['dccinfo']) { $attribute = ' readonly '; } ?> <div class="realex remote_cc_form" id="remote_cc_form"> <h3 class="order_amount"><?php echo $viewData['order_amount']; ?></h3> <div class="cc_form_payment_name"> <?php echo $viewData['payment_name']; ?> </div> <form method="post" action="<?php echo $viewData['submit_url'] ?>" id="checkoutRealexFormSubmit"> <?php if (!$viewData['dccinfo']) { ?> <?php if (!empty($viewData['creditcardsDropDown'])) { ?> <div class="vmpayment_cardinfo" id="vmpayment_cardinfo"> <div class="vmpayment_cardinfo_text"> <?php if (!$viewData['dccinfo']) { echo vmText::_('VMPAYMENT_REALEX_HPP_API_PLEASE_SELECT'); } else { echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_YOUR_CC'); } ?> </div> <div class="creditcardsDropDown"> <?php echo $viewData['creditcardsDropDown']; ?> </div> </div> <?php if ($viewData['cvn_checking']) { ?> <div class="vmpayment_cc_info vmpayment_cc_cvv_realvault"> <span class="vmpayment_label"><label for="cc_cvv_realvault"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_CVV2') ?></label></span> <input type="text" class="inputbox cc_cvv" id="cc_cvv" name="cc_cvv_realvault" maxlength="4" size="5" value="<?php echo $ccData['cc_cvv_realvault']; ?>" autocomplete="off"/> <span class="hasTip" title="<?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV') ?>::<?php echo vmText::sprintf("VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV_TOOLTIP", $this->_getCVVImages($viewData['cvv_images'])) ?> "> <?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV'); ?> </span> </div> <?php } } else { ?> <input type="hidden" name="saved_cc_selected" value="-1"/> <?php } } ?> <div class="vmpayment_cardinfo realexRemoteCCForm"> <?php if ($viewData['integration'] == 'remote') { ?> <div class="vmpayment_cardinfo_text"> <?php if (!$viewData['dccinfo']) { if (empty($viewData['creditcardsDropDown'])) { echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_COMPLETE_FORM'); } else { echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_ADD_NEW'); } } else { echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_YOUR_CC'); } ?> </div> <div class="vmpayment_cc_info vmpayment_creditcardtype"> <span class="vmpayment_label"><label for="creditcardtype"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_CCTYPE'); ?></label></span> <?php if (!$viewData['dccinfo']) { foreach ($viewData['creditcards'] as $creditCard) { $options[] = JHTML::_('select.option', $creditCard, vmText::_('VMPAYMENT_REALEX_HPP_API_CC_' . strtoupper($creditCard))); } $attribs = 'class="inputbox vm-chzn-select" style= "width: 250px;" rel="' . $viewData['virtuemart_paymentmethod_id'] . '"'; echo JHTML::_('select.genericlist', $options, 'cc_type', $attribs, 'value', 'text', $ccData['cc_type']); } else { ?> <span class="vmpayment_creditcardtype_<?php echo $ccData['cc_type'] ?>"> <?php echo $ccData['cc_type']; ?> </span> <input type="hidden" name="cc_type" value="<?php echo $ccData['cc_type'] ?>"/> <input type="hidden" name="saved_cc_selected" value="<?php echo $ccData['saved_cc_selected'] ?>"/> <?php }?> </div> <div class="vmpayment_cc_info vmpayment_cc_type"> <span class="vmpayment_label"><label for="cc_type"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_CCNUM'); ?></label></span> <?php if (!$viewData['dccinfo']) { ?> <input type="text" size="30" class="inputbox" id="cc_number" name="cc_number" value="<?php echo wordwrap($ccData['cc_number'], 4, " "); ?>" autocomplete="off" onchange="ccError=razCCerror(<?php echo $viewData['virtuemart_paymentmethod_id']; ?>); CheckCreditCardNumber(this . value, <?php echo $viewData['virtuemart_paymentmethod_id']; ?>); if (!ccError) { this.value='';}"/> <div id="cc_cardnumber_errormsg"></div> <?php } else { echo wordwrap($ccData['cc_number_masked'], 4, " "); ?> <input type="hidden" name="cc_number" value="<?php echo $ccData['cc_number'] ?>"/> <?php }?> </div> <?php //if ( ($viewData['cvn_checking']) and isset($ccData['cc_cvv'])) { ?> <?php if ( isset($ccData['cc_cvv'])) { ?> <div class="vmpayment_cc_info vmpayment_cc_cvv"> <span class="vmpayment_label"><label for="cc_cvv"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_CVV2') ?></label></span> <?php if (!$viewData['dccinfo']) { ?> <input type="text" class="inputbox cc_cvv" id="cc_cvv" name="cc_cvv" maxlength="4" size="5" value="<?php echo $ccData['cc_cvv']; ?>" autocomplete="off"/> <span class="hasTip" title="<?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV') ?>::<?php echo vmText::sprintf("VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV_TOOLTIP", $this->_getCVVImages($viewData['cvv_images'])) ?> "> <?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV'); ?> </span> <?php } else { echo $ccData['cc_cvv_masked']; ?> <input type="hidden" name="cc_cvv" value="<?php echo $ccData['cc_cvv'] ?>"/> <?php }?> </div> <?php } ?> <?php if (isset($ccData['cc_expire_month']) OR isset($ccData['cc_expire_year'])) { ?> <div class="vmpayment_cc_info vmpayment_cc_date"> <span class="vmpayment_label"><label for="creditcardtype"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_EXPDATE'); ?></label></span> <?php if (!$viewData['dccinfo']) { ?> <?php echo shopfunctions::listMonths('cc_expire_month', $ccData['cc_expire_month'], "class=\"inputbox vm-chzn-select\" style=\"width: 100px;\"", 'm'); echo shopfunctions::listYears('cc_expire_year', $ccData['cc_expire_year'], null, null, "class=\"inputbox vm-chzn-select\" style=\"width: 100px;\" onchange=\"var month = document.getElementById('cc_expire_month_'" . $viewData['virtuemart_paymentmethod_id'] . "); if(!CreditCardisExpiryDate(month.value,this.value, '" . $viewData['virtuemart_paymentmethod_id'] . "')){this.value='';month.value='';}\" ", "Y"); ?> <div id="cc_expiredate_errormsg"></div> <?php } else { echo $ccData['cc_expire_month'] . '/' . $ccData['cc_expire_year']; ?> <input type="hidden" name="cc_expire_month" value="<?php echo $ccData['cc_expire_month'] ?>"/> <input type="hidden" name="cc_expire_year" value="<?php echo $ccData['cc_expire_year'] ?>"/> <?php }?> </div> <?php } ?> <div class="vmpayment_cc_info vmpayment_cc_name"> <span class="vmpayment_label"><label for="cc_name"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_CCNAME'); ?></label></span> <?php if (!$viewData['dccinfo']) { ?> <input type="text" size="30" class="inputbox" id="cc_name" name="cc_name" value="<?php echo $ccData['cc_name']; ?>" autocomplete="off" onchange="ccError=razCCerror(<?php echo $viewData['virtuemart_paymentmethod_id']; ?>); CheckCreditCardNumber(this . value, <?php echo $viewData['virtuemart_paymentmethod_id']; ?>); if (!ccError) { this.value='';}"/> <div id="cc_cardname_errormsg"></div> <?php } else { echo $ccData['cc_name']; ?> <input type="hidden" name="cc_name" value="<?php echo $ccData['cc_name'] ?>"/> <?php }?> </div> <?php } ?> <?php if (isset($ccData['cc_cvv_realvault'])) { ?> <div class="vmpayment_cc_info vmpayment_cc_cvv"> <span class="vmpayment_label"><label for="cc_cvv"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_CVV2') ?></label></span> <?php if (!$viewData['dccinfo']) { ?> <input type="text" class="inputbox cc_cvv" id="cc_cvv" name="cc_cvv" maxlength="4" size="5" value="<?php echo $ccData['cc_cvv']; ?>" autocomplete="off"/> <span class="hasTip" title="<?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV') ?>::<?php echo vmText::sprintf("VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV_TOOLTIP", $this->_getCVVImages($viewData['cvv_images'])) ?> "> <?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_CC_WHATISCVV'); ?> </span> <?php } else { echo $ccData['cc_cvv_masked']; ?> <input type="hidden" name="cc_cvv_realvault" value="<?php echo $ccData['cc_cvv_realvault'] ?>"/> <?php }?> </div> <input type="hidden" name="cc_type" value="<?php echo $ccData['cc_type'] ?>"/> <?php } ?> <?php if ($viewData['dccinfo']) { ?> <div class="dccinfo"> <div class="dcc_offer_title"> <?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY'); ?> </div> <div class="dcc_offer" id="dcc_offer_section"> <div id="dcc_offer_text"> <?php echo vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_TIP', $this->getCardHolderAmount($viewData['dccinfo']->merchantamount), $viewData['dccinfo']->merchantcurrency, $this->getCardHolderAmount($viewData['dccinfo']->cardholderamount), $viewData['dccinfo']->cardholdercurrency); ?> </div> <div class="dcc_offer_exchange_rate"> <?php echo vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_EXCHANGE_RATE', 1, $viewData['dccinfo']->merchantcurrency, $viewData['dccinfo']->cardholderrate, $viewData['dccinfo']->cardholdercurrency); ?> </div> </div> <div class="dcc_choices"> <div class="dcc_choice"> <input class="dcc_offer_btn vm-button" name="dcc_choice" id="dcc_choice_1" type="radio" value="1"> <label for="dcc_choice_1"> <?php echo vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_YES', $this->getCardHolderAmount($viewData['dccinfo']->cardholderamount), $viewData['dccinfo']->cardholdercurrency); ?> </label> </div> <div class="dcc_choice"> <input class="dcc_offer_btn vm-button" name="dcc_choice" id="dcc_choice_0" type="radio" value="0" checked="checked"> <label for="dcc_choice_0"> <?php echo vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_NO', $this->getCardHolderAmount($viewData['dccinfo']->merchantamount), $viewData['dccinfo']->merchantcurrency); ?> </label> </div> </div> </div> <?php } ?> <?php if ($viewData['integration'] == 'remote') { ?> <?php if (!$viewData['dccinfo']) { ?> <?php if ($viewData['offer_save_card']) { if ($ccData['save_card']) { $checked = 'checked="checked"'; } else { $checked = ''; } ?> <div class="offer_save_card"> <div id="save_card_tip"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_SAVE_CARD_DETAILS_TIP') ?></div> <label for="save_card"> <input id="save_card" name="save_card" type="checkbox" value="1" <?php echo $checked ?>><span class="save_card"> <?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_SAVE_CARD_DETAILS') ?></span> </label> </div> <?php } } else { ?> <input type="hidden" name="save_card" value="<?php echo $ccData['save_card'] ?>"/> <?php } } ?> </div> <div class="dcc_card_payment_button details-button"> <span class="addtocart-button"> <input type="submit" class="dcc_offer_btn addtocart-button" value="<?php echo $viewData['card_payment_button'] ?>" id="checkoutRealexFormSubmitButton"/> <input type="hidden" name="option" value="com_virtuemart"/> <input type="hidden" name="view" value="pluginresponse"/> <input type="hidden" name="task" value="pluginnotification"/> <input type="hidden" name="token" value="<?php echo $viewData['token'] ?>"/> <input type="hidden" name="notificationTask" value="<?php echo $viewData['notificationTask']; ?>"/> <input type="hidden" name="order_number" value="<?php echo $viewData['order_number']; ?>"/> <input type="hidden" name="pm" value="<?php echo $viewData['virtuemart_paymentmethod_id']; ?>"/> <input type="hidden" name="virtuemart_paymentmethod_id" value="<?php echo $viewData['virtuemart_paymentmethod_id']; ?>"/> </span> </div> </form> </div> realex_hpp_api/tmpl/render_pluginname.php 0000644 00000004751 15232603237 0014721 0 ustar 00 <?php defined('_JEXEC') or die(); /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: render_pluginname.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ vmJsApi::jQuery(); vmJsApi::chosenDropDowns(); ?> <span class="vmpayment"> <?php if (!empty($viewData['logo'])) { ?> <span class="vmCartPaymentLogo"> <?php echo $viewData['logo'] ?> </span> <?php } ?> <span class="vmpayment_name"><?php echo $viewData['payment_name'] ?> </span> <?php if ($viewData['shop_mode'] == 'sandbox') { ?> <span style="color:red;font-weight:bold">Sandbox (<?php echo $viewData['virtuemart_paymentmethod_id'] ?>)</span> <?php } ?> <?php if (!empty($viewData['payment_description'])) { ?> <span class="vmpayment_description"><?php echo $viewData['payment_description'] ?> </span> <?php } ?> <?php if (isset($viewData['extraInfo']) AND isset($viewData['extraInfo']['cc_number']) AND $viewData['extraInfo']['cc_number']) { ?> <div class="vmpayment_selected_cc"> <?php if ($viewData['extraInfo']['cc_type']) { echo "(" . vmText::_('VMPAYMENT_REALEX_HPP_API_CC_' . $viewData['extraInfo']['cc_type']) . ' '; if ($viewData['where'] != 'order') { echo $viewData['extraInfo']['cc_number']; } else { echo $viewData['extraInfo']['cc_number']; } if ($viewData['extraInfo']['cc_expire_month']) { echo " " . $viewData['extraInfo']['cc_expire_month'] . '/' . $viewData['extraInfo']['cc_expire_year']; } if ($viewData['extraInfo']['cc_name']) { echo ' (' . $viewData['extraInfo']['cc_name'] . ')'; } ?> ) <?php } ?> </div> <?php } ?> <?php if (isset($viewData['remote_save_card']) AND isset($viewData['extraInfo']['remote_save_card']) AND $viewData['extraInfo']['remote_save_card']) { ?> <div class="vmpayment_description"> <?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_SAVE_CARD_DETAILS_YES'); ?> </div> <?php } ?> </span> realex_hpp_api/tmpl/response.php 0000644 00000003714 15232603237 0013057 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: response.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('_JEXEC') or die(); vmJsApi::css( 'realex','plugins/vmpayment/realex_hpp_api/realex_hpp_api/assets/css/'); ?> <div class="realex response"> <?php if ($viewData['success']) { ?> <div class="realex_auth_info"> <span class="realex_auth_value"><?php echo $viewData['auth_info']; ?></span> </div> <div class="realex_dcc_info"> <span class="realex_dcc_value"><?php echo $viewData['dcc_info']; ?></span> </div> <div class="realex_payer_info"> <span class="realex_payer_value"><?php echo $viewData['payer_info']; ?></span> </div> <div class="realex_pasref"> <span class="realex_pasref_label"><?php echo vmText::_('VMPAYMENT_REALEX_HPP_API_RESPONSE_PASREF'); ?></span> <span class="realex_pasref_value"><?php echo $viewData['pasref']; ?></span> </div> <div class="realex_vieworder"> <a class="vm-button-correct" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=orders&layout=details&order_number=' . $viewData["order_number"] . '&order_pass=' . $viewData["order_pass"], false) ?>"><?php echo vmText::_('COM_VIRTUEMART_ORDER_VIEW_ORDER'); ?></a> </div> <?php } else { ?> <div class="realex_auth_info"> <span class="realex_auth_value"><?php echo $viewData['auth_info']; ?></span> </div> <?php } ?> </div> jump.php 0000644 00000002474 15232603237 0006242 0 ustar 00 <?php /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: jump.php 10130 2019-09-11 08:36:03Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ $_GET["option"] = "com_virtuemart"; $_GET["element"] = "realex_hpp_api"; $_REQUEST["option"] = "com_virtuemart"; $_REQUEST["element"] = "realex_hpp_api"; $_GET["view"] = "pluginresponse"; $_GET["task"] = "pluginnotification"; $_GET["format"] = "raw"; $_GET["notificationTask"] = "jumpRedirect"; $_REQUEST["view"] = "pluginresponse"; $_REQUEST["task"] = "pluginnotification"; $_REQUEST["format"] = "raw"; $_REQUEST["notificationTask"] = "jumpRedirect"; $vmpayment_realex_path = dirname(__FILE__); if( file_exists($vmpayment_realex_path."/../../../index.php")) { include($vmpayment_realex_path."/../../../index.php"); } realex_hpp_api.php 0000644 00000227075 15232603237 0010255 0 ustar 00 <?php defined('_JEXEC') or die(); /** * * Realex payment plugin * * @author Valerie Isaksen * @version $Id: realex_hpp_api.php 10812 2023-04-12 09:27:41Z Milbo $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004 - 2019 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ defined('_JEXEC') or die('Restricted access'); if (!class_exists('RealexHelperRealex')) { require(VMPATH_ROOT . DS.'plugins'. DS.'vmpayment'. DS.'realex_hpp_api'. DS.'realex_hpp_api'. DS.'helpers'. DS.'helper.php'); } if (!class_exists('RealexHelperCustomerData')) { require(VMPATH_ROOT . DS.'plugins'. DS.'vmpayment'. DS.'realex_hpp_api'. DS.'realex_hpp_api'. DS.'helpers'. DS.'customerdata.php'); } class plgVmPaymentRealex_hpp_api extends vmPSPlugin { private $customerData; function __construct (& $subject, $config) { parent::__construct($subject, $config); if (!class_exists('RealexHelperCustomerData')) { require(VMPATH_ROOT . DS.'plugins'.DS.'vmpayment'.DS.'realex_hpp_api'.DS.'realex_hpp_api'.DS.'helpers'.DS.'customerdata.php'); } $this->customerData = new RealexHelperCustomerData(); $this->_loggable = TRUE; $this->tableFields = array_keys($this->getTableSQLFields()); $this->_tablepkey = 'id'; $this->_tableId = 'id'; $varsToPush = $this->getVarsToPush(); $this->addVarsToPushCore($varsToPush, 1); $this->setCryptedFields(array('shared_secret', 'rebate_password')); $this->setConfigParameterable($this->_configTableFieldName, $varsToPush); } /** * Create the table for this plugin if it does not yet exist. */ protected function getVmPluginCreateTableSQL () { return $this->createTableSQL('Payment Realex_hpp_api Table'); } /** * Fields to create the payment table * @return string SQL Fileds */ function getTableSQLFields () { $SQLfields = array( 'id' => 'int(11) UNSIGNED NOT NULL AUTO_INCREMENT', 'virtuemart_order_id' => 'int(11) UNSIGNED', 'order_number' => 'char(64)', 'virtuemart_paymentmethod_id' => 'mediumint(1) UNSIGNED', 'payment_name' => 'varchar(5000)', 'payment_order_total' => 'decimal(15,5) NOT NULL', 'payment_currency' => 'smallint(1)', 'email_currency' => 'smallint(1)', 'cost_per_transaction' => 'decimal(10,2)', 'cost_percent_total' => 'decimal(10,2)', 'tax_id' => 'smallint(1)', 'realex_hpp_api_custom' => 'varchar(255)', 'realex_hpp_api_request_type_response' => 'varchar(32)', 'realex_hpp_api_response_result' => 'varchar(3)', 'realex_hpp_api_response_pasref' => 'varchar(50)', 'realex_hpp_api_response_authcode' => 'varchar(10)', 'realex_hpp_api_fullresponse_format' => 'varchar(10)', 'realex_hpp_api_fullresponse' => 'text', ); return $SQLfields; } /** * @param $cart * @param $order * @return bool|null */ public function plgVmConfirmedOrder ($cart, $order) { if (!($this->_currentMethod = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { return FALSE; } //$this->setInConfirmOrder($cart); $email_currency = $this->getEmailCurrency($this->_currentMethod); $payment_name = $this->renderPluginName($this->_currentMethod, 'order'); $realexInterface = $this->_loadRealexInterface(); $realexInterface->loadCustomerData(); $realexInterface->debugLog('order number: ' . $order['details']['BT']->order_number, 'plgVmConfirmedOrder', 'debug'); $realexInterface->setCart($cart); /* if (!$realexInterface->validateConfirmedOrder()) { vmInfo('VMPAYMENT_REALEX_HPP_API_PLEASE_SELECT_OPTION'); return false; } */ $realexInterface->setOrder($order); $realexInterface->setPaymentCurrency(); $realexInterface->setTotalInPaymentCurrency($order['details']['BT']->order_total); // Prepare data that should be stored in the database $dbValues['order_number'] = $order['details']['BT']->order_number; $dbValues['payment_name'] = str_replace(array('\t', '\n'), '', $payment_name); $dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id; $dbValues['realex_hpp_api_custom'] = $realexInterface->getContext(); $dbValues['cost_per_transaction'] = $this->_currentMethod->cost_per_transaction; $dbValues['cost_percent_total'] = $this->_currentMethod->cost_percent_total; $dbValues['payment_currency'] = $realexInterface->getPaymentCurrency(); $dbValues['email_currency'] = $email_currency; $dbValues['payment_order_total'] = $realexInterface->getTotalInPaymentCurrency(); $dbValues['tax_id'] = $this->_currentMethod->tax_id; $this->storePSPluginInternalData($dbValues); vmLanguage::loadJLang('com_virtuemart_orders', TRUE); $selectedCCParams = array(); if ($this->_currentMethod->integration == 'redirect') { if (!$realexInterface->doRealvault($selectedCCParams)) { $html = $realexInterface->sendPostRequest(); vRequest::setVar('html', $html); $cart->_confirmDone = FALSE; $cart->_dataValidated = FALSE; $cart->setCartIntoSession(); } else { if (!JFactory::getUser()->guest AND $this->_currentMethod->realvault) { $remoteCCFormParams =$realexInterface->getRemoteCCFormParams(); $html = $this->renderByLayout('remote_cc_form', $remoteCCFormParams); vRequest::setVar('html', $html); vRequest::setVar('display_title', false); return; } $response = $realexInterface->requestReceiptIn($selectedCCParams); $request_type = $realexInterface->request_type . '_request'; $this->_storeRealexInternalData($realexInterface->xml_request, $this->_currentMethod->virtuemart_paymentmethod_id, $order['details']['BT']->virtuemart_order_id, $order['details']['BT']->order_number, $request_type); $realexInterface->manageResponseRequestReceiptIn($response); $xml_response = simplexml_load_string($response); $success = $realexInterface->isResponseSuccess($xml_response); if ($success) { $status = $this->_currentMethod->status_success; $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency); $currencyDisplay = CurrencyDisplay::getInstance($cart->pricesCurrency); $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED', $amountInCurrency['display'], $order['details']['BT']->order_number); } else { $order_history['comments'] = vmText::_('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED'); $status = $this->_currentMethod->status_canceled; } $order_history['customer_notified'] = true; $order_history['order_status'] = $status; $modelOrder = VmModel::getModel('orders'); $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order_history, TRUE); $payments = $this->getDatasByOrderId($realexInterface->order['details']['BT']->virtuemart_order_id); $params = $realexInterface->getResponseParams($payments); $params['payment_name'] = $this->renderPluginName($this->_currentMethod, 'order'); $html = $this->renderByLayout('response',$params); vRequest::setVar('html', $html); $this->customerData->clear(); if ($success) { if (isset($payments[0]->realex_hpp_api_custom)) { $cart->emptyCart(); } } } } else { $remoteCCFormParams =$realexInterface->getRemoteCCFormParams(); $html = $this->renderByLayout('remote_cc_form', $remoteCCFormParams); vRequest::setVar('html', $html); vRequest::setVar('display_title', false); } return true; } function updateOrderStatus ($order, $useTriggers = true) { $realexInterface = $this->_loadRealexInterface(); $realexInterface->setOrder($order); $realexInterface->setPaymentCurrency(); $realexInterface->setTotalInPaymentCurrency($order['details']['BT']->order_total); $cart = VirtueMartCart::getCart(); $realexInterface->setCart($cart, false); if (!($payments = $this->getDatasByOrderId($order['details']['BT']->virtuemart_order_id))) { // JError::raiseWarning(500, $db->getErrorMsg()); return null; } $payment = end($payments); $xml_response = simplexml_load_string($payment->realex_hpp_api_fullresponse); $order_history = array(); $success = $realexInterface->isResponseSuccess($xml_response); if ($success) { $status = $this->_currentMethod->status_success; $amountValue = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency); //$amountValueInPaymentCurrency = vmPSPlugin::getAmountInCurrency($realexInterface->getTotalInPaymentCurrency(), $realexInterface->getPaymentCurrency()); $currencyDisplay = CurrencyDisplay::getInstance($realexInterface->cart->pricesCurrency); $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED', $amountValue['display'], $order['details']['BT']->order_number); $order_history['success'] = true; if (isset($xml_response->dccinfo) AND isset($xml_response->dccinfo->cardholderrate)) { $order_history['comments'] .= "<br />"; if ($xml_response->dccinfo->cardholderrate != 1.0) { $order_history['comments'] .= vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_CHARGED', $this->getCardHolderAmount($xml_response->dccinfo->merchantamount), $xml_response->dccinfo->merchantcurrency, $this->getCardHolderAmount($xml_response->dccinfo->cardholderamount), $xml_response->dccinfo->cardholdercurrency); } else { $order_history['comments'] .= vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_MERCHANT_CURRENCY', $this->getCardHolderAmount($xml_response->dccinfo->merchantamount), $xml_response->dccinfo->merchantcurrency); } $order_history['comments'] .= "<br />"; } else { } } else { if ($realexInterface->isResponseDeclined($xml_response)) { $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_DECLINED', $realexInterface->order['details']['BT']->order_number); } else { $order_history['comments'] = vmText::_('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED'); } $status = $this->_currentMethod->status_canceled; $order_history['success'] = false; } $order_history['customer_notified'] = true; $order_history['order_status'] = $status; $modelOrder = VmModel::getModel('orders'); $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order_history, $useTriggers); return $success; } function redirectToCart ($msg = NULL) { if (!$msg) { $msg = vmText::_('VMPAYMENT_REALEX_HPP_API_ERROR_TRY_AGAIN'); } $this->customerData->clear(); $app = JFactory::getApplication(); $app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&Itemid=' . vRequest::getInt('Itemid'), false), $msg); } /*********************/ /* Private functions */ /*********************/ private function _loadRealexInterface () { if ($this->_currentMethod->integration == 'redirect') { if (!class_exists('RealexHelperRealexRedirect')) { require(VMPATH_ROOT . DS .'plugins'. DS .'vmpayment'. DS .'realex_hpp_api'. DS .'realex_hpp_api'. DS .'helpers'. DS .'redirect.php'); } $realexInterface = new RealexHelperRealexRedirect($this->_currentMethod, $this); } else { if ($this->_currentMethod->integration == 'remote') { if (!class_exists('RealexHelperRealexRemote')) { require(VMPATH_ROOT . DS .'plugins'. DS .'vmpayment'. DS .'realex_hpp_api'. DS .'realex_hpp_api'. DS .'helpers'. DS .'remote.php'); } $realexInterface = new RealexHelperRealexRemote($this->_currentMethod, $this); } else { Vmerror('Wrong Realex Integration method - developer error '.$this->_currentMethod->integration, 'Wrong Realex Integration method '); return NULL; } } return $realexInterface; } public function plgVmOnPaymentResponseReceived (&$html) { if (!class_exists('VirtueMartCart')) { require(VMPATH_SITE . DS . 'helpers' . DS . 'cart.php'); } if (!class_exists('shopFunctionsF')) { require(VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'); } if (!class_exists('VirtueMartModelOrders')) { require(VMPATH_ADMIN . DS . 'models' . DS . 'orders.php'); } vmLanguage::loadJLang('com_virtuemart_orders', TRUE); // the payment itself should send the parameter needed. $virtuemart_paymentmethod_id = vRequest::getInt('pm', 0); $order_number = vRequest::getString('on', 0); if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { return NULL; } if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) { return NULL; } $payments = $this->getDatasByOrderId($virtuemart_order_id); vmLanguage::loadJLang('com_virtuemart'); $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $realexInterface = $this->_loadRealexInterface(); $realexInterface->loadCustomerData(); $realexInterface->setOrder($order); $params = $realexInterface->getResponseParams($payments); $params['payment_name'] = $this->renderPluginName($this->_currentMethod, 'order'); $html = $this->renderByLayout('response',$params); $this->customerData->clear(); $cart = VirtueMartCart::getCart(); $cart->emptyCart(); return TRUE; } public function plgVmOnUserPaymentCancel() { $virtuemart_paymentmethod_id = vRequest::getInt('pm', 0); if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { return NULL; } JFactory::getApplication()->enqueueMessage(vmText::_('VMPAYMENT_REALEX_HPP_API_ERROR_TRY_AGAIN')); } /** * Display stored payment data for an order * * @see components/com_virtuemart/helpers/vmPSPlugin::plgVmOnShowOrderBEPayment() */ public function plgVmOnShowOrderBEPayment ($virtuemart_order_id, $virtuemart_paymentmethod_id) { if (!$this->selectedThisByMethodId($virtuemart_paymentmethod_id)) { return NULL; // Another method was selected, do nothing } if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) { return FALSE; } if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) { // JError::raiseWarning(500, $db->getErrorMsg()); return ''; } $html = $this->showActionOrderBEPayment($virtuemart_order_id, $virtuemart_paymentmethod_id, $payments); //$html = $this->renderByLayout('orderbepayment', array($payments, $this->_psType)); //$html = '<table class="adminlist table-striped" >' . "\n"; //$html .= $this->getHtmlHeaderBE(); $code = "realex_hpp_api_response_"; $first = TRUE; foreach ($payments as $payment) { $html .= '<tr class="row1"><td><strong>' . vmText::_('VMPAYMENT_REALEX_HPP_API_DATE') . '</strong></td><td align="left"><strong>' . $payment->created_on . '</strong></td></tr>'; // Now only the first entry has this data when creating the order if ($first) { $html .= $this->getHtmlRowBE('COM_VIRTUEMART_PAYMENT_NAME', $payment->payment_name); // keep that test to have it backwards compatible. Old version was deleting that column when receiving an IPN notification if ($payment->payment_order_total and $payment->payment_order_total != 0.00) { $html .= $this->getHtmlRowBE('COM_VIRTUEMART_TOTAL', $payment->payment_order_total * 0.01 . " " . $payment->payment_currency); } $first = FALSE; } else { $realexInterface = $this->_loadRealexInterface(); if (isset($payment->realex_hpp_api_fullresponse) and !empty($payment->realex_hpp_api_fullresponse)) { //$realex_data = json_decode($payment->realex_hpp_api_fullresponse); if ($payment->realex_hpp_api_fullresponse_format == 'json') { $realex_data = json_decode($payment->realex_hpp_api_fullresponse, true); } elseif ($payment->realex_hpp_api_fullresponse_format == 'xml') { $html .= $this->getHtmlRowBE('VMPAYMENT_REALEX_HPP_API_RESPONSE_TYPE', $payment->realex_hpp_api_request_type_response); $realex_data = simplexml_load_string($payment->realex_hpp_api_fullresponse); } $html .= $realexInterface->onShowOrderBEPayment($realex_data, $payment->realex_hpp_api_fullresponse_format, $payment->realex_hpp_api_request_type_response, $virtuemart_order_id); $html .= '<tr><td></td><td> <a href="#" class="RealexLogOpener" rel="' . $payment->id . '" > <div style="background-color: white; z-index: 100; right:0; display: none; border:solid 2px; padding:10px;" class="vm-absolute" id="RealexLog_' . $payment->id . '">'; if ($payment->realex_hpp_api_fullresponse_format != 'xml') { foreach ($realex_data as $key => $value) { if ($key=='SHA1HASH' OR $key=='SAVED_PMT_DIGITS') { $value = $realexInterface->obscureValue($value); } $html .= ' <b>' . $key . '</b>: ' . $value . '<br />'; } } else { $xml_realex_hpp_api_fullresponse = simplexml_load_string($payment->realex_hpp_api_fullresponse); $xml_realex_hpp_api_fullresponse = $realexInterface->obscureSha1hash($xml_realex_hpp_api_fullresponse); //$html .= "<pre>" . htmlentities(wordwrap($realex_hpp_api_fullresponse, 100, "\n", true)) . "</pre>"; //$html .= $xml_realex_hpp_api_fullresponse->asXML(); $html .= "<pre>" . wordwrap(print_r($xml_realex_hpp_api_fullresponse, true), 100, "\n", true) . "</pre>"; } $html .= ' </div> <span class="icon-nofloat vmicon vmicon-16-xml"></span> '; $html .= vmText::_('VMPAYMENT_REALEX_HPP_API_VIEW_TRANSACTION_LOG'); $html .= ' </a>'; $html .= ' </td></tr>'; } else { //$html .= $realexInterface->onShowOrderBEPaymentByFields($payment); } } } $html .= '</table>' . "\n"; $js = " jQuery().ready(function($) { $('.RealexLogOpener').click(function() { var logId = $(this).attr('rel'); $('#RealexLog_'+logId).toggle(); return false; }); });"; vmJsApi::addJScript("RealexLogOpener",$js); return $html; } private function showActionOrderBEPayment ($virtuemart_order_id, $virtuemart_paymentmethod_id, $payments) { $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $options = array(); if ($this->isDelayedSettlement()) { $options[] = JHTML::_('select.option', 'settlePayment', vmText::_('VMPAYMENT_REALEX_HPP_API_ORDER_BE_CAPTURE'), 'value', 'text'); } $options[] = JHTML::_('select.option', 'rebatePayment', vmText::_('VMPAYMENT_REALEX_HPP_API_ORDER_BE_REBATE'), 'value', 'text'); $actionList = JHTML::_('select.genericlist', $options, 'action', '', 'value', 'text', 'capturePayment', 'action', true); $html = '<table class="adminlist table" >' . "\n"; $html .= $this->getHtmlHeaderBE(); $html .= '<form action="index.php" method="post" name="updateOrderBEPayment" id="updateOrderBEPayment">'; $html .= '<tr ><td >'; $html .= $actionList; $html .= ' </td><td>'; $html .= '<input type="text" id="amount" name="amount" size="20" value="" class="required" maxlength="25" placeholder="' . vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ORDER_BE_AMOUNT', shopFunctions::getCurrencyByID($payments[0]->payment_currency, 'currency_code_3')) . '"/>'; $html .= '<input type="hidden" name="type" value="vmpayment"/>'; $html .= '<input type="hidden" name="name" value="realex_hpp_api"/>'; $html .= '<input type="hidden" name="view" value="plugin"/>'; $html .= '<input type="hidden" name="option" value="com_virtuemart"/>'; $html .= '<input type="hidden" name="virtuemart_order_id" value="' . $virtuemart_order_id . '"/>'; $html .= '<input type="hidden" name="virtuemart_paymentmethod_id" value="' . $virtuemart_paymentmethod_id . '"/>'; $html .= '<a class="updateOrderBEPayment btn btn-small" href="#" >' . vmText::_('COM_VIRTUEMART_SAVE') . '</a>'; $html .= '</form>'; $html .= ' </td></tr>'; vmJsApi::addJScript('vmRealex.updateOrderBEPayment'," jQuery(document).ready( function($) { jQuery('.updateOrderBEPayment').click(function() { document.updateOrderBEPayment.submit(); return false; }); }); "); //$html .= '</table>' ; return $html; } /** * Order status changed * @param $order * @param $old_order_status * @return bool|null */ public function plgVmOnUpdateOrderPayment (&$order, $old_order_status) { //Load the method if (!($this->_currentMethod = $this->getVmPluginMethod($order->virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { return NULL; } //Load the payments if (!($payments = $this->getDatasByOrderId($order->virtuemart_order_id))) { // JError::raiseWarning(500, $db->getErrorMsg()); return null; } $updateOrderPaymentStatus = array( $this->_currentMethod->status_capture, $this->_currentMethod->status_canceled, $this->_currentMethod->status_rebate, ); if (!in_array($order->order_status, $updateOrderPaymentStatus)) { //vmInfo(vmText::_('VMPAYMENT_REALEX_HPP_API_NO_ACTION')); return true; } $orderModel = VmModel::getModel('orders'); $orderData = $orderModel->getOrder($order->virtuemart_order_id); $requestSent = false; $order_history_comment = ''; $realexInterface = $this->_loadRealexInterface(); $canDo = true; if ($order->order_status == $this->_currentMethod->status_capture AND !$this->isDcc() AND $this->isDelayedSettlement() AND ($canDo = $this->canDoSettle($realexInterface, $old_order_status, $payments))) { $requestSent = true; $order_history_comment = vmText::_('VMPAYMENT_REALEX_HPP_API_UPDATE_STATUS_CAPTURE'); $realexInterface->setOrder($orderData); $realexInterface->setPaymentCurrency(); $realexInterface->setTotalInPaymentCurrency($orderData['details']['BT']->order_total); $realexInterface->loadCustomerData(); $response = $realexInterface->settleTransaction($payments); } elseif ($order->order_status == $this->_currentMethod->status_canceled AND ($canDo = $this->canDoVoid($realexInterface, $old_order_status, $payments))) { $requestSent = true; $order_history_comment = vmText::_('VMPAYMENT_REALEX_HPP_API_UPDATE_STATUS_CANCELED'); $realexInterface->setOrder($orderData); $realexInterface->setPaymentCurrency(); $realexInterface->setTotalInPaymentCurrency($orderData['details']['BT']->order_total); $realexInterface->loadCustomerData(); $response = $realexInterface->voidTransaction($payments); } elseif ($order->order_status == $this->_currentMethod->status_rebate AND ($canDo = $this->canDoRebate($realexInterface, $old_order_status, $payments))) { $requestSent = true; $response = $this->doRebate($realexInterface, $orderData, $payments); } if ($requestSent) { if ($response) { $db_values = $this->_storeRealexInternalData($response, $this->_currentMethod->virtuemart_paymentmethod_id, $orderData['details']['BT']->virtuemart_order_id, $orderData['details']['BT']->order_number, $realexInterface->request_type); $xml_response = simplexml_load_string($response); $success = $realexInterface->isResponseSuccess($xml_response); if (!$success) { $error = $xml_response->message . " (" . (string)$xml_response->result . ")"; $realexInterface->displayError($error); return false; //return NULL; } else { $order_history = array(); $order_history['comments'] = $order_history_comment; $order_history['customer_notified'] = false; $order_history['order_status'] = $order->order_status; $modelOrder = VmModel::getModel('orders'); $modelOrder->updateStatusForOneOrder($orderData['details']['BT']->virtuemart_order_id, $order_history, false); return true; } } else { vmError('VMPAYMENT_REALEX_HPP_API_NO_RESPONSE'); return false; } } else { //vmInfo(vmText::_('VMPAYMENT_REALEX_HPP_API_NO_ACTION')); } return $canDo; } function plgVmOnSelfCallBE ($type, $name, &$render) { if ($name != $this->_name || $type != 'vmpayment') { return FALSE; } $virtuemart_paymentmethod_id = vRequest::getInt('virtuemart_paymentmethod_id'); //Load the method if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } $amount = vRequest::getFloat('amount'); $actions=array('rebatePayment', 'settlePayment'); $action = vRequest::getCmd('action'); if (!in_array($action, $actions)) { vmError('VMPAYMENT_REALEX_HPP_API_UPDATEPAYMENT_UNKNOWN_ACTION'); return NULL; } $virtuemart_order_id = vRequest::getInt('virtuemart_order_id'); if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) { return null; } $orderModel = VmModel::getModel('orders'); $orderData = $orderModel->getOrder(vRequest::getInt('virtuemart_order_id')); $requestSent = false; $order_history_comment = ''; $realexInterface = $this->_loadRealexInterface(); $canDo = true; if ( $action=='settlePayment' ) { $requestSent = true; $order_history_comment = vmText::_('VMPAYMENT_REALEX_HPP_API_UPDATE_STATUS_CAPTURE'); $realexInterface->setOrder($orderData); $realexInterface->setPaymentCurrency(); $realexInterface->setTotalInPaymentCurrency($amount); $realexInterface->loadCustomerData(); $response = $realexInterface->settleTransaction($payments); } elseif ( $action=='rebatePayment') { $requestSent = true; $response = $this->doRebate($realexInterface, $orderData, $payments, $amount); } if ($requestSent) { if ($response) { $db_values = $this->_storeRealexInternalData($response, $this->_currentMethod->virtuemart_paymentmethod_id, $orderData['details']['BT']->virtuemart_order_id, $orderData['details']['BT']->order_number, $realexInterface->request_type); $xml_response = simplexml_load_string($response); $success = $realexInterface->isResponseSuccess($xml_response); if (!$success) { $error = $xml_response->message . " (" . (string)$xml_response->result . ")"; $realexInterface->displayError($error); } else { $order_history = array(); $order_history['comments'] = $order_history_comment; $order_history['customer_notified'] = false; $order_history['order_status'] = $orderData['details']['BT']->order_status; $modelOrder = VmModel::getModel('orders'); $modelOrder->updateStatusForOneOrder($orderData['details']['BT']->virtuemart_order_id, $order_history, false); } } else { vmError('VMPAYMENT_REALEX_HPP_API_NO_RESPONSE'); } } $app = JFactory::getApplication(); $link = 'index.php?option=com_virtuemart&view=orders&task=edit&virtuemart_order_id=' . $virtuemart_order_id; $app->redirect(JRoute::_($link, FALSE)); } /** * Merchants can Rebate for any amount up to 115% of the original order value. * Pop up will ask for the amount * @param $realexInterface * @param $orderData * @param $payments */ function doRebate ($realexInterface, $orderData, $payments, $amount=false) { $order_history_comment = vmText::_('VMPAYMENT_REALEX_HPP_API_UPDATE_STATUS_REBATE'); $realexInterface->setOrder($orderData); $realexInterface->setPaymentCurrency(); if ($amount===false) { $amount=$orderData['details']['BT']->order_total; } $realexInterface->setTotalInPaymentCurrency($amount); $realexInterface->loadCustomerData(); $response = $realexInterface->rebateTransaction($payments); return $response; } /** * Check if Dcc option * @return bool */ private function isDcc () { if ($this->_currentMethod->dcc) { return true; } return false; } /** check if the setelement is set to Delayed */ private function isDelayedSettlement () { if (($this->_currentMethod->settlement == 'delayed')) { return true; } return false; } /** * Check if Can do settle * @param $realexInterface * @param $old_order_status * @param $payments * @return bool */ private function canDoSettle ($realexInterface, $old_order_status, $payments) { // Delayed settlement if (!($old_order_status == $this->_currentMethod->status_success)) { vmError('VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_SETTLE'); return false; } return true; } /** * Before settlement, it is possible to void an authorisation * Void (if same day or delayed settlement) * * @param $old_order_status * @param $payments * @param $realexInterface * @return bool */ private function canDoVoid ($realexInterface, $old_order_status, $payments) { if ($this->_currentMethod->settlement == 'auto') { if (!($old_order_status == $this->_currentMethod->status_success)) { vmError('VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_VOID'); return false; } } else { if (!($old_order_status == $this->_currentMethod->status_success OR $old_order_status == $this->_currentMethod->status_capture)) { vmError('VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_VOID'); return false; } } return true; } /** * And in live mode, merchants can only rebate transactions the day after they've settled. * It maybe would be best not to allow merchants to attempt rebate on the same day a transactions is processed. * @param $old_order_status * @param $payments * @param $realexInterface * @return bool */ private function canDoRebate ($realexInterface, $old_order_status, $payments) { if ($this->transactionIsDcc($realexInterface, $payments)) { vmError(vmText::_('VMPAYMENT_REALEX_HPP_API_ERROR_REBATE_DCC_TRANSACTION')); return false; } if ($this->_currentMethod->settlement == 'auto') { if (!($old_order_status == $this->_currentMethod->status_success)) { vmError('VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_REBATE'); return false; } } else { if (!($old_order_status == $this->_currentMethod->status_capture)) { vmError('VMPAYMENT_REALEX_HPP_API_ERROR_CANNOT_REBATE'); return false; } } /* if ($this->_currentMethod->settlement=='auto') return true; if (!($settleTime = $this->transactionIsSettled($realexInterface, $payments))) { vmError(vmText::sprintf('VMPAYMENT_REALEX_HPP_API_ERROR_REBATE_SETTLE_FIRST', $payments[0]->order_number)); return false; } //And in live mode, merchants can only rebate transactions the day after they've settled. if ($this->_currentMethod->shop_mode == 'sandbox') { return true; } */ return true; } private function transactionIsSettled ($realexInterface, $payments) { $payment = $realexInterface->getTransactionData($payments, array($realexInterface::REQUEST_TYPE_SETTLE)); if (!$payment) { return false; } return $payment->created_on; } private function transactionIsDcc ($realexInterface, $payments) { if (!$this->_currentMethod->dcc) { return false; } $payment = $realexInterface->getTransactionData($payments, array($realexInterface::REQUEST_TYPE_SETTLE)); if (!$payment) { return false; } return true; } private function transactionIsAuth ($realexInterface, $payments) { $payment = $realexInterface->getLastTransactionData($payments, array( $realexInterface::REQUEST_TYPE_AUTH, $realexInterface::REQUEST_TYPE_RECEIPT_IN )); if (!$payment) { return false; } return $payment->created_on; } function plgVmOnUpdateOrderLinePayment (&$order) { if (!($this->_currentMethod = $this->getVmPluginMethod($order->virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { return NULL; } } /** * Create the table for this plugin if it does not yet exist. * This functions checks if the called plugin is active one. * When yes it is calling the standard method to create the tables * */ public function plgVmOnStoreInstallPaymentPluginTable ($jplugin_id) { if ($jplugin_id != $this->_jid) { return FALSE; } $this->_currentMethod = $this->getPluginMethod(vRequest::getInt('virtuemart_paymentmethod_id')); if ($this->_currentMethod->published) { $required_parameters = array('merchant_id', 'shared_secret', 'subaccount'); foreach ($required_parameters as $required_parameter) { if (empty ($this->_currentMethod->$required_parameter)) { $text = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PARAMETER_REQUIRED', vmText::_('VMPAYMENT_REALEX_HPP_API_' . $required_parameter), $this->_currentMethod->payment_name, $this->_currentMethod->virtuemart_paymentmethod_id); vmWarn($text); } } } $this->createPayerRefTable(); $this->createPmtRefTable(); return $this->onStoreInstallPluginTable($jplugin_id); } private function createPmtRefTable () { $db = JFactory::getDBO(); $q = 'SELECT `extension_id` FROM `#__extensions` WHERE `folder` = "vmuserfield" and `state`="0" AND `element` = "'.$this->_name.'"'; $db->setQuery($q); $extension_id = $db->loadResult(); if (empty($extension_id)) { $app = JFactory::getApplication(); $app->enqueueMessage(vmText::_('VMPAYMENT_REALEX_HPP_API_NO_PLUGIN_INSTALLED')); return; } // publish the plugin $q="UPDATE `#__extensions` SET `enabled` = '1' WHERE `extension_id` =".$extension_id; $db->setQuery($q); $db->execute(); // is this plugin already $q = 'SELECT `virtuemart_userfield_id` FROM `#__virtuemart_userfields` WHERE `userfield_jplugin_id` = ' . $extension_id; $db->setQuery($q); $virtuemart_userfield_id = $db->loadResult(); if (empty($virtuemart_userfield_id)) { //$app = JFactory::getApplication(); //$app -> enqueueMessage(vmText::_('VMUSERFIELD_REALEX_NO_PLUGIN_ALREADY_INSTALLED')); $userFieldsModel = VmModel::getModel('UserFields'); $data['virtuemart_userfield_id'] = 0; $data['published'] = 1; $data['userfield_jplugin_id'] = $extension_id; $data['required'] = 0; $data['account'] = 1; $data['shipment'] = 0; $data['registration'] = 0; $data['vNames'] = array(); $data['vValues'] = array(); $data['name'] = 'realex_hpp_api'; $data['type'] = 'pluginrealex_hpp_api'; $data['title'] = 'Payment means'; $ret = $userFieldsModel->store($data); if (!$ret) { vmError(vmText::_('VMPAYMENT_REALEX_HPP_API_CREATE_USERFIELD_FAILED') . " " . $data['name'] . " " . $ret); } else { vmInfo(vmText::_('VMPAYMENT_REALEX_HPP_API_CREATE_USERFIELD_OK') . " " . $data['name']); } } } /** * Fields to create the payment table * @return string SQL Fileds */ private function getPayerRefTableSQLFields () { // We must save both , since the customer number can be changed $SQLfields = array( 'id' => 'int(11) UNSIGNED NOT NULL AUTO_INCREMENT', 'virtuemart_user_id' => 'int(11) UNSIGNED', 'payer_ref' => 'char(32)', 'merchant_id' => 'varchar(128)', ); return $SQLfields; } /** * @param $tableComment * @return string */ private function createPayerRefTable ($tablesFields = 0) { $payerRefTableName = $this->getPayerRefTableName(); $query = "CREATE TABLE IF NOT EXISTS `" . $payerRefTableName . "` ("; $SQLfields = $this->getPayerRefTableSQLFields(); $loggablefields = $this->getTableSQLLoggablefields(); foreach ($SQLfields as $fieldname => $fieldtype) { $query .= '`' . $fieldname . '` ' . $fieldtype . " , "; } foreach ($loggablefields as $fieldname => $fieldtype) { $query .= '`' . $fieldname . '` ' . $fieldtype . ", "; } $query .= " PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Realex PayerRef Table' AUTO_INCREMENT=1 ;"; $db = JFactory::getDBO(); $db->setQuery($query); if (!$db->execute()) { JError::raiseWarning(1, $payerRefTableName . '::createPayerRefTable: ' . vmText::_('COM_VIRTUEMART_SQL_ERROR') . ' ' . $db->stderr(TRUE)); echo $payerRefTableName . '::createPayerRefTable: ' . vmText::_('COM_VIRTUEMART_SQL_ERROR') . ' ' . $db->stderr(TRUE); } } /** * This event is fired after the payment method has been selected. It can be used to store * additional payment info in the cart. * * @param VirtueMartCart $cart: the actual cart * @return null if the payment was not selected, true if the data is valid, error message if the data is not vlaid * */ public function plgVmOnSelectCheckPayment (VirtueMartCart $cart) { return $this->onSelectCheck($cart); } /** * This is for checking the input data of the payment method within the checkout * */ public function plgVmOnCheckoutCheckDataPayment (VirtueMartCart $cart) { if (!$this->selectedThisByMethodId($cart->virtuemart_paymentmethod_id)) { return NULL; // Another method was selected, do nothing } if (!($this->_currentMethod = $this->getVmPluginMethod($cart->virtuemart_paymentmethod_id))) { return NULL; } return true; } /** * plgVmDisplayListFEPayment * This event is fired to display the pluginmethods in the cart (edit shipment/payment) for exampel * * @param VirtueMartCart $cart Cart object * @param integer $selected ID of the method selected * @return boolean True on success, false on failures, null when this plugin was not selected. * On errors, JError::raiseWarning (or JError::raiseError) must be used to set a message. * */ public function plgVmDisplayListFEPayment (VirtueMartCart $cart, $selected, &$htmlIn) { if ($this->getPluginMethods($cart->vendorId) === 0) { if (empty($this->_name)) { $app = JFactory::getApplication(); $app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType))); return false; } else { return false; } } $htmla = array(); foreach ($this->methods as $this->_currentMethod) { if ($this->checkConditions($cart, $this->_currentMethod, $cart->cartPrices)) { $html = ''; $cart_prices = array(); $cart_prices['withTax'] = ''; $cart_prices['salesPrice'] = ''; $methodSalesPrice = $this->setCartPrices($cart, $cart_prices, $this->_currentMethod); //if ($selected == $method->virtuemart_paymentmethod_id) { // $this->customerData->load(); //} $html .= '<br />'; $payment_name = $this->renderPluginName($this->_currentMethod, 'DisplayListFEPayment'); //$html .= $this->getPluginHtml($this->_currentMethod, $selected, $methodSalesPrice); $realexInterface = $this->_loadRealexInterface(); if ($realexInterface == NULL) { vmdebug('renderPluginName', $this->_currentMethod); break; } $realexInterface->loadCustomerData(); if ($selected == $this->_currentMethod->virtuemart_paymentmethod_id) { $checked = 'checked="checked"'; } else { $checked = ''; } /* $ccDropdown = ""; if ($this->_currentMethod->integration == 'redirect') { if (!JFactory::getUser()->guest AND $this->_currentMethod->realvault) { $selected_cc = $this->customerData->getVar('saved_cc_selected'); $ccDropdown = $realexInterface->getCCDropDown($this->_currentMethod->virtuemart_paymentmethod_id, JFactory::getUser()->id, $selected_cc); } } */ $html .= $this->renderByLayout('redirect_form', array( //'creditcardsDropDown' => $ccDropdown, 'virtuemart_paymentmethod_id' => $this->_currentMethod->virtuemart_paymentmethod_id, 'payment_name' => $payment_name, 'checked' => $checked, )); $htmla[] = $html; } } $htmlIn[] = $htmla; return true; } /** * Check if the payment conditions are fulfilled for this payment method * @param VirtueMartCart $cart * @param int $activeMethod * @param array $cart_prices * @return bool */ protected function checkConditions ($cart, $method, $cart_prices) { return parent::checkConditions($cart, $method, $cart_prices); } /** * plgVmOnSelectedCalculatePricePayment * Calculate the price (value, tax_id) of the selected method * It is called by the calculator * This function does NOT to be reimplemented. If not reimplemented, then the default values from this function are taken. * @cart: VirtueMartCart the current cart * @cart_prices: array the new cart prices * @return null if the method was not selected, false if the shiiping rate is not valid any more, true otherwise * * */ public function plgVmOnSelectedCalculatePricePayment (VirtueMartCart $cart, array &$cart_prices, &$cart_prices_name) { return $this->onSelectedCalculatePrice($cart, $cart_prices, $cart_prices_name); } /* * @param $method plugin * @param $where from where tis function is called */ function renderPluginName ($method, $where = 'checkout') { $display_logos = ""; if (!class_exists('RealexHelperCustomerData')) { require(VMPATH_ROOT .'plugins'. DS .'vmpayment'. DS .'realex_hpp_api'. DS .'realex_hpp_api'. DS .'helpers'. DS .'customerdata.php'); } $this->_currentMethod = $method; $realexInterface = $this->_loadRealexInterface(); if ($realexInterface == NULL) { vmdebug('renderPluginName', $method); return; } $realexInterface->getCustomerData(); $extraInfo = ''; if ($realexInterface->customerData->getVar('selected_method') == $method->virtuemart_paymentmethod_id) { //$extraInfo = $realexInterface->getExtraPluginInfo(); //$extraInfo['cc_number'] =$realexInterface->cc_mask($extraInfo['cc_number']); } $logos = $method->payment_logos; if (!empty($logos)) { $display_logos = $this->displayLogos($logos) . ' '; } $payment_name = $method->payment_name; $html = $this->renderByLayout('render_pluginname', array( 'where' => $where, 'shop_mode' => $method->shop_mode, 'virtuemart_paymentmethod_id' => $method->virtuemart_paymentmethod_id, 'logo' => $display_logos, 'payment_name' => $payment_name, 'extraInfo' => $extraInfo, 'payment_description' => $method->payment_desc, )); $html = $this->rmspace($html); return $html; } private function rmspace ($buffer) { return preg_replace('~>\s*\n\s*<~', '><', $buffer); } public function plgVmgetPaymentCurrency ($virtuemart_paymentmethod_id, &$paymentCurrencyId) { if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) { return null; // Another method was selected, do nothing } if (!$this->selectedThisElement($method->payment_element)) { return false; } $this->getPaymentCurrency($method); $paymentCurrencyId = $method->payment_currency; //! $method->payment_currency might not be correct } /** * plgVmOnCheckAutomaticSelectedPayment * Checks how many plugins are available. If only one, the user will not have the choice. Enter edit_xxx page * The plugin must check first if it is the correct type * @param VirtueMartCart cart: the cart object * @return null if no plugin was found, 0 if more then one plugin was found, virtuemart_xxx_id if only one plugin is found * */ function plgVmOnCheckAutomaticSelectedPayment (VirtueMartCart $cart, array $cart_prices = array(), &$methodCounter = 0) { return $this->onCheckAutomaticSelected($cart, $cart_prices, $paymentCounter); } /** * This method is fired when showing the order details in the frontend. * It displays the method-specific data. * * @param integer $order_id The order ID * @return mixed Null for methods that aren't active, text (HTML) otherwise */ public function plgVmOnShowOrderFEPayment ($virtuemart_order_id, $virtuemart_paymentmethod_id, &$payment_name) { $this->onShowOrderFE($virtuemart_order_id, $virtuemart_paymentmethod_id, $payment_name); return true; } /** * This method is fired when showing when priting an Order * It displays the the payment method-specific data. * * @param integer $_virtuemart_order_id The order ID * @param integer $method_id method used for this order * @return mixed Null when for payment methods that were not selected, text (HTML) otherwise */ public function plgVmOnShowOrderPrintPayment ($order_number, $method_id) { return $this->onShowOrderPrint($order_number, $method_id); } public function plgVmDeclarePluginParamsPaymentVM3( &$data) { return $this->declarePluginParams('payment', $data); } public function plgVmSetOnTablePluginParamsPayment ($name, $id, &$table) { return $this->setOnTablePluginParams($name, $id, $table); } public function plgVmOnPaymentNotification () { if (!class_exists('VirtueMartModelOrders')) { require(VMPATH_ADMIN . DS . 'models' . DS . 'orders.php'); } if (!class_exists('VirtueMartCart')) { require(VMPATH_SITE . DS . 'helpers' . DS . 'cart.php'); } $notificationTask = vRequest::getCmd('notificationTask', ''); // this is not our notification if (empty($notificationTask)) { return; } if ($notificationTask == 'jumpRedirect') { $this->jumpRedirect(); } elseif ($notificationTask == 'handleRedirect') { $this->handleRedirect(); } elseif ($notificationTask == 'handleRemoteDccForm') { $this->handleRemoteDccForm(); } elseif ($notificationTask == 'handleRemoteCCForm') { $this->handleRemoteCCForm(); } elseif ($notificationTask == 'handleVerify3D') { $this->handleVerify3D(); } elseif ($notificationTask == 'handle3DSRequest') { $this->handle3DSRequest(); } return true; } private function handleRedirect () { $realex_data = vRequest::getPost(); $this->debugLog('plgVmOnPaymentNotification :' . var_export($realex_data, true), 'debug'); if (!isset($realex_data['ORDER_ID'])) { return false; } $order_number = $realex_data['ORDER_ID']; if (empty($order_number)) { return FALSE; } if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) { return FALSE; } if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) { return FALSE; } $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $this->_currentMethod = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id); if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { //echo "selectedThisElement PB"; return FALSE; } $realexInterface = $this->_loadRealexInterface(); if (!$realexInterface->validateResponseHash($realex_data)) { $this->returnToVm($realex_data, false, $order['details']['BT']->virtuemart_paymentmethod_id); return FALSE; } $result = $realex_data['RESULT']; $realexInterface->setOrder($order); //$cart = VirtueMartCart::getCart(); //$realexInterface->setCart($cart, false); $order_history = array(); $success = ($result == $realexInterface::RESPONSE_CODE_SUCCESS); if ($success) { $status = $this->_currentMethod->status_success; $amountInCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total, $order['details']['BT']->order_currency); //$currencyDisplay = CurrencyDisplay::getInstance($cart->pricesCurrency); $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED', $amountInCurrency['display'], $order_number); if (isset($realex_data['DCCCHOICE']) and $realex_data['DCCCHOICE'] == $realexInterface::RESPONSE_DCC_CHOICE_YES) { $order_history['comments'] .= "<br />"; $order_history['comments'] .= vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_CHARGED', $this->getCardHolderAmount($realex_data['DCCMERCHANTAMOUNT']), $realex_data['DCCMERCHANTCURRENCY'], $this->getCardHolderAmount($realex_data['DCCCARDHOLDERAMOUNT']), $realex_data['DCCCARDHOLDERCURRENCY']); } $userfield = $realexInterface->cardStorageResponse($realex_data); $realexInterface->storeNewPayment($userfield); if (isset($realex_data['REALWALLET_CHOSEN']) and $realex_data['REALWALLET_CHOSEN'] == 1) { if ($userfield) { $cardStorageResponseText = vmText::_('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_SUCCESS'); } else { $cardStorageResponseText = vmText::_('VMPAYMENT_REALEX_HPP_API_CARD_STORAGE_FAILED'); } $order_history['comments'] .= "<br />"; $order_history['comments'] .= $cardStorageResponseText; } } else { /** * Note: If a transaction is processed through your account that triggers one of the scenarios that you have set up to reject, * HPP will send a post back to your response script with a Result Code of 110 and a relevant error message. The transaction will not be processed. */ $order_history['comments'] = vmText::_('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED'); // here we check if wee need to add the message /* if ($realex_data['RESULT'] == (int)$realexInterface::RESPONSE_CODE_NOT_VALIDATED) { $order_history['comments'] .= "<br />"; $order_history['comments'] .= $realex_data['MESSAGE']; } */ $status = $this->_currentMethod->status_canceled; } $order_history['customer_notified'] = true; $order_history['order_status'] = $status; $db_values['payment_name'] = $this->renderPluginName($this->_currentMethod, 'order'); $db_values['virtuemart_order_id'] = $virtuemart_order_id; $db_values['order_number'] = $order_number; $db_values['virtuemart_paymentmethod_id'] = $this->_currentMethod->virtuemart_paymentmethod_id; $db_values['realex_hpp_api_response_result'] = $realex_data['RESULT']; $db_values['realex_hpp_api_request_type_response'] = $realexInterface::REQUEST_TYPE_AUTH; $db_values['realex_hpp_api_response_pasref'] = isset($realex_data['PASREF']) ? $realex_data['PASREF'] : ""; $db_values['realex_hpp_api_response_authcode'] = isset($realex_data['AUTHCODE']) ? $realex_data['AUTHCODE'] : ""; $db_values['realex_hpp_api_fullresponse'] = json_encode($realex_data); $db_values['realex_hpp_api_fullresponse_format'] = 'json'; $this->storePSPluginInternalData($db_values); $modelOrder = VmModel::getModel('orders'); $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order_history, TRUE); if ($result == $realexInterface::RESPONSE_CODE_SUCCESS) { if (isset($payments[0]->realex_hpp_api_custom)) { $this->emptyCart($payments[0]->realex_hpp_api_custom, $order_number); } } //$this->displayMessageToRealex($realexInterface, $realex_data, $success, $order_history['comments'], $payments[0]->virtuemart_paymentmethod_id); $this->returnToVm($realex_data, $success, $order['details']['BT']->virtuemart_paymentmethod_id); } private function initRealexInterface ($loadCDFromPost = true) { // TODO check if cart is empty $virtuemart_paymentmethod_id = vRequest::getInt('pm', false); $this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id); if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { vmError('Programmer error: missing the pm parameter'); $this->redirectToCart(); return FALSE; } $realexInterface = $this->_loadRealexInterface(); $realexInterface->loadCustomerData($loadCDFromPost); $order_number = vRequest::getString('order_number', false); if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) { $this->redirectToCart(); return FALSE; } $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $realexInterface->setOrder($order); $realexInterface->setPaymentCurrency(); $realexInterface->setTotalInPaymentCurrency($order['details']['BT']->order_total); return $realexInterface; } private function handleRemoteDccForm () { $realexInterface = $this->initRealexInterface(false); $cart = VirtueMartCart::getCart(); $realexInterface->setCart($cart, false); if (!($payments = $this->getDatasByOrderId($realexInterface->order['details']['BT']->virtuemart_order_id))) { $this->redirectToCart(); return FALSE; } $dcc_payment = $realexInterface->getTransactionData($payments, array( $realexInterface::REQUEST_TYPE_DCCRATE, $realexInterface::REQUEST_TYPE_REALVAULT_DCCRATE )); if (!$dcc_payment) { $this->redirectToCart(); return FALSE; } $this->handleRemoteCCForm($dcc_payment->realex_hpp_api_fullresponse); /* $realexInterface->confirmedOrderDccRequest($dcc_payment->realex_hpp_api_fullresponse); $this->updateOrderStatus($realexInterface->order); $this->customerData->clear(); $cart->emptyCart(); $submit_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm=' . $this->_currentMethod->virtuemart_paymentmethod_id . '&on=' . $realexInterface->order['details']['BT']->order_number . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''); $app = JFactory::getApplication(); $app->redirect(JRoute::_($submit_url)); */ } private function handleRemoteCCForm ($response_dcc = NULL, $loadFromPost = true) { $realexInterface = $this->initRealexInterface($loadFromPost); $realvaultData = false; if (! $this->validateCCForm($realexInterface, $realvaultData)) { return; } if ($this->_currentMethod->dcc AND empty($response_dcc)) { $response = $realexInterface->requestDccRate($realvaultData); $realexInterface->manageResponseDccRate($response); //$this->_storeRealexInternalData($response, $this->_currentMethod->virtuemart_paymentmethod_id, $realexInterface->order['details']['BT']->virtuemart_order_id, $realexInterface->order['details']['BT']->order_number, $realexInterface->request_type); $xml_response = simplexml_load_string($response); /* * 105: Card not supported by eDCC * 00: Card supported by eDCC */ $success = $realexInterface->isResponseSuccess($xml_response); if ($success) { $remoteDCCFormParams =$realexInterface->getRemoteDCCFormParams($xml_response); $html = $this->renderByLayout('remote_cc_form', $remoteDCCFormParams); echo $html; return; } else { //vmError($xml_response->message); //$this->redirectToCart(); //$response = $realexInterface->requestAuth(); //$realexInterface->manageResponseRequestAuth($response); } } if ($realvaultData) { $pmt_type = $realvaultData->realex_hpp_api_saved_pmt_type; } else { $pmt_type = NULL; } if ($this->_currentMethod->threedsecure and $realexInterface->isCC3DSVerifyEnrolled($pmt_type)) { $response3DSVerifyEnrolled = $realexInterface->request3DSVerifyEnrolled($realvaultData); $realexInterface->manageResponse3DSVerifyEnrolled($response3DSVerifyEnrolled); $eci = $realexInterface->getEciFrom3DSVerifyEnrolled($response3DSVerifyEnrolled); $xml_response3DSVerifyEnrolled = simplexml_load_string($response3DSVerifyEnrolled); $result = (string)$xml_response3DSVerifyEnrolled->result; // 503 - no entry for MERCHANT in RealMPI merchant_details table if ($eci === false and $result != 503) { //$this->_storeRealexInternalData($response, $this->_currentMethod->virtuemart_paymentmethod_id, $realexInterface->order['details']['BT']->virtuemart_order_id, $realexInterface->order['details']['BT']->order_number, $realexInterface->request_type); if ($result == $realexInterface::RESPONSE_CODE_SUCCESS) { $realexInterface->redirect3DSRequest($response3DSVerifyEnrolled); return; } else { // we should be here if Result=110 + enrolled =U // result=5xx and enrolled not available // result =220 (ENROLLED_RESULT_FATAL_ERROR) $this->redirectToCart(); return FALSE; } } else { $xml_response3DSVerifyEnrolled = simplexml_load_string($response3DSVerifyEnrolled); $xml_response3DSVerifyEnrolled->addChild('eci', $eci); $xml_response_dcc = simplexml_load_string($response_dcc); //$response = $realexInterface->requestAuth($response_dcc, $xml_response3DSVerifyEnrolled); if ($realvaultData) { $response = $realexInterface->requestReceiptIn($realvaultData, $xml_response_dcc, $xml_response3DSVerifyEnrolled); } else { $response = $realexInterface->requestAuth($xml_response_dcc, $xml_response3DSVerifyEnrolled); } $realexInterface->manageResponseRequestAuth($response); } } else { //$userfield = $realexInterface->handleCardStorage($saved_cc_selected); // TODO eci missing? $xml_response_dcc = NULL; if ($response_dcc) { $xml_response_dcc = simplexml_load_string($response_dcc); } if ($realvaultData) { $response = $realexInterface->requestReceiptIn($realvaultData, $xml_response_dcc); } else { $response = $realexInterface->requestAuth($xml_response_dcc); } $realexInterface->manageResponseRequestAuth($response); } //$payments = $this->getDatasByOrderId($realexInterface->order['details']['BT']->virtuemart_order_id); $success = $this->updateOrderStatus($realexInterface->order, false); if ($success) { $saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); $userfield = $realexInterface->handleCardStorage($saved_cc_selected); $realexInterface->storeNewPayment($userfield); $this->customerData->clear(); $cart = VirtueMartCart::getCart(); $cart->emptyCart(); $submit_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm=' . $this->_currentMethod->virtuemart_paymentmethod_id . '&on=' . $realexInterface->order['details']['BT']->order_number . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''); $app = JFactory::getApplication(); $app->redirect(JRoute::_($submit_url)); } else { $this->redirectToCart(); } } private function validateCCForm($realexInterface, &$realvaultData) { $realvaultData = false; $return=false; if (!JFactory::getUser()->guest AND $this->_currentMethod->realvault) { $saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); if ($saved_cc_selected > 0) { $realvaultData = $realexInterface->getStoredCCsData($saved_cc_selected); if (!$cvv_realvault = $realexInterface->validateCvv()) { $remoteCCFormParams =$realexInterface->getRemoteCCFormParams(NULL, true); $html = $this->renderByLayout('remote_cc_form', $remoteCCFormParams); echo $html; return false; } $realvaultData->cc_cvv_realvault = $this->customerData->getVar('cc_cvv_realvault'); $this->customerData->saveCustomerRealVaultData((array)$realvaultData); return true; } else { if ($this->_currentMethod->integration == 'redirect') { $html = $realexInterface->sendPostRequest(); echo $html; $cart = VirtueMartCart::getCart(); $cart->_confirmDone = FALSE; $cart->_dataValidated = FALSE; $cart->setCartIntoSession(); return false; } else { if (!$realexInterface->validateRemoteCCForm()) { $remoteCCFormParams =$realexInterface->getRemoteCCFormParams(); $html = $this->renderByLayout('remote_cc_form', $remoteCCFormParams); echo $html; return false; } else { return true; } } } } else { if (!$realexInterface->validateRemoteCCForm()) { $remoteCCFormParams =$realexInterface->getRemoteCCFormParams(); $html = $this->renderByLayout('remote_cc_form', $remoteCCFormParams); echo $html; return false; } else { return true; } } return $return; } /** * @return bool */ private function handleVerify3D () { $realexInterface = $this->initRealexInterface(); $realvaultData=false; if (! $this->validateCCForm($realexInterface, $realvaultData)) { return; } $cart = VirtueMartCart::getCart(); $realexInterface->setCart($cart, false); $response3DSVerifyEnrolled = $realexInterface->request3DSVerifyEnrolled($realvaultData); $eci = $realexInterface->manageResponse3DSVerifyEnrolled($response3DSVerifyEnrolled); $xml_response3DSVerifyEnrolled = simplexml_load_string($response3DSVerifyEnrolled); $result = (string)$xml_response3DSVerifyEnrolled->result; if (!$eci and $result != '503') { $realexInterface->redirect3dsRequest($response3DSVerifyEnrolled); return; } $saved_cc_selected=NULL; if ($eci !== false or $result == '503') { $realexInterface->handleCardStorage($saved_cc_selected); $xml_response3DSVerifyEnrolled = simplexml_load_string($response3DSVerifyEnrolled); $response = $realexInterface->requestAuth(NULL, $xml_response3DSVerifyEnrolled); $realexInterface->manageResponseRequestAuth($response); $xml_response = simplexml_load_string($response); $success = $realexInterface->isResponseSuccess($xml_response); } else { $success = false; } $order_history = array(); if ($success) { $status = $this->_currentMethod->status_success; $amountValue = vmPSPlugin::getAmountInCurrency($realexInterface->order['details']['BT']->order_total, $realexInterface->order['details']['BT']->order_currency); $currencyDisplay = CurrencyDisplay::getInstance($realexInterface->cart->pricesCurrency); $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED', $amountValue['display'], $realexInterface->order['details']['BT']->order_number); } else { $order_history['comments'] = vmText::_('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED'); $status = $this->_currentMethod->status_canceled; } $order_history['customer_notified'] = true; $order_history['order_status'] = $status; $modelOrder = VmModel::getModel('orders'); $modelOrder->updateStatusForOneOrder($realexInterface->order['details']['BT']->virtuemart_order_id, $order_history, TRUE); //$payments = $this->getDatasByOrderId($realexInterface->order['details']['BT']->virtuemart_order_id); //$html = $realexInterface->getResponseHTML($payments); $this->customerData->clear(); $cart->emptyCart(); $submit_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm=' . $this->_currentMethod->virtuemart_paymentmethod_id . '&on=' . $realexInterface->order['details']['BT']->order_number . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''); $app = JFactory::getApplication(); $app->redirect(JRoute::_($submit_url)); return true; } private function handle3DSRequest () { $realexInterface = $this->initRealexInterface(false); $cart = VirtueMartCart::getCart(); $realexInterface->setCart($cart, false); $saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); $realvault = false; if ($saved_cc_selected > 0) { $realvault = $realexInterface->getStoredCCsData($saved_cc_selected); $realvault->cc_cvv_realvault = $this->customerData->getVar('cc_cvv_realvault'); $this->customerData->saveCustomerRealVaultData((array)$realvault); } if (!($payments = $this->getDatasByOrderId($realexInterface->order['details']['BT']->virtuemart_order_id))) { $this->redirectToCart(); return FALSE; } $dcc_payment = $realexInterface->getTransactionData($payments, array( $realexInterface::REQUEST_TYPE_DCCRATE, $realexInterface::REQUEST_TYPE_REALVAULT_DCCRATE )); if ($dcc_payment) { $xml_dcc_payment = simplexml_load_string($dcc_payment->realex_hpp_api_fullresponse); } else { $xml_dcc_payment = NULL; } $response3DSVerifysig = $realexInterface->request3DSVerifysig($realvault); $realexInterface->manageResponse3DSVerifysig($response3DSVerifysig); $eci = $realexInterface->getEciFrom3DSVerifysig($response3DSVerifysig, $this->_currentMethod->require_liability); $xml_response3DSVerifysig = simplexml_load_string($response3DSVerifysig); if ($eci !== false) { $xml_response3DSVerifysig->threedsecure->eci = $eci; if ($realvault) { $response = $realexInterface->requestReceiptIn($realvault, $xml_dcc_payment, $xml_response3DSVerifysig); } else { $response = $realexInterface->requestAuth($xml_dcc_payment, $xml_response3DSVerifysig); } $realexInterface->manageResponseRequestAuth($response); $xml_response = simplexml_load_string($response); $success = $realexInterface->isResponseSuccess($xml_response); } else { $success = false; } $order_history = array(); $redirectToCart = false; if ($success) { $userfield = $realexInterface->handleCardStorage($saved_cc_selected); $realexInterface->storeNewPayment($userfield); $status = $this->_currentMethod->status_success; $amountValue = vmPSPlugin::getAmountInCurrency($realexInterface->order['details']['BT']->order_total, $realexInterface->order['details']['BT']->order_currency); $currencyDisplay = CurrencyDisplay::getInstance($realexInterface->cart->pricesCurrency); $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CONFIRMED', $amountValue['display'], $realexInterface->order['details']['BT']->order_number); if (isset($xml_response->dccinfo) AND isset($xml_response->dccinfo->cardholderrate)) { $order_history['comments'] .= "<br />"; if ($xml_response->dccinfo->cardholderrate != 1.0) { $order_history['comments'] .= vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_OWN_CURRENCY_CHARGED', $this->getCardHolderAmount($xml_response->dccinfo->merchantamount), $xml_response->dccinfo->merchantcurrency, $this->getCardHolderAmount($xml_response->dccinfo->cardholderamount), $xml_response->dccinfo->cardholdercurrency); } else { $order_history['comments'] .= vmText::sprintf('VMPAYMENT_REALEX_HPP_API_DCC_PAY_MERCHANT_CURRENCY', $this->getCardHolderAmount($xml_response->dccinfo->merchantamount), $xml_response->dccinfo->merchantcurrency); } $order_history['comments'] .= "<br />"; } else { } } else { $msgToShopper=''; $status = $this->_currentMethod->status_canceled; if ($realexInterface->isResponseDeclined($xml_response3DSVerifysig)) { $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_DECLINED', $realexInterface->order['details']['BT']->order_number); $msgToShopper=$xml_response3DSVerifysig->message; } elseif ($realexInterface->isResponseWrongPhrase($xml_response3DSVerifysig)) { $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED', $realexInterface->order['details']['BT']->order_number); $msgToShopper=$xml_response3DSVerifysig->message; } elseif ($realexInterface->isResponseAlreadyProcessed($xml_response3DSVerifysig)) { $order_history['comments'] = $xml_response3DSVerifysig->message; $msgToShopper=$xml_response3DSVerifysig->message; // log this response, but do not change the order status $status = $realexInterface->order['details']['BT']->order_status; /* } elseif ($xml_response and $realexInterface->isResponseInvalidPaymentDetails($xml_response)) { $order_history['comments'] =$xml_response->message; if ($realvault) { $accountURL=JRoute::_('index.php?option=com_virtuemart&view=user&layout=edit'); $msgToShopper=vmText::sprintf('VMPAYMENT_REALEX_HPP_API_INVALID_PAYMENT_DETAILS_REALVAULT',$xml_response->message, $accountURL); } else { $msgToShopper=vmText::sprintf('VMPAYMENT_REALEX_HPP_API_INVALID_PAYMENT_DETAILS',$xml_response->message); } */ } else { $order_history['comments'] = vmText::sprintf('VMPAYMENT_REALEX_HPP_API_PAYMENT_STATUS_CANCELLED', $realexInterface->order['details']['BT']->order_number); } $redirectToCart = true; } $order_history['customer_notified'] = true; $order_history['order_status'] = $status; // $this->updateOrderStatus($realexInterface->order, $redirectToCart); $modelOrder = VmModel::getModel('orders'); $modelOrder->updateStatusForOneOrder($realexInterface->order['details']['BT']->virtuemart_order_id, $order_history, false); /* $payments = $this->getDatasByOrderId($realexInterface->order['details']['BT']->virtuemart_order_id); $html = $realexInterface->getResponseHTML($payments); $this->customerData->clear(); $cart = VirtueMartCart::getCart(); $cart->emptyCart(); vRequest::setVar('display_title', false); vRequest::setVar('html', $html); echo $html; */ //$html = $realexInterface->getResponseHTML($payments); if ($redirectToCart) { $this->redirectToCart($msgToShopper); } else { $this->customerData->clear(); $cart = VirtueMartCart::getCart(); $cart->emptyCart(); $submit_url = JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm=' . $this->_currentMethod->virtuemart_paymentmethod_id . '&on=' . $realexInterface->order['details']['BT']->order_number . '&Itemid=' . vRequest::getInt('Itemid') . '&lang=' . vRequest::getCmd('lang', ''); $app = JFactory::getApplication(); $app->redirect(JRoute::_($submit_url)); } return true; } /** * This message allows to redirect from Realex payment form to VM * @param $realex_data * @param $success * @param $virtuemart_paymentmethod_id */ private function returnToVm ($realex_data, $success, $virtuemart_paymentmethod_id) { $html=''; // add spin image $html .= '<form action="' . JURI::root(false) . '" method="post" id="vmPaymentForm" name="vm_realex_form" accept-charset="UTF-8">'; $html .= '<input type="hidden" name="charset" value="utf-8">'; $html .= '<input type="hidden" name="option" value="com_virtuemart" />'; $html .= '<input type="hidden" name="view" value="pluginresponse" />'; if ($success) { $html .= '<input type="hidden" name="task" value="pluginresponsereceived" />'; } else { $html .= '<input type="hidden" name="task" value="pluginUserPaymentCancel" />'; } $html .= '<input type="hidden" name="on" value="' . $realex_data['ORDER_ID'] . '" />'; $html .= '<input type="hidden" name="pm" value="' . $virtuemart_paymentmethod_id . '" />'; $html .= '<input type="hidden" name="Itemid" value="' . vRequest::getInt('Itemid') . '" />'; $html .= '<input type="hidden" name="lang" value="' . vRequest::getCmd('lang', '') . '" />'; $html .= '<input type="submit" value="' . vmText::_('VMPAYMENT_REALEX_HPP_API_REDIRECT_MESSAGE') . '" /> <script type="text/javascript">'; $html .= ' document.vm_realex_form.submit();'; $html .= ' </script>'; $html .= '</form>'; echo $html; } function getCardHolderAmount ($dcccardholderamount) { return sprintf("%01.2f", $dcccardholderamount * 0.01); } /*******************/ /* Credit Card API */ /*******************/ public function _getCVVImages ($cvv_images) { $img = ''; if ($cvv_images) { $img = $this->displayLogos($cvv_images); $img = str_replace('"', "'", $img); } return $img; } public function plgVmOnRealexDeletedStoredCard ($element, $storedCC, &$success) { if (!$this->selectedThisElement($element)) { return FALSE; } $vendorId = 1; if ($this->getPluginMethods($vendorId) === 0) { return false; } foreach ($this->methods as $method) { if ($method->merchant_id == $storedCC['merchant_id']) { // the crypted fields are decrypted with that function if (!($this->_currentMethod = $this->getVmPluginMethod($method->virtuemart_paymentmethod_id))) { return FALSE; // this should not happen } break; } } $realexInterface = $this->_loadRealexInterface(); if (!$realexInterface) { return false; } $success = $realexInterface->deleteStoredCard($storedCC); return $success; } public function plgVmOnRealexUpdateStoredCard ($element, $storedCC, &$success) { if (!$this->selectedThisElement($element)) { return FALSE; } $vendorId = 1; if ($this->getPluginMethods($vendorId) === 0) { return false; } foreach ($this->methods as $method) { if ($method->merchant_id == $storedCC['merchant_id']) { // the crypted fields are decrypted with that function if (!($this->_currentMethod = $this->getVmPluginMethod($method->virtuemart_paymentmethod_id))) { return FALSE; // this should not happen } break; } } if (empty($this->_currentMethod)) { Vmerror('No payment has been found with ' . $storedCC['merchant_id']); return FALSE; } //vmdebug('plgVmOnRealexUpdateStoredCard',$this->_currentMethod ); $realexInterface = $this->_loadRealexInterface(); if (!$realexInterface) { return false; } $success = $realexInterface->updateStoredCard($storedCC); return $success; } /** * @return string */ function getPayerRefTableName () { return $this->_tablename . '_payerref'; } /** * @param $response * @param $virtuemart_paymentmethod_id * @param $virtuemart_order_id * @param $order_number * @param $request_type * @return mixed */ function _storeRealexInternalData ($response, $virtuemart_paymentmethod_id, $virtuemart_order_id, $order_number, $request_type) { $xml_response = simplexml_load_string($response); //$db_values['payment_name'] = $this->renderPluginName($this->_currentMethod, 'order'); $db_values['virtuemart_order_id'] = $virtuemart_order_id; $db_values['order_number'] = $order_number; $db_values['virtuemart_paymentmethod_id'] = $virtuemart_paymentmethod_id; $db_values['realex_hpp_api_response_result'] = (string)$xml_response->result; if (isset($xml_response->pasref)) { $db_values['realex_hpp_api_response_pasref'] = (string)$xml_response->pasref; } if (isset($xml_response->authcode)) { $db_values['realex_hpp_api_response_authcode'] = (string)$xml_response->authcode; } $db_values['realex_hpp_api_request_type_response'] = $request_type; $db_values['realex_hpp_api_fullresponse_format'] = 'xml'; $db_values['realex_hpp_api_fullresponse'] = $response; $this->storePSPluginInternalData($db_values); return $db_values; } private function jumpRedirect () { // url sent in get $url = vRequest::getVar('gateway_url'); unset($_POST['gateway_url']); ?> <html> <head> <title>Transferring...</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> <form name="form1" action="<?php echo $url; ?>" method="POST"> <?php // get the posted vars $field_array = array_keys($_POST); //loop posted fields for ($i = 0; $i < count($field_array); $i++) { $actual_var = $field_array[$i]; $actual_val = stripslashes(vRequest::getVar($actual_var)); //hidden form field echo("<input type=\"hidden\" name=\""); echo($actual_var . "\" value=\""); echo(trim($actual_val) . "\" />\n"); } ?> </form> <script language="javascript"> var f = document.forms; f = f[0]; f.submit(); </script> </body> </html> <?php } /** * createToken to avoid double form submit * @return string */ function createToken () { static $chars = '0123456789abcdef'; $max = strlen($chars) - 1; $token = ''; $name = session_name(); $length = 32; for ($i = 0; $i < $length; ++$i) { $token .= $chars[(mt_rand(0, $max))]; } return md5($token . $name); } function saveTokenInSession ($token) { $session = JFactory::getSession(); $session->set('RealexToken', $token, 'vm'); } function checkToken ($token) { $session = JFactory::getSession(); $sessionToken = $session->get('RealexToken', 0, 'vm'); if ($token == $sessionToken) { return true; } return false; } function clearToken() { $session = JFactory::getSession(); $session->clear('RealexToken', 'vm'); } } // class // No closing tag realex_hpp_api.xml 0000644 00000036024 15232603237 0010256 0 ustar 00 <?xml version="1.0" encoding="UTF-8" ?> <extension version="2.5" type="plugin" group="vmpayment" method="upgrade"> <description>Global Payments HPP and API</description> <name>realex_hpp_api</name> <creationDate>April 26 2022</creationDate> <author>The VirtueMart Development Team</author> <authorUrl>https://virtuemart.net</authorUrl> <copyright>Copyright (C) 2004 - 2019 Virtuemart Team. All rights reserved.</copyright> <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license> <version>4.0.0</version> <description><![CDATA[<a href="http://realex.com" target="_blank">realex</a> is a popular payment provider and available in many countries. ]]> </description> <files> <filename plugin="realex_hpp_api">realex_hpp_api.php</filename> <folder>language</folder> </files> <vmconfig> <fields name="params"> <fieldset name="Realex" addfieldpath="/plugins/vmpayment/realex_hpp_api/realex_hpp_api/fields"> <field name="checkConditionsCore" value="1" default="1" type="hidden"/> <field type="getrealex" /> <field class="level1" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_ACCOUNT_PARAMS"/> <field name="integration" type="list" default="redirect" label="VMPAYMENT_REALEX_HPP_API_INTEGRATION" description="VMPAYMENT_REALEX_HPP_API_INTEGRATION_TIP"> <option value="redirect">VMPAYMENT_REALEX_HPP_API_INTEGRATION_REDIRECT</option> <option value="remote">VMPAYMENT_REALEX_HPP_API_INTEGRATION_REMOTE</option> </field> <field class="sandbox" name="shop_mode" type="radio" default="sandbox" label="VMPAYMENT_REALEX_HPP_API_SHOP_MODE" description="VMPAYMENT_REALEX_HPP_API_SHOP_MODE_TIP"> <option value="live">VMPAYMENT_REALEX_HPP_API_LIVE</option> <option value="sandbox">VMPAYMENT_REALEX_HPP_API_SANDBOX</option> </field> <!-- REDIRECT PARAMETERS --> <field class="required" name="merchant_id" type="text" size="40" default="" label="VMPAYMENT_REALEX_HPP_API_MERCHANT_ID" description="VMPAYMENT_REALEX_HPP_API_MERCHANT_ID_TIP"/> <field class="required" name="shared_secret" type="password" size="40" default="" label="VMPAYMENT_REALEX_HPP_API_SHARED_SECRET" description="VMPAYMENT_REALEX_HPP_API_SHARED_SECRET_TIP"/> <field class="required redirect remote" name="subaccount" type="text" size="40" default="" label="VMPAYMENT_REALEX_HPP_API_SUBACCOUNT"/> <field class="level1" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS"/> <field name="creditcards" type="creditcards" multiple="multiple" default="" label="VMPAYMENT_REALEX_HPP_API_CREDITCARDS" description="VMPAYMENT_REALEX_HPP_API_CREDITCARDS_TIP"/> <field class="nodcc" name="settlement" type="list" default="1" label="VMPAYMENT_REALEX_HPP_API_SETTLEMENT" description="VMPAYMENT_REALEX_HPP_API_SETTLEMENT_TIP"> <option value="auto">VMPAYMENT_REALEX_HPP_API_SETTLEMENT_AUTO</option> <option value="delayed">VMPAYMENT_REALEX_HPP_API_SETTLEMENT_DELAYED</option> </field> <field class="dcc" name="settlement_warning" type="list" default="auto" label="VMPAYMENT_REALEX_HPP_API_SETTLEMENT" description="VMPAYMENT_REALEX_HPP_API_SETTLEMENT_TIP"> <option value="auto">VMPAYMENT_REALEX_HPP_API_SETTLEMENT_AUTO</option> </field> <field class="dcc" type="vmtitle" default="" description="VMPAYMENT_REALEX_HPP_API_SETTLEMENT_WARNING"/> <field class="level2" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_REALVAULT"/> <field class="redirect remote" name="realvault" type="list" default="0" label="VMPAYMENT_REALEX_HPP_API_REALVAULT" description="VMPAYMENT_REALEX_HPP_API_REALVAULT_TIP"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> <field class="realvault-param" name="offer_save_card" type="list" default="0" label="VMPAYMENT_REALEX_HPP_API_OFFER_SAVE_CARD" description="VMPAYMENT_REALEX_HPP_API_OFFER_SAVE_CARD_TIP"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> <field class="realvault-param" name="cvn_checking" type="list" default="0" label="VMPAYMENT_REALEX_HPP_API_CVN_CHECKING" description="VMPAYMENT_REALEX_HPP_API_CVN_CHECKING_TIP"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> <field class="level2" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_3DSECURE"/> <field class="redirect-norealvault" type="vmtitle" description="VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_3DSECURE_REALEX"/> <field class="redirect-realvault" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_3DSECURE_REALVAULT"/> <field class="redirect-realvault realvault" name="threedsecure" type="list" default="1" label="VMPAYMENT_REALEX_HPP_API_3DSECURE" description="VMPAYMENT_REALEX_HPP_API_3DSECURE_TIP"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> <field class="redirect-realvault threedsecure" name="require_liability" type="list" default="0" label="VMPAYMENT_REALEX_HPP_API_REQUIRE_LIABILITY" description="VMPAYMENT_REALEX_HPP_API_REQUIRE_LIABILITY_TIP"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> <field class="level2" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_FRAUD_SECTION"/> <field name="tss" type="list" default="0" label="VMPAYMENT_REALEX_HPP_API_TSS" description="VMPAYMENT_REALEX_HPP_API_TSS_TIP"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> <field class="level2" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_ACCOUNT_OPTIONS_DCC"/> <field name="dcc" type="list" default="0" label="VMPAYMENT_REALEX_HPP_API_DCC" description="VMPAYMENT_REALEX_HPP_API_DCC_TIP"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> <field class="remote dcc" name="dcc_service" type="list" default="1" label="VMPAYMENT_REALEX_HPP_API_DCC_SERVICE" description="VMPAYMENT_REALEX_HPP_API_DCC__CHOICE_TIP"> <option value="fexco">VMPAYMENT_REALEX_HPP_API_DCC_FEXCO</option> <option value="euroconex">VMPAYMENT_REALEX_HPP_API_DCC_EUROCONEX</option> </field> <field class="level1 redirect" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_URLS_SECTION"/> <field class="redirect" name="referring_url" type="referringurl" size="100" default="" editable="true" label="VMPAYMENT_REALEX_HPP_API_REFERRING_URL" description="VMPAYMENT_REALEX_HPP_API_REFERRING_URL_TIP"/> <field class="redirect" name="gateway_url" type="text" size="100" default="https://hpp.realexpayments.com/pay" editable="true" label="VMPAYMENT_REALEX_HPP_API_GATEWAY_URL" description="VMPAYMENT_REALEX_HPP_API_GATEWAY_URL_TIP"/> <field class="redirect" name="sandbox_gateway_url" type="text" size="100" default="https://hpp.sandbox.realexpayments.com/pay" editable="true" label="VMPAYMENT_REALEX_HPP_API_SANDBOX_GATEWAY_URL" description="VMPAYMENT_REALEX_HPP_API_SANDBOX_GATEWAY_URL_TIP"/> <field class="level1" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_ORDER_STATUS_SECTION" description=""/> <field name="status_success" type="vmorderstate" scope="com_virtuemart" default="C" label="VMPAYMENT_REALEX_HPP_API_STATUS_SUCCESS" description="VMPAYMENT_REALEX_HPP_API_STATUS_SUCCESS_TIP"/> <field name="status_canceled" type="vmorderstate" scope="com_virtuemart" default="X" label="VMPAYMENT_REALEX_HPP_API_STATUS_CANCEL" description="VMPAYMENT_REALEX_HPP_API_STATUS_CANCEL_TIP"/> <field class="settlement" name="status_capture" type="vmorderstate" scope="com_virtuemart" default="S" label="VMPAYMENT_REALEX_HPP_API_STATUS_CAPTURE" description="VMPAYMENT_REALEX_HPP_API_STATUS_CAPTURE_TIP"/> <field name="status_rebate" type="vmorderstate" scope="com_virtuemart" default="R" label="VMPAYMENT_REALEX_HPP_API_STATUS_REBATE" description="VMPAYMENT_REALEX_HPP_API_STATUS_REBATE_TIP"/> <field class="required dcc_choice" name="rebate_password" type="password" size="40" default="" label="VMPAYMENT_REALEX_HPP_API_REBATE_PASSWORD" description="VMPAYMENT_REALEX_HPP_API_REBATE_PASSWORD_TIP"/> <field name="status_partial_refunded" type="vmorderstate" scope="com_virtuemart" default="R" label="VMPAYMENT_REALEX_HPP_API_STATUS_PARTIAL_REFUND" description="VMPAYMENT_REALEX_HPP_API_STATUS_PARTIAL_REFUND_TIP"/> <field class="level1" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_OPTIONAL_PARAMS"/> <!-- Restrictions --> <!-- ============ --> <field class="level2" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_RESTRICTIONS_SECTION" description=""/> <field name="countries" type="vmcountries" scope="com_virtuemart" default="" label="VMPAYMENT_REALEX_HPP_API_COUNTRIES" description="VMPAYMENT_REALEX_HPP_API_COUNTRIES_DESC"/> <field name="min_amount" type="text" label="VMPAYMENT_REALEX_HPP_API_MIN_AMOUNT" description="VMPAYMENT_REALEX_HPP_API_MIN_AMOUNT_TIP"/> <field name="max_amount" type="text" label="VMPAYMENT_REALEX_HPP_API_MAX_AMOUNT" description="VMPAYMENT_REALEX_HPP_API_MAX_AMOUNT_TIP"/> <!-- Currencies --> <!-- ============ --> <field class="level2" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_CURRENCIES_SECTION" description=""/> <field name="payment_currency" type="vmacceptedcurrency" default="" label="VMPAYMENT_REALEX_HPP_API_CURRENCY" description="VMPAYMENT_REALEX_HPP_API_CURRENCY_DESC"/> <field name="email_currency" type="list" default="vendor" label="VMPAYMENT_REALEX_HPP_API_EMAIL_CURRENCY" description="VMPAYMENT_REALEX_HPP_API_EMAIL_CURRENCY_DESC"> <option value="vendor">VMPAYMENT_REALEX_HPP_API_EMAIL_CURRENCY_VENDOR</option> <option value="payment">VMPAYMENT_REALEX_HPP_API_EMAIL_CURRENCY_PAYMENT</option> </field> <!-- Discounts --> <!-- ============ --> <field class="level2" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_DISCOUNT_FEE_SECTION" description=""/> <field name="cost_per_transaction" type="text" label="VMPAYMENT_REALEX_HPP_API_COST_PER_TRANSACTION" description="VMPAYMENT_REALEX_HPP_API_COST_PER_TRANSACTION_TIP"/> <field name="cost_percent_total" type="text" label="VMPAYMENT_REALEX_HPP_API_COST_PERCENT_TOTAL" description="VMPAYMENT_REALEX_HPP_API_COST_PERCENT_TOTAL_TIP"/> <field name="tax_id" type="vmtaxes" scope="com_virtuemart" label="VMPAYMENT_REALEX_HPP_API_TAX" description="VMPAYMENT_REALEX_HPP_API_TAX_TIP"/> <field class="level1" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_TEMPLATE_SECTION" description=""/> <field name="payment_logos" type="vmfiles" multiple="true" label="VMPAYMENT_REALEX_HPP_API_LOGOS" description="VMPAYMENT_REALEX_HPP_API_LOGOS_DESC" directory="/images/virtuemart/payment" default="default" hide_default="1" hide_none="1" stripext="0" exclude="^_"/> <field name="card_payment_button" type="text" size="40" maxlength="25" default="" label="VMPAYMENT_REALEX_HPP_API_CARD_PAYMENT_BUTTON" description="VMPAYMENT_REALEX_HPP_API_CARD_PAYMENT_BUTTON_TIP"/> <field class="remote" name="cvv_images" type="vmfiles" label="VMPAYMENT_REALEX_HPP_API_CVV_IMAGES" description="VMPAYMENT_REALEX_HPP_API_CVV_IMAGES_DESC" directory="/images/virtuemart/payment" default="default" hide_default="1" hide_none="1" stripext="0" exclude="^_"/> <field class="level1" type="vmtitle" default="VMPAYMENT_REALEX_HPP_API_DEBUG_SECTION" description=""/> <field name="debug" type="radio" default="0" label="VMPAYMENT_REALEX_HPP_API_DEBUG_SECTION"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> <field name="log" type="radio" default="0" label="VMPAYMENT_REALEX_HPP_API_LOG" description="VMPAYMENT_REALEX_HPP_API_LOG_DESC"> <option value="0">COM_VIRTUEMART_NO</option> <option value="1">COM_VIRTUEMART_YES</option> </field> </fieldset> </fields> </vmconfig> <updateservers> <!-- Note: No spaces or linebreaks allowed between the server tags --> <server type="extension" name="VirtueMart plg_vmpayment_realex_hpp_api Update Site"><![CDATA[http://virtuemart.net/releases/vm3/plg_vmpayment_realex_hpp_api_update.xml]]></server> </updateservers> </extension>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0.03 |
proxy
|
phpinfo
|
Настройка