Message d'avertissement

The subscription service is currently unavailable. Please try again later.

souci avec mon mdule de payement

Information importante

En raison d'un grand nombre d'inscriptions de spammers sur notre site, polluant sans relache notre forum, nous suspendons la création de compte via le formulaire de "sign up".

Il est néanmoins toujours possible de devenir adhérent•e en faisant la demande sur cette page, rubrique "Inscription" : https://www.drupal.fr/contact


De plus, le forum est désormais "interdit en écriture". Il n'est plus autorisé d'y écrire un sujet/billet/commentaire.

Pour contacter la communauté, merci de rejoindre le slack "drupalfrance".

Si vous voulez contacter le bureau de l'association, utilisez le formulaire disponible ici, ou envoyez-nous un DM sur twitter.

bBnjour a tous

je suis nouveau sur drupal et je souhaitre integrer une methode de paiement. pour ce faire, on m'a conseillé de créer un module de paiement; ce que j'ai essayéde faire en me basant sur commerce_paypal_wps.module and commerce_atos_payment.module.

Mais le soucis c'est que apres avoir installer mon module , je le ne retrouve pas dans les options de paiement de la pge administration.

Voici concretement ce que j'éssaie de faire:
recuperer les nformations de la commande (numero de la commande, le nom du client, le montant total de la commande) et les envoyer à une autre page pour effectuter le paiement:
vici mon code

<?php

        /
         * @file
         * Implements Mobile Money Standard in Drupal Commerce checkout.
         */

        /
         * Implements hook_commerce_payment_method_info().
         */
        function commerce_mobile_money_commerce_payment_method_info() {
          $payment_methods = array();

          $payment_methods['mobile_money'] = array(
            'base' => 'commerce_mobile_money',
            'title' => t('Mobile Money'),
            'display_title ' => t('pay with <img src="image/mobile-money.jpg" style="width:37px; height:21px;" alt="mobile money"> '),
            'short_title' => t('MOBILEMO'),
            'description' => t('Mobile Money payment base on wecashup'),
            'terminal' => FALSE,
            'offsite' => TRUE,
            'offsite_autoredirect' => TRUE,
          );

          return $payment_methods;
        }

        function commerce_mobile_money_settings_form($settings = NULL) {
          $form = array();

         $wrapper = entity_metadata_wrapper('commerce_order', $order);
         $amount = $wrapper->commerce_order_total->amount->value();

          $form['amount'] = array(
            '#type' => 'textfield',
            '#title' => t('total order amount'),
            '#default_value' => $amount,
          );

          $form['order_id'] = array(
            '#type' => 'textfield',
            '#title' => t('unique id of order'),
            '#default_value' => $order->order_id,
          );
          $form['show_payment_instructions'] = array(
            '#type' => 'checkbox',
            '#title' => t('Show a message on the checkout form when Mobile Money is selected telling the customer to "Continue with checkout to complete payment via Mobile Money."'),
            '#default_value' => $settings['show_payment_instructions'],
          );
          return $form;
        }

        /
         * Payment method callback: adds a message to the submission form if enabled in
         * the payment method settings.
         */
        function commerce_mobile_money_submit_form($payment_method, $pane_values, $checkout_pane, $order) {
          $form = array();

          if (!empty($payment_method['settings']['mobile_money_instructions'])) {
            $form['mobile_money_information'] = array(
              '#markup' => '<span style="color:green;">' . t('(continuer pour payer avec mobile money.)') . '</span>',
            );
          }

          return $form;
        }

        /
         * Payment method callback: redirect form, a wrapper around the module's general
         *   use function for building a MOBILEMO form.
         */
        function commerce_mobile_money_redirect_form($form, &$form_state, $order, $payment_method) {

          $settings = array(
            // Return to the previous page when payment is canceled
            'cancel_return' => url('checkout/' . $order->order_id . '/payment/back/' . $order->data['payment_redirect_key'], array('absolute' => TRUE)),

            // Return to the payment redirect page for processing successful payments
            'return' => url('checkout/' . $order->order_id . '/payment/return/' . $order->data['payment_redirect_key'], array('absolute' => TRUE)),

            // Specify the current payment method instance ID in the notify_url
            'payment_method' => $payment_method['instance_id'],

            // Include the application indicator
            'bn' => $payment_method['buttonsource'],
          );

          return commerce_mobile_money_order_form($form, $form_state, $order, $payment_method['settings'] + $settings);
        }

        /**
         * Builds a Website Payments Standard form from an order object
         * @param $order
         *   The fully loaded order being paid for.
         * @return
         *   A renderable form array.
         */
        function commerce_mobile_money_order_form($form, &$form_state, $order, $settings) {

          $form['#action'] = "https://noebis.com/fr/payer-par-mobile-money";

          $form['submit'] = array(
            '#type' => 'submit',
            '#value' => t('Proceed to MOBILEMO'),
          );

          return $form;
        }

        function commerce_mobile_money_redirect_form_back($order, $payment_method) {
          // Try to find if a transaction has already been saved for this order and
          // this payment method.
          $transactions = commerce_payment_transaction_load_multiple(array(), array('instance_id' => $payment_method['instance_id'], 'status' => COMMERCE_PAYMENT_STATUS_PENDING, 'order_id' => $order->order_id));
          $transaction = array_pop($transactions);
          // Marks the transaction as Failed.
          if ($transaction) {
            $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
            $transaction->message = t("Cancellation of payment by the end user");
            commerce_payment_transaction_save($transaction);
          }
        }

le dossier de mon module contient (mobile_money_payment.module and mobile_money_payment.info) et un dossier d'image

Forum : 
Version de Drupal :