Skip to content

Instantly share code, notes, and snippets.

@moh-alsheikh
Created March 27, 2016 11:39
Show Gist options
  • Select an option

  • Save moh-alsheikh/18221022f531d338ad9f to your computer and use it in GitHub Desktop.

Select an option

Save moh-alsheikh/18221022f531d338ad9f to your computer and use it in GitHub Desktop.
def generate_payfort_signature(p_amount, p_customer_email, p_merchant_reference)
#current_return_url = Rails.env.development? ? CONFIG[:PAYFORT_TEST_RETURN_URL] : CONFIG[:PAYFORT_PRODUCTION_RETURN_URL]
sig_params = "#{CONFIG[:PAYFORT_SHA_REQUEST_PHARSE]}access_code=#{CONFIG[:PAYFORT_ACCESS_CODE]}amount=#{p_amount}command=#{CONFIG[:PAYFORT_PURCHASE_COMMAND]}currency=#{CONFIG[:PAYFORT_CURRENCY]}customer_email=#{p_customer_email}language=#{CONFIG[:PAYFORT_LANGUAGE]}merchant_identifier=#{CONFIG[:PAYFORT_MERCHANT_IDENTIFIER]}merchant_reference=#{p_merchant_reference}return_url=#{current_return_url_h}#{CONFIG[:PAYFORT_SHA_REQUEST_PHARSE]}"
return Digest::SHA256.hexdigest(sig_params)
end
@moh-alsheikh
Copy link
Author

"RESALSRPaccess_code=TxcjEDBOevfnpQBEtNRRamount=#{p_amount}command=PURCHASEcurrency=SARcustomer_email=#{p_customer_email}language=armerchant_identifier=RbETmkOomerchant_reference=#{p_merchant_reference}RESALSRP"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment