Last active
April 17, 2022 19:32
-
-
Save birante/0d85e159ab94627efac91c0414dea5db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Controller | |
def orange_money | |
@reservation_id = session[:reservation_id] | |
@transaction_id = session[:transaction_id] | |
@total_amount = session[:total_amount].to_f | |
@om_secret_key = ["xxxxxxxxxxxxxxxx"].pack("H*") | |
@s2m_identifiant = Digest::MD5.hexdigest("xxxxxxxxxxxxx") | |
@s2m_site = Digest::MD5.hexdigest("xxxxxxxxxxx") | |
@s2m_htype = "SHA512".downcase | |
@s2m_commande = "Commission Tukkijamm #{@total_amount}" | |
@s2m_ref_commande = @reservation_id | |
@s2m_dateh = Time.now.utc.to_date | |
@all_om_fields = "S2M_COMMANDE=#{@s2m_commande}&S2M_DATEH=#{@s2m_dateh}&S2M_HTYPE=#{@s2m_htype}&S2M_IDENTIFIANT=#{@s2m_identifiant}&S2M_REF_COMMANDE=#{@s2m_ref_commande}&S2M_SITE=#{@s2m_site}&S2M_TOTAL=#{@total_amount}" | |
@s2m_hmac = (OpenSSL::HMAC.hexdigest(@s2m_htype, @om_secret_key, @all_om_fields)).upcase | |
end | |
# HTML VIEWS with https://getbootstrap.com/ | |
<div class="container pb-5"> | |
<div class="row mt-2"> | |
<div class="col-md-12 text-center"> | |
<h3 class="h3">Payer avec Orange Money</h3> | |
<h4 class="h3 fw-bold"><%= @total_amount %> FCFA </h3> | |
<div class="card-body booking-card-body border-0"> | |
<div class="row mt-3"> | |
<div class="col-md-12 text-center"> | |
<form method="POST" action="https://api.paiementorangemoney.com"> | |
<input type="hidden" name="S2M_IDENTIFIANT" value="<%= @s2m_identifiant %>" /> | |
<input type="hidden" name="S2M_SITE" value="<%= @s2m_site %>" /> | |
<input type="hidden" name="S2M_TOTAL" value="<%= @total_amount %>" /> | |
<input type="hidden" name="S2M_REF_COMMANDE" value="<%= @s2m_ref_commande %>" /> | |
<input type="hidden" name="S2M_COMMANDE" value="<%= @s2m_commande %>" /> | |
<input type="hidden" name="S2M_DATEH" value="<%= @s2m_dateh %>" /> | |
<input type="hidden" name="S2M_HTYPE" value="<%= @s2m_htype %>" /> | |
<input type="hidden" name="S2M_HMAC" value="<%= @s2m_hmac %>" /> | |
<button type="submit" class="btn btn-lg border-rounded"> | |
Cliquez ici pour payez | |
<img src="https://mycocody.com/wp-content/uploads/2021/05/om.png" width="100px" alt="Payer" /> | |
</button> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
katakeynii
commented
Apr 17, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment