Plugin Directory

Changeset 2913754


Ignore:
Timestamp:
05/17/2023 02:41:17 PM (3 years ago)
Author:
flutterwave
Message:

Update to version 1.0.6 from GitHub

Location:
rave-payment-forms
Files:
121 added
28 deleted
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • rave-payment-forms/assets/banner-1544x500.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/assets/banner-772x250.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/assets/icon-128×128.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/assets/icon-256×256.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/assets/icon.svg

    • Property svn:mime-type set to image/svg+xml
  • rave-payment-forms/assets/screenshot-1.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/assets/screenshot-2.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/assets/screenshot-3.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/assets/screenshot-4.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/assets/screenshot-5.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • rave-payment-forms/tags/1.0.6/assets/css/flw.css

    r1862668 r2913754  
    1 .flw-simple-pay-now-form button {
    2   -moz-user-select: none;
    3   -ms-touch-action: manipulation;
    4   -ms-user-select: none;
    5   -webkit-user-select: none;
    6   background-color: #0a2740;
    7   border: 1px solid #142a3e;
    8   border-radius: 4px;
    9   color: #fff;
    10   cursor: pointer;
    11   display: inline-block;
    12   font-size: 14px;
    13   font-weight: 400;
    14   line-height: 1.42857143;
    15   margin: 0 0 6px;
    16   outline: none;
    17   padding: 6px 12px;
     1.flw-mssing-api-keys {
     2  color: #ff9b00;
     3  font-size: 1.5em;
     4  padding: .5em;
     5  background: #f4f6f8;
    186  text-align: center;
    19   touch-action: manipulation;
    20   user-select: none;
    21   vertical-align: middle;
    22   white-space: nowrap;
    237}
    248
    25 .flw-simple-pay-now-form button:hover {
    26   background-color: #3d5a73;
     9.flutterwave-overlay {
     10    position: fixed; /* Sit on top of the page content */
     11    width: 100%; /* Full width (cover the whole page) */
     12    height: 100%; /* Full height (cover the whole page) */
     13    top: 0;
     14    left: 0;
     15    right: 0;
     16    bottom: 0;
     17    background-color: rgba(0,0,0,0.5); /* Black background with opacity */
     18    z-index: 2; /* Specify a stack order in case you're using a different order for other elements */
     19    cursor: pointer; /* Add a pointer on hover */
    2720}
    2821
    29 .flw-simple-pay-now-form button:active {
    30   background-color: #0a2740;
     22.flw-overlay-text {
     23    position: absolute;
     24    top: 50%;
     25    left: 50%;
     26    font-size: 50px;
     27    color: white;
     28    transform: translate(-50%,-50%);
     29    -ms-transform: translate(-50%,-50%);
    3130}
    3231
    33 .flw-form-select {
    34     display: block;
    35     /* width: 100%; */
    36     background: #f2f2f2;
    37     height: 34px;
    38     padding: 6px 12px;
    39     font-size: 14px;
    40     line-height: 1.42857143;
    41     color: #555;
    42     background-color: #fff;
    43     background-image: none;
    44     border: 1px solid #ccc;
    45     border-radius: 4px;
    46     -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    47     box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    48     -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
    49     -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    50     transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
     32.flutterwave-payment-form, .flutterwave-donation-form {
     33    /*position: absolute;*/
     34    background: #FFFFFF;
     35    border: 1px solid rgba(18, 18, 44, 0.1);
     36    box-shadow: 2px 6px 20px rgba(18, 18, 44, 0.07);
     37    border-radius: 8px;
     38    padding: 30px;
     39    width: 400px;
     40    font-family: "Source Sans Pro","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
     41    margin: auto;
    5142}
    5243
    53 .flw-simple-pay-now-form input {
    54   border: 1px solid #777;
    55   border-color: #142a3e;
    56   border-radius: 4px;
    57   color: #777;
    58   display: inline-block;
    59   font-size: 14px;
    60   font-weight: 400;
    61   line-height: 1.42857143;
    62   margin: 0 0 6px;
    63   outline: none;
    64   padding: 6px 12px;
    65   vertical-align: middle;
    66   white-space: nowrap;
     44.flutterwave-payment-form > form, .flutterwave-donation-form > form {
     45    width: 100%;
     46    display: flex;
     47    flex-direction: column;
     48    justify-content: center;
    6749}
    6850
    69 .flw-simple-pay-now-form label {
    70   display: block;
    71   font-size: 15px;
    72   margin-bottom: 0;
     51.flutterwave-payment-form label, .flutterwave-donation-form label {
     52    /*font-family: Inter;*/
     53    font-size: 16px;
     54    font-weight: 400;
     55    line-height: 20px;
     56    letter-spacing: 0px;
     57    text-align: left;
    7358}
    7459
    75 .failed {
    76   color: #a00;
    77   font-size: 1.5em;
     60.flutterwave-payment-form ::placeholder, .flutterwave-donation-form ::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
     61    font-size: 16px;
     62    font-weight: 400;
     63    line-height: 20px;
     64    letter-spacing: 0px;
     65    text-align: left;
     66    opacity: 1; /* Firefox */
    7867}
    7968
    80 .successful {
    81   color: #0a0;
    82   font-size: 1.5em;
     69.flutterwave-payment-form :-ms-input-placeholder, .flutterwave-donation-form :-ms-input-placeholder { /* Internet Explorer 10-11 */
     70    font-size: 16px;
     71    font-weight: 400;
     72    line-height: 20px;
     73    letter-spacing: 0px;
     74    text-align: left;
    8375}
     76
     77.flutterwave-payment-form ::-ms-input-placeholder, .flutterwave-donation-form ::-ms-input-placeholder { /* Microsoft Edge */
     78    font-size: 16px;
     79    font-weight: 400;
     80    line-height: 20px;
     81    letter-spacing: 0px;
     82    text-align: left;
     83}
     84
     85.flutterwave-payment-form input[type="text"],
     86.flutterwave-payment-form input[type="number"],
     87.flutterwave-payment-form input[type="tel"],
     88.flutterwave-payment-form input[type="email"], .flutterwave-payment-form select {
     89    background: #FFFFFF;
     90    border: 1px solid #BDBDBD;
     91    /*border: 1px solid #F5A623;*/
     92    border-radius: 4px;
     93    padding: 15px;
     94    font-size: 16px;
     95    font-weight: 400;
     96    display: flex;
     97    justify-content: flex-start;
     98    margin-bottom: .9em;
     99}
     100
     101
     102#flw-first-name:hover, #flw-customer-email:hover, #flw-last-name:hover, #flw-amount:hover, #flw-full-name:hover, #flw-phone:hover{
     103    border: 1px solid #F5A623;
     104}
     105
     106.flutterwave-payment-form form #flw-pay-now-button, .flutterwave-donation-form form #flw-pay-now-button {
     107    background: #F5A623;
     108    display: flex;
     109    flex-direction: column;
     110    justify-content: center;
     111    align-items: center;
     112    height: 56px;
     113    color: #000000;
     114    border-radius: 4px;
     115}
     116
     117.flutterwave-payment-form form #flw-pay-now-button:disabled, .flutterwave-donation-form  form #flw-pay-now-button:disabled {
     118    background-color: rgba(239, 239, 239, 0.3);
     119    color: rgba(16, 16, 16, 0.3);
     120    border-color: rgba(118, 118, 118, 0.3);
     121}
     122
     123.flutterwave-payment-form form #flw-pay-now-button:hover, .flutterwave-donation-form form #flw-pay-now-button:hover {
     124    background: #6672c7;
     125    color: #FFFFFF;
     126}
     127
     128.flutterwave-payment-form form > div.flw_payment_overview {
     129    display: flex;
     130    flex-direction: row;
     131    justify-content: space-between;
     132    align-items: center;
     133}
     134
     135.flutterwave-payment-form form > div.flw_payment_overview > div.flw_total_label {
     136    font-size: 16px;
     137    font-weight: 400;
     138}
     139
     140.flutterwave-payment-form form > div.flw_payment_overview > div.flw_amount_to_pay {
     141    font-size: 22px;
     142    font-weight: 600;
     143    color: #35a162;
     144}
     145
     146.flutterwave-payment-form div, .flutterwave-donation-form div {
     147    display: block;
     148}
     149
     150/** Flutterwave Donation Page **/
     151
     152.flutterwave-donation-form input[type="text"],
     153.flutterwave-donation-form input[type="number"],
     154.flutterwave-donation-form input[type="email"], .flutterwave-donation-form select {
     155    background: #FFFFFF;
     156    border: 1px solid #BDBDBD;
     157    /*border: 1px solid #F5A623;*/
     158    border-radius: 4px;
     159    padding: 15px;
     160    font-size: 16px;
     161    font-weight: 400;
     162    display: flex;
     163    justify-content: flex-start;
     164}
  • rave-payment-forms/tags/1.0.6/assets/js/flw-tinymce.js

    r1862668 r2913754  
    11'use strict';
    22
    3 (function() {
    4   tinymce.create('tinymce.plugins.flw_plugin', {
    5     init: function( editor, url ) {
    6       var assetsUrl = url.replace( '/js', '/' );
    7       editor.addCommand('flw_insert_shortcode', function() {
     3(function () {
     4    tinymce.create('tinymce.plugins.flw_plugin', {
     5        init: function (editor, url) {
     6            var assetsUrl = url.replace('/js', '/');
     7            editor.addCommand('flw_insert_shortcode', function () {
     8                var selected = tinymce.activeEditor.selection.getContent();
     9                var content = selected
     10                    ? '[flw-pay-button]' + selected + '[/flw-pay-button]'
     11                    : '[flw-pay-button]';
     12                tinymce.execCommand('mceInsertContent', false, content);
     13            });
    814
    9         var selected  = tinymce.activeEditor.selection.getContent();
    10         var content   = ( selected ) ? '[flw-pay-button]' + selected + '[/flw-pay-button]' : '[flw-pay-button]';
    11         tinymce.execCommand( 'mceInsertContent', false, content );
     15            editor.addButton('flw_button', {
     16                title: 'Insert Flutterwave payment shortcode',
     17                cmd: 'flw_insert_shortcode',
     18                image: assetsUrl + 'images/rave-icon.png',
     19            });
     20        },
     21    });
    1222
    13       });
    14 
    15       editor.addButton( 'flw_button', {
    16         title : 'Insert Rave payment shortcode',
    17         cmd   : 'flw_insert_shortcode',
    18         image : assetsUrl +'images/rave-icon.png',
    19       } );
    20     },
    21   });
    22 
    23   tinymce.PluginManager.add('flw_button', tinymce.plugins.flw_plugin);
    24 
     23    tinymce.PluginManager.add('flw_button', tinymce.plugins.flw_plugin);
    2524})();
  • rave-payment-forms/tags/1.0.6/assets/js/flw.js

    r2549155 r2913754  
    1 'use strict';
     1jQuery(function ($) {
     2    /**
     3     * Builds config object to be sent to GetPaid
     4     *
     5     * @return object - The config object
     6     */
     7    const buildConfigObj = function (form) {
     8        let formData = $(form).data();
    29
    3 var form = jQuery( '.flw-simple-pay-now-form' ),
    4   redirectUrl;
     10        // Form Appearance settings.
     11        let should_split_name = formData.split_name?.replace(/"|'/g, '') == 1;
    512
    6 if ( form ) {
     13        let fullname = '';
     14        if (!should_split_name) {
     15            fullname = $(form).find('#flw-full-name').val();
     16        } else {
     17            let firstname =
     18                formData.firstname?.replace(/"|'/g, '') ||
     19                $(form).find('#flw-first-name').val();
     20            let lastname =
     21                formData.lastname?.replace(/"|'/g, '') ||
     22                $(form).find('#flw-last-name').val();
     23            fullname = firstname + ' ' + lastname;
     24        }
    725
    8   form.on( 'submit', function(evt) {
    9     evt.preventDefault();
    10     var config = buildConfigObj( this );
    11     processCheckout( config );
     26        let phone =
     27            formData.phone?.replace(/"|'/g, '') ||
     28            $(form).find('#flw-phone').val();
    1229
    13   } );
     30        let amount =
     31            formData.amount?.replace(/"|'/g, '') ||
     32            $(form).find('#flw-amount').val();
     33        let email =
     34            formData.email?.replace(/"|'/g, '') ||
     35            $(form).find('#flw-customer-email').val();
     36        let special_currency_value =
     37            formData.custom_currency?.replace(/"|'/g, '') ||
     38            $(form).find('#flw-currency').val();
     39        let formCurrency =
     40            formData.custom_currency?.replace(/"|'/g, '').length > 3
     41                ? $(form).find('#flw-currency').val()
     42                : special_currency_value;
    1443
    15 }
     44        let formId = form.attr('id');
     45        let txref = 'WP_' + formId.toUpperCase() + '_' + new Date().valueOf();
     46        let setCountry; //set country
    1647
     48        //switch the country with form currency provided
     49        setCountry = flw_pay_options.countries[formCurrency]
     50            ? flw_pay_options.countries[formCurrency]
     51            : flw_pay_options.countries['NGN'];
    1752
    18 /**
    19  * Builds config object to be sent to GetPaid
    20  *
    21  * @return object - The config object
    22  */
    23   var buildConfigObj = function( form ) {
    24   var formData = jQuery( form ).data();
    25   var amount = formData.amount || jQuery(form).find('#flw-amount').val();
    26   var email = formData.email || jQuery(form).find('#flw-customer-email').val();
    27   var firstname = formData.firstname || jQuery(form).find('#flw-first-name').val();
    28   var lastname = formData.lastname || jQuery(form).find('#flw-last-name').val();
    29   var formCurrency = formData.currency || jQuery(form).find('#flw-currency').val();
    30   var paymentplanID = jQuery(form).find('#flw-payment-plan').val();
    31   var txref   = 'WP_' + form.id.toUpperCase() + '_' + new Date().valueOf();
    32   var setCountry; //set country
     53        let redirect_url = window.location.origin;
    3354
     55        return {
     56            amount: amount,
     57            country: setCountry, //flw_pay_options.country,
     58            currency: formCurrency ?? flw_pay_options.currency,
     59            customer: {
     60                email,
     61                phone_number: phone ?? null,
     62                name: fullname,
     63            },
     64            payment_options: flw_pay_options.method,
     65            public_key: flw_pay_options.public_key,
     66            tx_ref: txref,
     67            customizations: {
     68                title: flw_pay_options.title,
     69                description: flw_pay_options.desc,
     70                logo: flw_pay_options.logo,
     71            },
     72            form_id: formId,
     73        };
     74    };
    3475
    35   if (formCurrency == '') {
    36     formCurrency = flw_rave_options.currency;
    37   }
     76    const processCheckout = function (opts, form) {
     77        let args = {
     78            action: 'get_payment_url',
     79            flw_sec_code: $(form).find('#flw_sec_code').val(),
     80        };
    3881
    39   //switch the country with form currency provided
    40   switch (formCurrency) {
    41     case 'KES':
    42       setCountry = 'KE';
    43       break;
    44     case 'GHS':
    45       setCountry = 'GH';
    46       break;
    47     case 'ZAR':
    48       setCountry = 'ZA';
    49       break;
    50     case 'UGX':
    51       setCountry = 'UG';
    52       break;
    53     default:
    54       setCountry = 'NG';
    55       break;
    56   }
     82        let dataObj = Object.assign({}, args, opts);
    5783
    58   return {
    59     amount: amount,
    60     country: setCountry, //flw_rave_options.country,
    61     currency: formCurrency,
    62     custom_description: flw_rave_options.desc,
    63     custom_logo: flw_rave_options.logo,
    64     custom_title: flw_rave_options.title,
    65     customer_email: email,
    66     customer_firstname: firstname,
    67     customer_lastname: lastname,
    68     payment_options: flw_rave_options.method,
    69     PBFPubKey: flw_rave_options.pbkey,
    70     txref: txref,
    71     payment_plan: paymentplanID,
    72     onclose: function() {
    73       redirectTo( redirectUrl );
    74     },
    75     callback: function(res) {
    76       sendPaymentRequestResponse( res, form );
    77     }
    78   };
     84        // console.log(dataObj);
    7985
    80 };
     86        $.post(flw_pay_options.cb_url, dataObj).success(function (data) {
     87            let response = data;
    8188
    82 var processCheckout = function(opts) {
    83   getpaidSetup( opts );
    84 };
     89            if (response.status === 'error') {
     90                $('.flw-error')
     91                    .html(response.message)
     92                    .attr('style', 'color:red');
     93            } else {
     94                let flw_overlay = $('#flutterwave-overlay');
     95                flw_overlay.addClass('flutterwave-overlay');
     96                $('#flw-overlay-text').addClass('flw-overlay-text');
     97                flw_overlay.show();
     98                redirectTo(response.url);
     99            }
     100        });
     101    };
    85102
    86 /**
    87  * Sends payment response from GetPaid to the process payment endpoint
    88  *
    89  * @param object Response object from GetPaid
    90  *
    91  * @return void
    92  */
    93 var sendPaymentRequestResponse = function( res, form ) {
    94   var args = {
    95     action: 'process_payment',
    96     flw_sec_code: jQuery( form ).find( '#flw_sec_code' ).val(),
    97   };
     103    /**
     104    * Sends payment response from GetPaid to the process payment endpoint
     105    *
     106    * @param object Response object from GetPaid
     107    *
     108    * @return void
     109    */
     110    const sendPaymentRequestResponse = function (res, form) {
     111        let args = {
     112            action: 'process_payment',
     113            flw_sec_code: $(form).find('#flw_sec_code').val(),
     114        };
    98115
    99   var dataObj = Object.assign( {}, args, res.tx );
     116        let dataObj = Object.assign({}, args, res.tx);
    100117
    101   jQuery
    102     .post( flw_rave_options.cb_url, dataObj )
    103     .success( function(data) {
    104       var response  = JSON.parse( data );
    105       redirectUrl   = response.redirect_url;
     118        $.post(flw_pay_options.cb_url, dataObj).success(function (data) {
     119            var response = JSON.parse(data);
     120            redirectUrl = response.redirect_url;
    106121
    107       if ( redirectUrl === '' ) {
     122            if (redirectUrl === '') {
     123                var responseMsg =
     124                    res.tx.paymentType === 'account'
     125                        ? res.tx.acctvalrespmsg
     126                        : res.tx.vbvrespmessage;
     127                $(form)
     128                    .find('#notice')
     129                    .text(responseMsg)
     130                    .removeClass(function () {
     131                        return $(form).find('#notice').attr('class');
     132                    })
     133                    .addClass(response.status);
     134            } else {
     135                setTimeout(redirectTo, 5000, redirectUrl);
     136            }
     137        });
     138    };
    108139
    109         var responseMsg  = ( res.tx.paymentType === 'account' ) ? res.tx.acctvalrespmsg  : res.tx.vbvrespmessage;
    110         jQuery( form )
    111           .find( '#notice' )
    112           .text( responseMsg )
    113           .removeClass( function() {
    114             return jQuery( form ).find( '#notice' ).attr( 'class' );
    115           } )
    116           .addClass( response.status );
     140    /**
     141     * Redirect to set url
     142     *
     143     * @param string url - The link to redirect to
     144     *
     145     * @return void
     146     */
     147    const redirectTo = function (url) {
     148        if (url) {
     149            location.href = url;
     150        }
     151    };
    117152
    118       } else {
     153    // for each form process payments
     154    $('.flw-simple-pay-now-form').each(function () {
     155        let form = $(this);
    119156
    120         setTimeout( redirectTo, 5000, redirectUrl );
     157        form.on('submit', function (event) {
     158            event.preventDefault(); // Prevent the default form submission
     159            let btn = form.find('button');
     160            //gray the button.
     161            btn.prop('disabled', true);
    121162
    122       }
     163            let inputs = form.find('input[type="*"]');
    123164
    124     } );
    125 };
     165            let isValid = true;
    126166
    127 /**
    128  * Redirect to set url
    129  *
    130  * @param string url - The link to redirect to
    131  *
    132  * @return void
    133  */
    134 var redirectTo = function( url ) {
     167            inputs.each(function () {
     168                let inputValue = $(this).val();
     169                if (
     170                    typeof inputValue === 'string' &&
     171                    inputValue.trim() === ''
     172                ) {
     173                    isValid = false;
     174                    $(this).attr('style', 'border-color: red');
     175                }
    135176
    136   if ( url ) {
    137     location.href = url;
    138   }
     177                if (
     178                    $(this).attr('type') === 'number' &&
     179                    parseInt(inputValue) === NaN
     180                ) {
     181                    isValid = false;
     182                    $(this).attr('style', 'border-color: red');
     183                }
     184            });
    139185
    140 };
     186            if (isValid) {
     187                let config = buildConfigObj(form);
     188                console.log(config);
     189                processCheckout(config, form);
     190            } else {
     191                //unblur button.
     192                btn.effect('shake', { times: 2 }, 300);
     193                btn.prop('disabled', false);
     194            }
     195        });
     196    });
     197});
  • rave-payment-forms/tags/1.0.6/assets/js/paymentplan.js

    r2386443 r2913754  
     1const planName = jQuery('#plan-name');
     2const planAmount = jQuery('#plan-amount');
     3const planInterval = jQuery('#plan-interval');
     4const planDuration = jQuery('#plan-duration');
    15
    2     const planName = jQuery('#plan-name');
    3     const planAmount = jQuery('#plan-amount');
    4     const planInterval = jQuery('#plan-interval');
    5     const planDuration = jQuery('#plan-duration');
    6     const seckey = jQuery('#seckey');
    7    
    8    
     6jQuery(document).ready(function () {
     7    jQuery('#wpfooter').hide();
    98
    10     jQuery(document).ready(function(){
     9    jQuery('#createPlan-btn').on('click', (event) => {
     10        event.preventDefault();
    1111
    12         jQuery('#wpfooter').hide();
    13          
    14 
    15         jQuery('#createPlan-btn').on('click', (event) => {
    16                 event.preventDefault();
    17      
    18                 jQuery.post("https://api.ravepay.co/v2/gpx/paymentplans/create",
    19                 {
    20                       seckey: seckey.val(),
    21                       amount : planAmount.val(),
    22                       name : planName.val(),
    23                       interval : planInterval.val(),
    24                       duration : parseInt(planDuration.val()),
    25                 })
    26                 .done(function () {
    27                     location.reload();
    28  
    29                 })
    30 
    31         });
    32        
    33 
    34 
    35 
    36 
    37 
    38 
    39 
    40 
    41 
    42 
    43     });
    44 
    45 
    46 
    47 
    48 
    49 
    50      
     12        jQuery
     13            .post('#', {
     14                amount: planAmount.val(),
     15                name: planName.val(),
     16                interval: planInterval.val(),
     17                duration: parseInt(planDuration.val()),
     18            })
     19            .done(function () {
     20                location.reload();
     21            });
     22    });
     23});
  • rave-payment-forms/tags/1.0.6/readme.md

    r2749184 r2913754  
    7676## Support
    7777
    78 For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:developers@flutterwavego.com) or on [slack](https://bit.ly/34Vkzcg). 
     78For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:developers@flutterwavego.com) or on [slack](https://bit.ly/34Vkzcg).
    7979
    80 You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
     80You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
    8181
    8282### Configure the plugin
     
    132132```
    133133[flw-pay-button amount="1290" email="customer@email.com" ]Button Text[/flw-pay-button]
     134
     135or
     136
     137[flw-pay-button amount="1290" email="customer@email.com" split_name=1 ]Button Text[/flw-pay-button]
     138
     139
     140```
     141
     142With custom and excluded fields.
     143```
     144[flw-pay-form amount=1234 fullname="Abraham Olaobaju" currency="USD,UGX,NGN" custom_fields='age:number,color:select|black:#000|white:#fff' exclude="phone"]
     145
     146```
     147
     148With order rearranged.
     149```
     150[flw-pay-form amount=1234 fullname="Abraham Olaobaju" currency="USD,UGX,NGN" order="currency,fullname,amount,phone,email"]
     151```
     152
     153Donation Form.
     154```
     155[flw-donation-form]
    134156```
    135157
     
    139161
    140162* On Visual Composer __Add Element__ dialog, click on "__Rave Forms__" and select the type of form you want to include on your page.
    141 ![Visual Composer Screenshot 1](https://cloud.githubusercontent.com/assets/8383666/21606192/20887a10-d1ae-11e6-85f7-6f8771cb8688.png)
     163  ![Visual Composer Screenshot 1](https://cloud.githubusercontent.com/assets/8383666/21606192/20887a10-d1ae-11e6-85f7-6f8771cb8688.png)
    142164###
    143165
    144166* On the "Form Settings" dialog, fill in the form attributes and click "__Save Changes__".
    145 ![Visual Composer Screenshot 2](https://cloud.githubusercontent.com/assets/8383666/21606210/381994b6-d1ae-11e6-8731-810be5550f55.png)
     167  ![Visual Composer Screenshot 2](https://cloud.githubusercontent.com/assets/8383666/21606210/381994b6-d1ae-11e6-8731-810be5550f55.png)
    146168###
    147169
    148170* Payment Form successfully added to the page.
    149 ![Visual Composer Screenshot 3](https://cloud.githubusercontent.com/assets/8383666/21606217/46200ed2-d1ae-11e6-812b-7d5a2c1f6b43.png)
     171  ![Visual Composer Screenshot 3](https://cloud.githubusercontent.com/assets/8383666/21606217/46200ed2-d1ae-11e6-812b-7d5a2c1f6b43.png)
    150172###
    151173
  • rave-payment-forms/tags/1.0.6/readme.txt

    r2908142 r2913754  
    33Tags: rave, payment form, payment gateway, bank account, credit card, debit card, nigeria, kenya, international, mastercard, visa, flutterwave
    44Donate link: http://rave.flutterwave.com/
    5 Requires at least: 6.0
    6 Tested up to: 6.2
    7 Requires PHP: 5.4
     5Requires at least: 4.4
     6Tested up to: 6.0
     7Requires PHP: 7.4
    88Stable tag: 1.0.6
    99License: MIT
     
    5050For FTP manual installation, [check here](http://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation).
    5151
    52 = Configuration options = 
     52= Configuration options =
    5353
    5454* Pay Button Public Key (live/Test) - Enter your public key which can be retrieved from Settings > API on your Rave account dashboard.
     
    119119* b. Visual Composer
    120120The shortcode can be added via Visual Composer elements.
    121 On Visual Composer Add Element dialog, click on "Rave Forms" and select the type of form you want to include on your page. 
     121On Visual Composer Add Element dialog, click on "Rave Forms" and select the type of form you want to include on your page.
    122122
    123123
    124124On the "Form Settings" dialog, fill in the form attributes and click "Save Changes".
    125125
    126 Payment Form successfully added to the page. 
     126Payment Form successfully added to the page.
    127127
    128128= Best Practices =
     
    141141= Support =
    142142
    143 For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:developers@flutterwavego.com) or on [slack](https://bit.ly/34Vkzcg). 
     143For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:developers@flutterwavego.com) or on [slack](https://bit.ly/34Vkzcg).
    144144
    145 You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
     145You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
    146146
    147147= Contribution guidelines =
     
    149149We love to get your input. Read more about our community contribution guidelines [here](/CONTRIBUTING.md)
    150150
    151 = License = 
     151= License =
    152152
    153153By contributing to the Flutterwave WooCommerce, you agree that your contributions will be licensed under its [MIT license](/LICENSE).
     
    1571571. To configure the plugin, go to Rave > Settings from the left menu.
    1581582. On Visual Composer Add Element dialog, click on "Rave Forms" and select the type of form you want to include on your page.
    159 3. On the "Form Settings" dialog, fill in the form attributes and click "Save Changes". 
     1593. On the "Form Settings" dialog, fill in the form attributes and click "Save Changes".
    1601604. Payment Form successfully added to the page.
    1611615. All the payments made through the forms to Rave can be accessed on Rave > Transactions page.
  • rave-payment-forms/tags/1.0.6/views/admin-settings-page.php

    r2589854 r2913754  
    11<?php
    2 
    3   if ( ! defined( 'ABSPATH' ) ) { exit; }
     2/**
     3 * Flutterwave Payments Settings Page
     4 *
     5 * @package Flutterwave\Payments\Views
     6 * @version 1.0.6
     7 */
     8
     9defined( 'ABSPATH' ) || exit;
     10
     11$settings = FLW_Admin_Settings::get_instance();
    412
    513?>
    6 <?php global $admin_settings; ?>
    714
    815  <div class="wrap">
    9     <h1>Rave Payment Forms Settings</h1>
    10     <form id="rave-pay" action="options.php" method="post" enctype="multipart/form-data">
    11       <?php settings_fields( 'flw-rave-settings-group' ); ?>
    12       <?php do_settings_sections( 'flw-rave-settings-group' ); ?>
    13       <table class="form-table">
    14         <tbody>
    15 
    16           <!-- Public Key -->
    17           <tr valign="top">
    18             <th scope="row">
    19               <label for="flw_rave_options[public_key]"><?php _e( 'Pay Button Public Key', 'rave-pay' ); ?></label>
    20             </th>
    21             <td class="forminp forminp-text">
    22               <input class="regular-text code" type="text" name="flw_rave_options[public_key]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'public_key' ) ); ?>" />
    23               <p class="description">Your Pay Button public key</p>
    24             </td>
    25           </tr>
    26           <!-- Secret Key -->
    27           <tr valign="top">
    28             <th scope="row">
    29               <label for="flw_rave_options[secret_key]"><?php _e( 'Pay Button Secret Key', 'rave-pay' ); ?></label>
    30             </th>
    31             <td class="forminp forminp-text">
    32               <input class="regular-text code" type="text" name="flw_rave_options[secret_key]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'secret_key' ) ); ?>" />
    33               <p class="description">Your Pay Button secret key</p>
    34             </td>
    35           </tr>
    36 
    37           <!-- Switch to Live -->
    38           <tr valign="top">
    39             <th scope="row">
    40               <label for="flw_rave_options[go_live]"><?php _e( 'Go Live', 'rave-pay' ); ?></label>
    41             </th>
    42             <td class="forminp forminp-checkbox">
    43               <fieldset>
    44                 <?php $go_live = esc_attr( $admin_settings->get_option_value( 'go_live' ) ); ?>
    45                 <label>
    46                   <input type="checkbox" name="flw_rave_options[go_live]" <?php checked( $go_live, 'yes' ); ?> value="yes" />
    47                   <?php _e( 'Switch to live account', 'rave-pay' ); ?>
    48                 </label>
    49               </fieldset>
    50             </td>
    51           </tr>
    52           <!-- Method -->
    53           <tr valign="top">
    54             <th scope="row">
    55               <label for="flw_rave_options[method]"><?php _e( 'Payment Method', 'rave-pay' ); ?></label>
    56             </th>
    57             <td class="forminp forminp-text">
    58               <select class="regular-text code" name="flw_rave_options[method]">
    59                 <?php $method = esc_attr( $admin_settings->get_option_value( 'method' ) ); ?>
    60                 <option value="both" <?php selected( $method, 'both' ) ?>>Card and Account</option>
    61                 <option value="card" <?php selected( $method, 'card' ) ?>>Card Only</option>
    62                 <option value="account" <?php selected( $method, 'account' ) ?>>Account Only</option>
    63                 <option value="barter" <?php selected( $method, 'barter' ) ?>>Barter Only</option>
    64                 <option value="mpesa" <?php selected( $method, 'mpesa' ) ?>>Mpesa Only (for KES)</option>
    65                 <option value="ussd" <?php selected( $method, 'ussd' ) ?>>USSD Only</option>
    66                 <option value="mobilemoneyuganda" <?php selected( $method, 'mobilemoneyuganda' ) ?>>MobileMoney UGX Only</option>
    67                 <option value="mobilemoneyrwanda" <?php selected( $method, 'mobilemoneyrwanda' ) ?>>MobileMoney RWD Only</option>
    68                 <option value="mobilemoneyzambia" <?php selected( $method, 'mobilemoneyzambia' ) ?>>MobileMoney ZMB Only</option>
    69                 <option value="mobilemoneytanzania" <?php selected( $method, 'mobilemoneytanzania' ) ?>>MobileMoney TZS Only</option>
    70               </select>
    71               <p class="description">(Optional) default: Card and Account</p>
    72             </td>
    73           </tr>
    74 
    75           <!-- Modal title -->
    76           <tr valign="top">
    77             <th scope="row">
    78               <label for="flw_rave_options[modal_title]"><?php _e( 'Modal Title', 'rave-pay' ); ?></label>
    79             </th>
    80             <td class="forminp forminp-text">
    81               <input class="regular-text code" type="text" name="flw_rave_options[modal_title]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'modal_title' ) ); ?>" />
    82               <p class="description">(Optional) default: FLW PAY</p>
    83             </td>
    84           </tr>
    85           <!-- Modal Description -->
    86           <tr valign="top">
    87             <th scope="row">
    88               <label for="flw_rave_options[modal_desc]"><?php _e( 'Modal Description', 'rave-pay' ); ?></label>
    89             </th>
    90             <td class="forminp forminp-text">
    91               <input class="regular-text code" type="text" name="flw_rave_options[modal_desc]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'modal_desc' ) ); ?>" />
    92               <p class="description">(Optional) default: FLW PAY MODAL</p>
    93             </td>
    94           </tr>
    95           <!-- Modal Logo -->
    96           <tr valign="top">
    97             <th scope="row">
    98               <label for="flw_rave_options[modal_logo]"><?php _e( 'Modal Logo', 'rave-pay' ); ?></label>
    99             </th>
    100             <td class="forminp forminp-text">
    101               <input class="regular-text code" type="text" name="flw_rave_options[modal_logo]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'modal_logo' ) ); ?>" />
    102               <p class="description">(Optional) - Full URL (with 'http') to the custom logo. default: Rave logo</p>
    103             </td>
    104           </tr>
    105           <!-- Successful Redirect URL -->
    106           <tr valign="top">
    107             <th scope="row">
    108               <label for="flw_rave_options[success_redirect_url]"><?php _e( 'Success Redirect URL', 'rave-pay' ); ?></label>
    109             </th>
    110             <td class="forminp forminp-text">
    111               <input class="regular-text code" type="text" name="flw_rave_options[success_redirect_url]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'success_redirect_url' ) ); ?>" />
    112               <p class="description">(Optional) Full URL (with 'http') to redirect to for successful transactions. default: ""</p>
    113             </td>
    114           </tr>
    115           <!-- Failed Redirect URL -->
    116           <tr valign="top">
    117             <th scope="row">
    118               <label for="flw_rave_options[failed_redirect_url]"><?php _e( 'Failed Redirect URL', 'rave-pay' ); ?></label>
    119             </th>
    120             <td class="forminp forminp-text">
    121               <input class="regular-text code" type="text" name="flw_rave_options[failed_redirect_url]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'failed_redirect_url' ) ); ?>" />
    122               <p class="description">(Optional) Full URL (with 'http') to redirect to for failed transactions. default: ""</p>
    123             </td>
    124           </tr>
    125           <!-- Pay Button Text -->
    126           <tr valign="top">
    127             <th scope="row">
    128               <label for="flw_rave_options[btn_text]"><?php _e( 'Pay Button Text', 'rave-pay' ); ?></label>
    129             </th>
    130             <td class="forminp forminp-text">
    131               <input class="regular-text code" type="text" name="flw_rave_options[btn_text]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'btn_text' ) ); ?>" />
    132               <p class="description">(Optional) default: PAY NOW</p>
    133             </td>
    134           </tr>
    135           <!-- Currency -->
    136           <tr valign="top">
    137             <th scope="row">
    138               <label for="flw_rave_options[currency]"><?php _e( 'Charge Currency', 'rave-pay' ); ?></label>
    139             </th>
    140             <td class="forminp forminp-text">
    141               <select class="regular-text code" name="flw_rave_options[currency]">
    142                 <?php $currency = esc_attr( $admin_settings->get_option_value( 'currency' ) ); ?>
    143                 <option value="" <?php selected($currency, '') ?>>Any (Let Customer decide or use Shortcode)</option>
    144                 <option value="NGN" <?php selected($currency, 'NGN') ?>>NGN</option>
    145                 <option value="GHS" <?php selected( $currency, 'GHS' ) ?>>GHS</option>
    146                 <option value="KES" <?php selected( $currency, 'KES' ) ?>>KES</option>
    147                 <option value="USD" <?php selected( $currency, 'USD' ) ?>>USD</option>
    148                 <option value="GBP" <?php selected( $currency, 'GBP' ) ?>>GBP</option>
    149                 <option value="EUR" <?php selected($currency, 'EUR') ?>>EUR</option>
    150                 <option value="ZAR" <?php selected($currency, 'ZAR') ?>>ZAR</option>
    151                 <option value="UGX" <?php selected($currency, 'UGX') ?>>UGX</option>
    152                 <option value="RWF" <?php selected($currency, 'RWF') ?>>RWF</option>
    153                 <option value="TZS" <?php selected($currency, 'TZS') ?>>TZS</option>
    154                 <option value="ZMW" <?php selected($currency, 'ZMW') ?>>ZMW</option>
    155                 <option value="XOF" <?php selected($currency, 'XOF') ?>>XOF</option>
    156                 <option value="XAF" <?php selected($currency, 'XAF') ?>>XAF</option>
    157               </select>
    158               <p class="description">(Optional) default: NGN</p>
    159             </td>
    160           </tr>
    161           <!-- Country -->
    162           <tr valign="top">
    163             <th scope="row">
    164               <label for="flw_rave_options[country]"><?php _e( 'Charge Country', 'rave-pay' ); ?></label>
    165             </th>
    166             <td class="forminp forminp-text">
    167               <select class="regular-text code" name="flw_rave_options[country]">
    168                 <?php $country = esc_attr( $admin_settings->get_option_value( 'country' ) ); ?>
    169                 <option value="NG" <?php selected( $country, 'NG' ) ?>>NG: Nigeria</option>
    170                 <option value="GH" <?php selected( $country, 'GH' ) ?>>GH: Ghana</option>
    171                 <option value="KE" <?php selected($country, 'KE') ?>>KE: Kenya</option>
    172                 <option value="UG" <?php selected($country, 'UG') ?>>UG: Uganda</option>
    173                 <option value="ZA" <?php selected($country, 'ZA') ?>>ZA: South Africa</option>
    174                 <option value="US" <?php selected( $country, 'US' ) ?>>All (Worldwide)</option>
    175               </select>
    176               <p class="description">(Optional) default: NG</p>
    177             </td>
    178           </tr>
    179 
    180           <!-- Styling -->
    181           <tr valign="top">
    182             <th scope="row">
    183               <label for="flw_rave_options[theme_style]"><?php _e( 'Form Style', 'rave-pay' ); ?></label>
    184             </th>
    185             <td class="forminp forminp-checkbox">
    186               <fieldset>
    187                 <?php $theme_style = esc_attr( $admin_settings->get_option_value( 'theme_style' ) ); ?>
    188                 <label>
    189                   <input type="checkbox" name="flw_rave_options[theme_style]" <?php checked( $theme_style, 'yes' ); ?> value="yes" />
    190                   <?php _e( 'Use default theme style', 'rave-pay' ); ?>
    191                 </label>
    192                 <p class="description">Override the form style and use the default theme's style</p>
    193               </fieldset>
    194             </td>
    195           </tr>
    196 
    197         </tbody>
    198       </table>
    199       <?php submit_button(); ?>
    200     </form>
     16    <h1>Flutterwave Settings</h1>
     17    <form id="rave-pay" action="options.php" method="post" enctype="multipart/form-data">
     18      <?php settings_fields( 'flw-rave-settings-group' ); ?>
     19      <?php do_settings_sections( 'flw-rave-settings-group' ); ?>
     20      <table class="form-table">
     21        <tbody>
     22
     23          <!-- Public Key -->
     24          <tr valign="top">
     25            <th scope="row">
     26              <label for="flw_rave_options[public_key]"><?php esc_attr_e( 'Pay Button Public Key', 'flutterwave-payments' ); ?></label>
     27            </th>
     28            <td class="forminp forminp-text">
     29              <input class="regular-text code" type="text" name="flw_rave_options[public_key]" value="<?php echo esc_attr( $settings->get_option_value( 'public_key' ) ); ?>" />
     30              <p class="description">Flutterwave public key</p>
     31            </td>
     32          </tr>
     33          <!-- Secret Key -->
     34          <tr valign="top">
     35            <th scope="row">
     36              <label for="flw_rave_options[secret_key]"><?php esc_attr_e( 'Pay Button Secret Key', 'flutterwave-payments' ); ?></label>
     37            </th>
     38            <td class="forminp forminp-text">
     39              <input class="regular-text code" type="text" name="flw_rave_options[secret_key]" value="<?php echo esc_attr( $settings->get_option_value( 'secret_key' ) ); ?>" />
     40              <p class="description">Flutterwave secret key</p>
     41            </td>
     42          </tr>
     43
     44        <!-- Secret Key -->
     45        <tr valign="top">
     46            <th scope="row">
     47              <label for="flw_rave_options[secret_hash]"><?php esc_attr_e( 'Secret Hash', 'flutterwave-payments' ); ?></label>
     48            </th>
     49            <td class="forminp forminp-text">
     50              <input class="regular-text code" type="text" name="flw_rave_options[secret_hash]" value="<?php echo esc_attr( $settings->get_option_value( 'secret_hash' ) ); ?>" />
     51              <p class="description">Flutterwave secret Hash</p>
     52            </td>
     53          </tr>
     54
     55        <!-- Webhook -->
     56        <tr valign="top">
     57            <th scope="row">
     58              <label><?php esc_attr_e( 'Webhook URL', 'flutterwave-payments' ); ?></label>
     59            </th>
     60            <td class="forminp forminp-text">
     61              <p class="description">
     62              <?php esc_attr_e( 'Please copy this webhook URL and paste on the webhook section on your dashboard', 'flutterwave-payments' ); ?><strong style="color: red"><pre><code><?php echo esc_attr( get_site_url() ) . '/wp-json/flutterwave/v1/webhook'; ?></code></pre></strong><a href="https://app.flutterwave.com/dashboard/settings/webhooks" target="_blank">Flutterwave Account</a>
     63              </p>
     64            </td>
     65          </tr>
     66
     67          <!-- Switch to Live -->
     68          <tr valign="top">
     69            <th scope="row">
     70              <label for="flw_rave_options[go_live]"><?php esc_attr_e( 'Go Live', 'flutterwave-payments' ); ?></label>
     71            </th>
     72            <td class="forminp forminp-checkbox">
     73              <fieldset>
     74                <?php $go_live = esc_attr( $settings->get_option_value( 'go_live' ) ); ?>
     75                <label>
     76                  <input type="checkbox" name="flw_rave_options[go_live]" <?php checked( $go_live, 'yes' ); ?> value="yes" />
     77                  <?php esc_attr_e( 'Switch to live account', 'flutterwave-payments' ); ?>
     78                </label>
     79              </fieldset>
     80            </td>
     81          </tr>
     82          <!-- Method -->
     83          <tr valign="top">
     84            <th scope="row">
     85              <label for="flw_rave_options[method]"><?php esc_attr_e( 'Payment Method', 'flutterwave-payments' ); ?></label>
     86            </th>
     87            <td class="forminp forminp-text">
     88              <select class="regular-text code" name="flw_rave_options[method]">
     89                <?php $method = esc_attr( $settings->get_option_value( 'method' ) ); ?>
     90                <option value="all" <?php selected( $method, 'all' ); ?>>All Payment Options</option>
     91                <option value="both" <?php selected( $method, 'both' ); ?>>Card and Account</option>
     92                <option value="card" <?php selected( $method, 'card' ); ?>>Card Only</option>
     93                <option value="account" <?php selected( $method, 'account' ); ?>>Account Only</option>
     94              </select>
     95              <p class="description">(Optional) default: All Payment Options</p>
     96            </td>
     97          </tr>
     98
     99          <!-- Modal title -->
     100          <tr valign="top">
     101            <th scope="row">
     102              <label for="flw_rave_options[modal_title]"><?php esc_attr_e( 'Modal Title', 'flutterwave-payments' ); ?></label>
     103            </th>
     104            <td class="forminp forminp-text">
     105              <input class="regular-text code" type="text" name="flw_rave_options[modal_title]" value="<?php echo esc_attr( $settings->get_option_value( 'modal_title' ) ); ?>" />
     106              <p class="description">(Optional) default: FLW PAY</p>
     107            </td>
     108          </tr>
     109          <!-- Modal Description -->
     110          <tr valign="top">
     111            <th scope="row">
     112              <label for="flw_rave_options[modal_desc]"><?php esc_attr_e( 'Modal Description', 'flutterwave-payments' ); ?></label>
     113            </th>
     114            <td class="forminp forminp-text">
     115              <input class="regular-text code" type="text" name="flw_rave_options[modal_desc]" value="<?php echo esc_attr( $settings->get_option_value( 'modal_desc' ) ); ?>" />
     116              <p class="description">(Optional) default: FLW PAY MODAL</p>
     117            </td>
     118          </tr>
     119          <!-- Modal Logo -->
     120          <tr valign="top">
     121            <th scope="row">
     122              <label for="flw_rave_options[modal_logo]"><?php esc_attr_e( 'Modal Logo', 'flutterwave-payments' ); ?></label>
     123            </th>
     124            <td class="forminp forminp-text">
     125              <input class="regular-text code" type="text" name="flw_rave_options[modal_logo]" value="<?php echo esc_attr( $settings->get_option_value( 'modal_logo' ) ); ?>" />
     126              <p class="description">(Optional) - Full URL (with 'https') to the custom logo. default: Flutterwave logo</p>
     127            </td>
     128          </tr>
     129          <!--  Donation Title -->
     130          <tr valign="top">
     131            <th scope="row">
     132              <label for="flw_rave_options[donation_title]"><?php esc_attr_e( 'Donation Title', 'flutterwave-payments' ); ?></label>
     133            </th>
     134            <td class="forminp forminp-text">
     135              <input class="regular-text code" type="text" name="flw_rave_options[donation_title]" value="<?php echo esc_attr( $settings->get_option_value( 'donation_title' ) ); ?>" />
     136              <p class="description">(Optional) default: Donation Title</p>
     137            </td>
     138          </tr>
     139          <!--  Donation Description -->
     140          <tr valign="top">
     141            <th scope="row">
     142              <label for="flw_rave_options[donation_desc]"><?php esc_attr_e( 'Donation Description', 'flutterwave-payments' ); ?></label>
     143            </th>
     144            <td class="forminp forminp-text">
     145              <input class="regular-text code" type="text" name="flw_rave_options[donation_desc]" value="<?php echo esc_attr( $settings->get_option_value( 'donation_desc' ) ); ?>" />
     146              <p class="description">(Optional) default: Donation Desc</p>
     147            </td>
     148          </tr>
     149          <!--  Donation Phone -->
     150          <tr valign="top">
     151            <th scope="row">
     152              <label for="flw_rave_options[donation_phone]"><?php esc_attr_e( 'Donation Phone', 'flutterwave-payments' ); ?></label>
     153            </th>
     154            <td class="forminp forminp-text">
     155              <input class="regular-text code" type="text" name="flw_rave_options[donation_phone]" value="<?php echo esc_attr( $settings->get_option_value( 'donation_phone' ) ); ?>" />
     156              <p class="description">(Optional) default: 08000000000</p>
     157            </td>
     158          </tr>
     159         <!-- Pending Redirect URL -->
     160          <tr valign="top">
     161            <th scope="row">
     162              <label for="flw_rave_options[pending_redirect_url]"><?php esc_attr_e( 'Pending Redirect URL', 'flutterwave-payments' ); ?></label>
     163            </th>
     164            <td class="forminp forminp-text">
     165              <input class="regular-text code" type="text" name="flw_rave_options[pending_redirect_url]" value="<?php echo esc_attr( $settings->get_option_value( 'pending_redirect_url' ) ); ?>" />
     166              <p class="description">(Optional) Full URL (with 'http') to redirect to for pending transactions. default: ""</p>
     167            </td>
     168          </tr>
     169          <!-- Successful Redirect URL -->
     170          <tr valign="top">
     171            <th scope="row">
     172              <label for="flw_rave_options[success_redirect_url]"><?php esc_attr_e( 'Success Redirect URL', 'flutterwave-payments' ); ?></label>
     173            </th>
     174            <td class="forminp forminp-text">
     175              <input class="regular-text code" type="text" name="flw_rave_options[success_redirect_url]" value="<?php echo esc_attr( $settings->get_option_value( 'success_redirect_url' ) ); ?>" />
     176              <p class="description">(Optional) Full URL (with 'http') to redirect to for successful transactions. default: ""</p>
     177            </td>
     178          </tr>
     179          <!-- Failed Redirect URL -->
     180          <tr valign="top">
     181            <th scope="row">
     182              <label for="flw_rave_options[failed_redirect_url]"><?php esc_attr_e( 'Failed Redirect URL', 'flutterwave-payments' ); ?></label>
     183            </th>
     184            <td class="forminp forminp-text">
     185              <input class="regular-text code" type="text" name="flw_rave_options[failed_redirect_url]" value="<?php echo esc_attr( $settings->get_option_value( 'failed_redirect_url' ) ); ?>" />
     186              <p class="description">(Optional) Full URL (with 'http') to redirect to for failed transactions. default: ""</p>
     187            </td>
     188          </tr>
     189          <!-- Failed Redirect URL -->
     190          <tr valign="top">
     191            <th scope="row">
     192              <label for="flw_rave_options[donation_payment_plan]"><?php esc_attr_e( 'Donation Plan Id', 'flutterwave-payments' ); ?></label>
     193            </th>
     194            <td class="forminp forminp-text">
     195              <input class="regular-text code" type="text" name="flw_rave_options[donation_payment_plan]" value="<?php echo esc_attr( $settings->get_option_value( 'donation_payment_plan' ) ); ?>" />
     196            </td>
     197          </tr>
     198          <!-- Pay Button Text -->
     199          <tr valign="top">
     200            <th scope="row">
     201              <label for="flw_rave_options[btn_text]"><?php esc_attr_e( 'Pay Button Text', 'flutterwave-payments' ); ?></label>
     202            </th>
     203            <td class="forminp forminp-text">
     204              <input class="regular-text code" type="text" name="flw_rave_options[btn_text]" value="<?php echo esc_attr( $settings->get_option_value( 'btn_text' ) ); ?>" />
     205              <p class="description">(Optional) default: PAY NOW</p>
     206            </td>
     207          </tr>
     208          <!-- Currency -->
     209          <tr valign="top">
     210            <th scope="row">
     211              <label for="flw_rave_options[currency]"><?php esc_attr_e( 'Charge Currency', 'flutterwave-payments' ); ?></label>
     212            </th>
     213            <td class="forminp forminp-text">
     214              <select class="regular-text code" name="flw_rave_options[currency]">
     215                <?php $currency = esc_attr( $settings->get_option_value( 'currency' ) ); ?>
     216                <option value="any" <?php selected( $currency, 'any' ); ?>>Any (Let Customer decide or use Shortcode)</option>
     217                <option value="NGN" <?php selected( $currency, 'NGN' ); ?>>NGN</option>
     218                <option value="GHS" <?php selected( $currency, 'GHS' ); ?>>GHS</option>
     219                <option value="KES" <?php selected( $currency, 'KES' ); ?>>KES</option>
     220                <option value="USD" <?php selected( $currency, 'USD' ); ?>>USD</option>
     221                <option value="GBP" <?php selected( $currency, 'GBP' ); ?>>GBP</option>
     222                <option value="EUR" <?php selected( $currency, 'EUR' ); ?>>EUR</option>
     223                <option value="ZAR" <?php selected( $currency, 'ZAR' ); ?>>ZAR</option>
     224              </select>
     225              <p class="description">(Optional) default: NGN</p>
     226            </td>
     227          </tr>
     228          <!-- Country -->
     229          <tr valign="top">
     230            <th scope="row">
     231              <label for="flw_rave_options[country]"><?php esc_attr_e( 'Charge Country', 'flutterwave-payments' ); ?></label>
     232            </th>
     233            <td class="forminp forminp-text">
     234              <select class="regular-text code" name="flw_rave_options[country]">
     235                <?php $country = esc_attr( $settings->get_option_value( 'country' ) ); ?>
     236                <option value="NG" <?php selected( $country, 'NG' ); ?>>NG: Nigeria</option>
     237                <option value="GH" <?php selected( $country, 'GH' ); ?>>GH: Ghana</option>
     238                <option value="KE" <?php selected( $country, 'KE' ); ?>>KE: Kenya</option>
     239                <option value="ZA" <?php selected( $country, 'ZA' ); ?>>ZA: South Africa</option>
     240                <option value="US" <?php selected( $country, 'US' ); ?>>All (Worldwide)</option>
     241              </select>
     242              <p class="description">(Optional) default: NG</p>
     243            </td>
     244          </tr>
     245
     246          <!-- Styling -->
     247          <tr valign="top">
     248            <th scope="row">
     249              <label for="flw_rave_options[theme_style]"><?php esc_attr_e( 'Form Style', 'flutterwave-payments' ); ?></label>
     250            </th>
     251            <td class="forminp forminp-checkbox">
     252              <fieldset>
     253                <?php $theme_style = esc_attr( $settings->get_option_value( 'theme_style' ) ); ?>
     254                <label>
     255                  <input type="checkbox" name="flw_rave_options[theme_style]" <?php checked( $theme_style, 'yes' ); ?> value="yes" />
     256                  <?php esc_attr_e( 'Use default theme style', 'flutterwave-payments' ); ?>
     257                </label>
     258                <p class="description">Override the form style and use the default theme's style</p>
     259              </fieldset>
     260            </td>
     261          </tr>
     262
     263        </tbody>
     264      </table>
     265      <?php submit_button(); ?>
     266    </form>
    201267
    202268  </div>
  • rave-payment-forms/tags/1.0.6/views/pay-now-form.php

    r2589854 r2913754  
    11<?php
     2/**
     3 * Flutterwave Payments Form Page
     4 *
     5 * @package Flutterwave\Payments\Views
     6 * @version 1.0.6
     7 */
    28
    3   if ( ! defined( 'ABSPATH' ) ) { exit; }
     9defined( 'ABSPATH' ) || exit;
    410
    5   global $payment_forms;
     11$form_id = Flutterwave_Payments::gen_rand_string();
    612
    7   $form_id = FLW_Rave_Pay::gen_rand_string();
    8 
    9   if (!empty($atts['custom_currency'])) {
    10     if (preg_match('/^[a-z\d]* [a-z\d]*$/', $atts['custom_currency'])) {
    11       $currencies = explode(", ", $atts['custom_currency']);
    12     } else{
    13       $currencies = explode(",", $atts['custom_currency']);
    14     }
    15   }
    16 
    17 
    18 
    19 
    20   // print_r($atts);
    21   // exit();
    22 
    23 
     13if ( ! empty( $atts['custom_currency'] ) ) {
     14    if ( preg_match( '/^[a-z\d]* [a-z\d]*$/', $atts['custom_currency'] ) ) {
     15        $currencies = explode( ', ', $atts['custom_currency'] );
     16    } else {
     17        $currencies = explode( ',', $atts['custom_currency'] );
     18    }
     19}
    2420
    2521?>
    2622
    27 <div>
    28   <form id="<?php echo $form_id ?>" class="flw-simple-pay-now-form" <?php echo $data_attr; ?> >
    29     <div id="notice"></div>
    30     <?php if ( empty( $atts['email'] ) ) : ?>
    31 
    32       <label class="pay-now"><?php _e( 'Email', 'rave-pay' ) ?></label>
    33       <input class="flw-form-input-text" id="flw-customer-email" type="email" placeholder="<?php _e( 'Email', 'rave-pay' ) ?>" required /><br>
    34 
    35     <?php endif; ?>
    36 
    37     <?php if ( empty( $atts['firstname'] ) ) : ?>
    38 
    39       <label class="pay-now"><?php _e( 'First Name', 'rave-pay' ) ?> (Optional) </label>
    40       <input class="flw-form-input-text" id="flw-first-name" type="text" placeholder="<?php _e( 'First Name', 'rave-pay' ) ?>" /><br>
    41 
    42     <?php endif; ?>
    43 
    44     <?php if ( empty( $atts['lastname'] ) ) : ?>
    45 
    46       <label class="pay-now"><?php _e( 'Last Name', 'rave-pay' ) ?> (Optional) </label>
    47       <input class="flw-form-input-text" id="flw-last-name" type="text" placeholder="<?php _e( 'Last Name', 'rave-pay' ) ?>" /><br>
    48 
    49     <?php endif; ?>
    50 
    51     <?php if ( empty( $atts['amount'] ) ) : ?>
    52 
    53       <label class="pay-now"><?php _e( 'Amount', 'rave-pay' ); ?></label>
    54       <input class="flw-form-input-text" id="flw-amount" type="text" placeholder="<?php _e( 'Amount', 'rave-pay' ); ?>" required /><br>
    55 
    56     <?php endif; ?>
    57 
    58 
    59 <?php    if (!empty($atts['extra_count'] && $atts['extra_count'] > 0)) {
    60   //  print_r($atts);
    61   //  exit();
    62 if(empty(explode(",",$payment_forms->get_option_value('extra_field_1'))[0])){
    63       $extra_fields = [];
    64 }else{
    65   $extra_fields = explode(",", $payment_forms->get_option_value('extra_field_1'));
    66   if(count($extra_fields) == 1){
    67     $extra_fields = $extra_fields[0];
    68   }
    69 }
    70 foreach ($extra_fields as $key => $value) {?>
    71 
    72 <?php  if (strstr($value, '-h') === false ) : ?>
    73 <?php if(array_key_exists($value, $atts) && empty( $atts[$value])){ ?>
    74 
    75 <label class="pay-now"><?php _e( $value, 'rave-pay' ); ?></label>
    76 <input class="flw-form-input-text" id="flw-meta" type="text" placeholder="<?php _e( $value, 'rave-pay' ); ?>" required /><br>
    77 
    78 <?php }?>
    79 <?php endif; ?>
    80 
    81 <?php }
    82 }?>
    83 
    84 <?php if(!empty($atts['extra_checkbox_count'] && $atts['extra_checkbox_count'] > 0)) {
    85 
    86 
    87 if(empty(explode(",",$payment_forms->get_option_value('extra_field_2'))[0])){
    88   $extra_fields_checkbox = [];
    89 }else{
    90   $extra_fields_checkbox = explode(",", $payment_forms->get_option_value('extra_field_2'));
    91   if(count($extra_fields_checkbox) == 1){
    92     $extra_fields_checkbox = $extra_fields_checkbox[0];
    93   }
    94 }
    95 foreach ($extra_fields_checkbox as $key => $value) {?>
    96 
    97 <?php if(array_key_exists($value, $atts) && empty( $atts[$value] )){ ?>
    98 
    99 <label class="pay-now"><?php _e( $value, 'rave-pay' ); ?></label>
    100 <input class="" id="flw-meta" type="checkbox" placeholder="<?php _e( $value, 'rave-pay' ); ?>" required /><br>
    101 
    102 <?php }}}?>
    103 
    104    
    105     <?php
    106          
    107         //  print_r($atts);
    108    
    109     if ( !empty( $atts['recurring_payment'] ) ) : ?>
    110 
    111       <label class="pay-now"><?php _e( 'Recurring Payment', 'rave-pay' ) ?></label>
    112       <select class="flw-form-select" id="flw-payment-plan" required>
    113         <option value="">-- Select Interval --</option>
    114         <?php
    115           foreach($atts['paymentplans'] as $key => $value){
    116             if ($atts['paymentplansenable'][$key] == 'yes')
    117               echo '<option value="'.$key.'">'.$value.'</option>';
    118           }
    119         ?>
    120       </select><br>
    121 
    122     <?php endif; ?>
    123 
    124     <?php if (empty($atts['currency'])) : ?>
    125       <label class="pay-now"><?php _e('Currency', 'rave-pay'); ?></label>
    126       <?php if (!empty($atts['custom_currency'])){ ?>
    127 
    128       <select class="flw-form-select" id="flw-currency" required>
    129         <?php foreach ($currencies as $currency): ?>
    130           <option value="<?php echo $currency ?>"><?php echo $currency ?></option>
    131         <?php endforeach; ?>
    132       </select>
    133 
    134       <?php } else{ ?>
    135 
    136 
    137       <?php if ($atts['country'] == "NG") : ?>
    138         <select class="flw-form-select" id="flw-currency" required>
    139           <option value="NGN">NGN</option>
    140           <option value="USD">USD</option>
    141           <option value="KES">KES</option>
    142           <option value="EUR">EUR</option>
    143           <option value="GBP">GBP</option>
    144         </select>
    145       <?php endif; ?>
    146 
    147       <?php if ($atts['country'] == "KE") : ?>
    148         <select class="flw-form-select" id="flw-currency" required>
    149           <option value="KES">KES</option>
    150           <option value="NGN">NGN</option>
    151           <option value="UGX">UGX</option>
    152           <option value="USD">USD</option>
    153           <option value="KES">KES</option>
    154           <option value="EUR">EUR</option>
    155           <option value="GBP">GBP</option>
    156         </select>
    157       <?php endif; ?>
    158 
    159       <?php if ($atts['country'] == "GH") : ?>
    160         <select class="flw-form-select" id="flw-currency" required>
    161           <option value="GHS">GHS</option>
    162           <option value="USD">USD</option>
    163           <option value="NGN">NGN</option>
    164           <option value="UGX">UGX</option>
    165           <option value="USD">USD</option>
    166           <option value="KES">KES</option>
    167           <option value="EUR">EUR</option>
    168           <option value="GBP">GBP</option>
    169         </select>
    170       <?php endif; ?>
    171 
    172       <?php if ($atts['country'] == "UG") : ?>
    173         <select class="flw-form-select" id="flw-currency" required>
    174           <option value="UGX">UGX</option>
    175           <option value="NGN">NGN</option>
    176           <option value="UGX">UGX</option>
    177           <option value="USD">USD</option>
    178           <option value="KES">KES</option>
    179           <option value="EUR">EUR</option>
    180           <option value="GBP">GBP</option>
    181         </select>
    182       <?php endif; ?>
    183 
    184       <?php if ($atts['country'] == "ZA") : ?>
    185         <select class="flw-form-select" id="flw-currency" required>
    186           <option value="ZAR">ZAR</option>
    187           <option value="NGN">NGN</option>
    188           <option value="UGX">UGX</option>
    189           <option value="USD">USD</option>
    190           <option value="KES">KES</option>
    191           <option value="EUR">EUR</option>
    192           <option value="GBP">GBP</option>
    193         </select>
    194       <?php endif; ?>
    195 
    196       <?php if ($atts['country'] == "US") : ?>
    197         <select class="flw-form-select" id="flw-currency" required>
    198           <option value="NGN">NGN</option>
    199           <option value="USD">USD</option>
    200           <option value="KES">KES</option>
    201           <option value="GHS">GHS</option>
    202           <option value="EUR">EUR</option>
    203           <option value="ZAR">ZAR</option>
    204           <option value="GBP">GBP</option>
    205         </select>
    206       <?php endif; ?>
    207 
    208         <?php
    209       } ?>
    210 
    211     <?php endif; ?>
    212     <br>
    213 
    214     <?php wp_nonce_field( 'flw-rave-pay-nonce', 'flw_sec_code' ); ?>
    215     <button value="submit" class='flw-pay-now-button' href='#'><?php _e( $btn_text, 'rave-pay' ) ?></button>
    216   </form>
     23<div class="flutterwave-payment-form">
     24    <span class="flw-error"></span>
     25    <form id="<?php echo esc_attr( $form_id ); ?>" class="flw-simple-pay-now-form" <?php echo esc_attr( $data_attr ); ?>>
     26        <div id="notice"></div>
     27        <?php echo wp_kses( $input_fields_html, $allowed_html_elements ); ?>
     28        <?php wp_nonce_field( 'flw-rave-pay-nonce', 'flw_sec_code' ); ?>
     29        <button value="submit" id="flw-pay-now-button" class='flw-pay-now-button'>
     30            <?php
     31            echo esc_attr( $btn_text );
     32            ?>
     33        </button>
     34    </form>
    21735</div>
     36<div id="flutterwave-overlay" style="display:none">
     37    <div id="flw-overlay-text">You would be redirected to the payment page soon. please do not close this page.</div>
     38</div>
  • rave-payment-forms/tags/1.0.6/views/payment-list-table.php

    r1862668 r2913754  
    11<?php
     2/**
     3 * Flutterwave Payments List Page
     4 *
     5 * @package Flutterwave\Payments\Views
     6 * @version 1.0.6
     7 */
    28
    3   global $payment_list;
     9$payment_list = FLW_Payment_List::get_instance();
    410
    511?>
    612
    713<div class="wrap">
    8   <h2>Rave Transactions</h2>
    9 
    10   <div id="poststuff">
    11     <div id="post-body" class="metabox-holder">
    12       <div id="post-body-content">
    13         <div class="meta-box-sortables ui-sortable">
    14           <form method="post">
    15             <?php
    16               $payment_list->prepare_items();
    17               $payment_list->display();
    18             ?>
    19           </form>
    20         </div>
    21       </div>
    22     </div>
    23     <br class="clear">
    24   </div>
     14    <h2>Flutterwave Transactions</h2>
     15    <div id="poststuff">
     16        <div id="post-body" class="metabox-holder">
     17            <div id="post-body-content">
     18                <div class="meta-box-sortables ui-sortable">
     19                    <form method="post">
     20                        <?php
     21                        $payment_list->prepare_items();
     22                        $payment_list->display();
     23                        ?>
     24                    </form>
     25                </div>
     26            </div>
     27        </div>
     28        <br class="clear">
     29    </div>
    2530</div>
  • rave-payment-forms/trunk/assets/css/flw.css

    r1862668 r2913754  
    1 .flw-simple-pay-now-form button {
    2   -moz-user-select: none;
    3   -ms-touch-action: manipulation;
    4   -ms-user-select: none;
    5   -webkit-user-select: none;
    6   background-color: #0a2740;
    7   border: 1px solid #142a3e;
    8   border-radius: 4px;
    9   color: #fff;
    10   cursor: pointer;
    11   display: inline-block;
    12   font-size: 14px;
    13   font-weight: 400;
    14   line-height: 1.42857143;
    15   margin: 0 0 6px;
    16   outline: none;
    17   padding: 6px 12px;
     1.flw-mssing-api-keys {
     2  color: #ff9b00;
     3  font-size: 1.5em;
     4  padding: .5em;
     5  background: #f4f6f8;
    186  text-align: center;
    19   touch-action: manipulation;
    20   user-select: none;
    21   vertical-align: middle;
    22   white-space: nowrap;
    237}
    248
    25 .flw-simple-pay-now-form button:hover {
    26   background-color: #3d5a73;
     9.flutterwave-overlay {
     10    position: fixed; /* Sit on top of the page content */
     11    width: 100%; /* Full width (cover the whole page) */
     12    height: 100%; /* Full height (cover the whole page) */
     13    top: 0;
     14    left: 0;
     15    right: 0;
     16    bottom: 0;
     17    background-color: rgba(0,0,0,0.5); /* Black background with opacity */
     18    z-index: 2; /* Specify a stack order in case you're using a different order for other elements */
     19    cursor: pointer; /* Add a pointer on hover */
    2720}
    2821
    29 .flw-simple-pay-now-form button:active {
    30   background-color: #0a2740;
     22.flw-overlay-text {
     23    position: absolute;
     24    top: 50%;
     25    left: 50%;
     26    font-size: 50px;
     27    color: white;
     28    transform: translate(-50%,-50%);
     29    -ms-transform: translate(-50%,-50%);
    3130}
    3231
    33 .flw-form-select {
    34     display: block;
    35     /* width: 100%; */
    36     background: #f2f2f2;
    37     height: 34px;
    38     padding: 6px 12px;
    39     font-size: 14px;
    40     line-height: 1.42857143;
    41     color: #555;
    42     background-color: #fff;
    43     background-image: none;
    44     border: 1px solid #ccc;
    45     border-radius: 4px;
    46     -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    47     box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    48     -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
    49     -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    50     transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
     32.flutterwave-payment-form, .flutterwave-donation-form {
     33    /*position: absolute;*/
     34    background: #FFFFFF;
     35    border: 1px solid rgba(18, 18, 44, 0.1);
     36    box-shadow: 2px 6px 20px rgba(18, 18, 44, 0.07);
     37    border-radius: 8px;
     38    padding: 30px;
     39    width: 400px;
     40    font-family: "Source Sans Pro","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
     41    margin: auto;
    5142}
    5243
    53 .flw-simple-pay-now-form input {
    54   border: 1px solid #777;
    55   border-color: #142a3e;
    56   border-radius: 4px;
    57   color: #777;
    58   display: inline-block;
    59   font-size: 14px;
    60   font-weight: 400;
    61   line-height: 1.42857143;
    62   margin: 0 0 6px;
    63   outline: none;
    64   padding: 6px 12px;
    65   vertical-align: middle;
    66   white-space: nowrap;
     44.flutterwave-payment-form > form, .flutterwave-donation-form > form {
     45    width: 100%;
     46    display: flex;
     47    flex-direction: column;
     48    justify-content: center;
    6749}
    6850
    69 .flw-simple-pay-now-form label {
    70   display: block;
    71   font-size: 15px;
    72   margin-bottom: 0;
     51.flutterwave-payment-form label, .flutterwave-donation-form label {
     52    /*font-family: Inter;*/
     53    font-size: 16px;
     54    font-weight: 400;
     55    line-height: 20px;
     56    letter-spacing: 0px;
     57    text-align: left;
    7358}
    7459
    75 .failed {
    76   color: #a00;
    77   font-size: 1.5em;
     60.flutterwave-payment-form ::placeholder, .flutterwave-donation-form ::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
     61    font-size: 16px;
     62    font-weight: 400;
     63    line-height: 20px;
     64    letter-spacing: 0px;
     65    text-align: left;
     66    opacity: 1; /* Firefox */
    7867}
    7968
    80 .successful {
    81   color: #0a0;
    82   font-size: 1.5em;
     69.flutterwave-payment-form :-ms-input-placeholder, .flutterwave-donation-form :-ms-input-placeholder { /* Internet Explorer 10-11 */
     70    font-size: 16px;
     71    font-weight: 400;
     72    line-height: 20px;
     73    letter-spacing: 0px;
     74    text-align: left;
    8375}
     76
     77.flutterwave-payment-form ::-ms-input-placeholder, .flutterwave-donation-form ::-ms-input-placeholder { /* Microsoft Edge */
     78    font-size: 16px;
     79    font-weight: 400;
     80    line-height: 20px;
     81    letter-spacing: 0px;
     82    text-align: left;
     83}
     84
     85.flutterwave-payment-form input[type="text"],
     86.flutterwave-payment-form input[type="number"],
     87.flutterwave-payment-form input[type="tel"],
     88.flutterwave-payment-form input[type="email"], .flutterwave-payment-form select {
     89    background: #FFFFFF;
     90    border: 1px solid #BDBDBD;
     91    /*border: 1px solid #F5A623;*/
     92    border-radius: 4px;
     93    padding: 15px;
     94    font-size: 16px;
     95    font-weight: 400;
     96    display: flex;
     97    justify-content: flex-start;
     98    margin-bottom: .9em;
     99}
     100
     101
     102#flw-first-name:hover, #flw-customer-email:hover, #flw-last-name:hover, #flw-amount:hover, #flw-full-name:hover, #flw-phone:hover{
     103    border: 1px solid #F5A623;
     104}
     105
     106.flutterwave-payment-form form #flw-pay-now-button, .flutterwave-donation-form form #flw-pay-now-button {
     107    background: #F5A623;
     108    display: flex;
     109    flex-direction: column;
     110    justify-content: center;
     111    align-items: center;
     112    height: 56px;
     113    color: #000000;
     114    border-radius: 4px;
     115}
     116
     117.flutterwave-payment-form form #flw-pay-now-button:disabled, .flutterwave-donation-form  form #flw-pay-now-button:disabled {
     118    background-color: rgba(239, 239, 239, 0.3);
     119    color: rgba(16, 16, 16, 0.3);
     120    border-color: rgba(118, 118, 118, 0.3);
     121}
     122
     123.flutterwave-payment-form form #flw-pay-now-button:hover, .flutterwave-donation-form form #flw-pay-now-button:hover {
     124    background: #6672c7;
     125    color: #FFFFFF;
     126}
     127
     128.flutterwave-payment-form form > div.flw_payment_overview {
     129    display: flex;
     130    flex-direction: row;
     131    justify-content: space-between;
     132    align-items: center;
     133}
     134
     135.flutterwave-payment-form form > div.flw_payment_overview > div.flw_total_label {
     136    font-size: 16px;
     137    font-weight: 400;
     138}
     139
     140.flutterwave-payment-form form > div.flw_payment_overview > div.flw_amount_to_pay {
     141    font-size: 22px;
     142    font-weight: 600;
     143    color: #35a162;
     144}
     145
     146.flutterwave-payment-form div, .flutterwave-donation-form div {
     147    display: block;
     148}
     149
     150/** Flutterwave Donation Page **/
     151
     152.flutterwave-donation-form input[type="text"],
     153.flutterwave-donation-form input[type="number"],
     154.flutterwave-donation-form input[type="email"], .flutterwave-donation-form select {
     155    background: #FFFFFF;
     156    border: 1px solid #BDBDBD;
     157    /*border: 1px solid #F5A623;*/
     158    border-radius: 4px;
     159    padding: 15px;
     160    font-size: 16px;
     161    font-weight: 400;
     162    display: flex;
     163    justify-content: flex-start;
     164}
  • rave-payment-forms/trunk/assets/js/flw-tinymce.js

    r1862668 r2913754  
    11'use strict';
    22
    3 (function() {
    4   tinymce.create('tinymce.plugins.flw_plugin', {
    5     init: function( editor, url ) {
    6       var assetsUrl = url.replace( '/js', '/' );
    7       editor.addCommand('flw_insert_shortcode', function() {
     3(function () {
     4    tinymce.create('tinymce.plugins.flw_plugin', {
     5        init: function (editor, url) {
     6            var assetsUrl = url.replace('/js', '/');
     7            editor.addCommand('flw_insert_shortcode', function () {
     8                var selected = tinymce.activeEditor.selection.getContent();
     9                var content = selected
     10                    ? '[flw-pay-button]' + selected + '[/flw-pay-button]'
     11                    : '[flw-pay-button]';
     12                tinymce.execCommand('mceInsertContent', false, content);
     13            });
    814
    9         var selected  = tinymce.activeEditor.selection.getContent();
    10         var content   = ( selected ) ? '[flw-pay-button]' + selected + '[/flw-pay-button]' : '[flw-pay-button]';
    11         tinymce.execCommand( 'mceInsertContent', false, content );
     15            editor.addButton('flw_button', {
     16                title: 'Insert Flutterwave payment shortcode',
     17                cmd: 'flw_insert_shortcode',
     18                image: assetsUrl + 'images/rave-icon.png',
     19            });
     20        },
     21    });
    1222
    13       });
    14 
    15       editor.addButton( 'flw_button', {
    16         title : 'Insert Rave payment shortcode',
    17         cmd   : 'flw_insert_shortcode',
    18         image : assetsUrl +'images/rave-icon.png',
    19       } );
    20     },
    21   });
    22 
    23   tinymce.PluginManager.add('flw_button', tinymce.plugins.flw_plugin);
    24 
     23    tinymce.PluginManager.add('flw_button', tinymce.plugins.flw_plugin);
    2524})();
  • rave-payment-forms/trunk/assets/js/flw.js

    r2549155 r2913754  
    1 'use strict';
     1jQuery(function ($) {
     2    /**
     3     * Builds config object to be sent to GetPaid
     4     *
     5     * @return object - The config object
     6     */
     7    const buildConfigObj = function (form) {
     8        let formData = $(form).data();
    29
    3 var form = jQuery( '.flw-simple-pay-now-form' ),
    4   redirectUrl;
     10        // Form Appearance settings.
     11        let should_split_name = formData.split_name?.replace(/"|'/g, '') == 1;
    512
    6 if ( form ) {
     13        let fullname = '';
     14        if (!should_split_name) {
     15            fullname = $(form).find('#flw-full-name').val();
     16        } else {
     17            let firstname =
     18                formData.firstname?.replace(/"|'/g, '') ||
     19                $(form).find('#flw-first-name').val();
     20            let lastname =
     21                formData.lastname?.replace(/"|'/g, '') ||
     22                $(form).find('#flw-last-name').val();
     23            fullname = firstname + ' ' + lastname;
     24        }
    725
    8   form.on( 'submit', function(evt) {
    9     evt.preventDefault();
    10     var config = buildConfigObj( this );
    11     processCheckout( config );
     26        let phone =
     27            formData.phone?.replace(/"|'/g, '') ||
     28            $(form).find('#flw-phone').val();
    1229
    13   } );
     30        let amount =
     31            formData.amount?.replace(/"|'/g, '') ||
     32            $(form).find('#flw-amount').val();
     33        let email =
     34            formData.email?.replace(/"|'/g, '') ||
     35            $(form).find('#flw-customer-email').val();
     36        let special_currency_value =
     37            formData.custom_currency?.replace(/"|'/g, '') ||
     38            $(form).find('#flw-currency').val();
     39        let formCurrency =
     40            formData.custom_currency?.replace(/"|'/g, '').length > 3
     41                ? $(form).find('#flw-currency').val()
     42                : special_currency_value;
    1443
    15 }
     44        let formId = form.attr('id');
     45        let txref = 'WP_' + formId.toUpperCase() + '_' + new Date().valueOf();
     46        let setCountry; //set country
    1647
     48        //switch the country with form currency provided
     49        setCountry = flw_pay_options.countries[formCurrency]
     50            ? flw_pay_options.countries[formCurrency]
     51            : flw_pay_options.countries['NGN'];
    1752
    18 /**
    19  * Builds config object to be sent to GetPaid
    20  *
    21  * @return object - The config object
    22  */
    23   var buildConfigObj = function( form ) {
    24   var formData = jQuery( form ).data();
    25   var amount = formData.amount || jQuery(form).find('#flw-amount').val();
    26   var email = formData.email || jQuery(form).find('#flw-customer-email').val();
    27   var firstname = formData.firstname || jQuery(form).find('#flw-first-name').val();
    28   var lastname = formData.lastname || jQuery(form).find('#flw-last-name').val();
    29   var formCurrency = formData.currency || jQuery(form).find('#flw-currency').val();
    30   var paymentplanID = jQuery(form).find('#flw-payment-plan').val();
    31   var txref   = 'WP_' + form.id.toUpperCase() + '_' + new Date().valueOf();
    32   var setCountry; //set country
     53        let redirect_url = window.location.origin;
    3354
     55        return {
     56            amount: amount,
     57            country: setCountry, //flw_pay_options.country,
     58            currency: formCurrency ?? flw_pay_options.currency,
     59            customer: {
     60                email,
     61                phone_number: phone ?? null,
     62                name: fullname,
     63            },
     64            payment_options: flw_pay_options.method,
     65            public_key: flw_pay_options.public_key,
     66            tx_ref: txref,
     67            customizations: {
     68                title: flw_pay_options.title,
     69                description: flw_pay_options.desc,
     70                logo: flw_pay_options.logo,
     71            },
     72            form_id: formId,
     73        };
     74    };
    3475
    35   if (formCurrency == '') {
    36     formCurrency = flw_rave_options.currency;
    37   }
     76    const processCheckout = function (opts, form) {
     77        let args = {
     78            action: 'get_payment_url',
     79            flw_sec_code: $(form).find('#flw_sec_code').val(),
     80        };
    3881
    39   //switch the country with form currency provided
    40   switch (formCurrency) {
    41     case 'KES':
    42       setCountry = 'KE';
    43       break;
    44     case 'GHS':
    45       setCountry = 'GH';
    46       break;
    47     case 'ZAR':
    48       setCountry = 'ZA';
    49       break;
    50     case 'UGX':
    51       setCountry = 'UG';
    52       break;
    53     default:
    54       setCountry = 'NG';
    55       break;
    56   }
     82        let dataObj = Object.assign({}, args, opts);
    5783
    58   return {
    59     amount: amount,
    60     country: setCountry, //flw_rave_options.country,
    61     currency: formCurrency,
    62     custom_description: flw_rave_options.desc,
    63     custom_logo: flw_rave_options.logo,
    64     custom_title: flw_rave_options.title,
    65     customer_email: email,
    66     customer_firstname: firstname,
    67     customer_lastname: lastname,
    68     payment_options: flw_rave_options.method,
    69     PBFPubKey: flw_rave_options.pbkey,
    70     txref: txref,
    71     payment_plan: paymentplanID,
    72     onclose: function() {
    73       redirectTo( redirectUrl );
    74     },
    75     callback: function(res) {
    76       sendPaymentRequestResponse( res, form );
    77     }
    78   };
     84        // console.log(dataObj);
    7985
    80 };
     86        $.post(flw_pay_options.cb_url, dataObj).success(function (data) {
     87            let response = data;
    8188
    82 var processCheckout = function(opts) {
    83   getpaidSetup( opts );
    84 };
     89            if (response.status === 'error') {
     90                $('.flw-error')
     91                    .html(response.message)
     92                    .attr('style', 'color:red');
     93            } else {
     94                let flw_overlay = $('#flutterwave-overlay');
     95                flw_overlay.addClass('flutterwave-overlay');
     96                $('#flw-overlay-text').addClass('flw-overlay-text');
     97                flw_overlay.show();
     98                redirectTo(response.url);
     99            }
     100        });
     101    };
    85102
    86 /**
    87  * Sends payment response from GetPaid to the process payment endpoint
    88  *
    89  * @param object Response object from GetPaid
    90  *
    91  * @return void
    92  */
    93 var sendPaymentRequestResponse = function( res, form ) {
    94   var args = {
    95     action: 'process_payment',
    96     flw_sec_code: jQuery( form ).find( '#flw_sec_code' ).val(),
    97   };
     103    /**
     104    * Sends payment response from GetPaid to the process payment endpoint
     105    *
     106    * @param object Response object from GetPaid
     107    *
     108    * @return void
     109    */
     110    const sendPaymentRequestResponse = function (res, form) {
     111        let args = {
     112            action: 'process_payment',
     113            flw_sec_code: $(form).find('#flw_sec_code').val(),
     114        };
    98115
    99   var dataObj = Object.assign( {}, args, res.tx );
     116        let dataObj = Object.assign({}, args, res.tx);
    100117
    101   jQuery
    102     .post( flw_rave_options.cb_url, dataObj )
    103     .success( function(data) {
    104       var response  = JSON.parse( data );
    105       redirectUrl   = response.redirect_url;
     118        $.post(flw_pay_options.cb_url, dataObj).success(function (data) {
     119            var response = JSON.parse(data);
     120            redirectUrl = response.redirect_url;
    106121
    107       if ( redirectUrl === '' ) {
     122            if (redirectUrl === '') {
     123                var responseMsg =
     124                    res.tx.paymentType === 'account'
     125                        ? res.tx.acctvalrespmsg
     126                        : res.tx.vbvrespmessage;
     127                $(form)
     128                    .find('#notice')
     129                    .text(responseMsg)
     130                    .removeClass(function () {
     131                        return $(form).find('#notice').attr('class');
     132                    })
     133                    .addClass(response.status);
     134            } else {
     135                setTimeout(redirectTo, 5000, redirectUrl);
     136            }
     137        });
     138    };
    108139
    109         var responseMsg  = ( res.tx.paymentType === 'account' ) ? res.tx.acctvalrespmsg  : res.tx.vbvrespmessage;
    110         jQuery( form )
    111           .find( '#notice' )
    112           .text( responseMsg )
    113           .removeClass( function() {
    114             return jQuery( form ).find( '#notice' ).attr( 'class' );
    115           } )
    116           .addClass( response.status );
     140    /**
     141     * Redirect to set url
     142     *
     143     * @param string url - The link to redirect to
     144     *
     145     * @return void
     146     */
     147    const redirectTo = function (url) {
     148        if (url) {
     149            location.href = url;
     150        }
     151    };
    117152
    118       } else {
     153    // for each form process payments
     154    $('.flw-simple-pay-now-form').each(function () {
     155        let form = $(this);
    119156
    120         setTimeout( redirectTo, 5000, redirectUrl );
     157        form.on('submit', function (event) {
     158            event.preventDefault(); // Prevent the default form submission
     159            let btn = form.find('button');
     160            //gray the button.
     161            btn.prop('disabled', true);
    121162
    122       }
     163            let inputs = form.find('input[type="*"]');
    123164
    124     } );
    125 };
     165            let isValid = true;
    126166
    127 /**
    128  * Redirect to set url
    129  *
    130  * @param string url - The link to redirect to
    131  *
    132  * @return void
    133  */
    134 var redirectTo = function( url ) {
     167            inputs.each(function () {
     168                let inputValue = $(this).val();
     169                if (
     170                    typeof inputValue === 'string' &&
     171                    inputValue.trim() === ''
     172                ) {
     173                    isValid = false;
     174                    $(this).attr('style', 'border-color: red');
     175                }
    135176
    136   if ( url ) {
    137     location.href = url;
    138   }
     177                if (
     178                    $(this).attr('type') === 'number' &&
     179                    parseInt(inputValue) === NaN
     180                ) {
     181                    isValid = false;
     182                    $(this).attr('style', 'border-color: red');
     183                }
     184            });
    139185
    140 };
     186            if (isValid) {
     187                let config = buildConfigObj(form);
     188                console.log(config);
     189                processCheckout(config, form);
     190            } else {
     191                //unblur button.
     192                btn.effect('shake', { times: 2 }, 300);
     193                btn.prop('disabled', false);
     194            }
     195        });
     196    });
     197});
  • rave-payment-forms/trunk/assets/js/paymentplan.js

    r2386443 r2913754  
     1const planName = jQuery('#plan-name');
     2const planAmount = jQuery('#plan-amount');
     3const planInterval = jQuery('#plan-interval');
     4const planDuration = jQuery('#plan-duration');
    15
    2     const planName = jQuery('#plan-name');
    3     const planAmount = jQuery('#plan-amount');
    4     const planInterval = jQuery('#plan-interval');
    5     const planDuration = jQuery('#plan-duration');
    6     const seckey = jQuery('#seckey');
    7    
    8    
     6jQuery(document).ready(function () {
     7    jQuery('#wpfooter').hide();
    98
    10     jQuery(document).ready(function(){
     9    jQuery('#createPlan-btn').on('click', (event) => {
     10        event.preventDefault();
    1111
    12         jQuery('#wpfooter').hide();
    13          
    14 
    15         jQuery('#createPlan-btn').on('click', (event) => {
    16                 event.preventDefault();
    17      
    18                 jQuery.post("https://api.ravepay.co/v2/gpx/paymentplans/create",
    19                 {
    20                       seckey: seckey.val(),
    21                       amount : planAmount.val(),
    22                       name : planName.val(),
    23                       interval : planInterval.val(),
    24                       duration : parseInt(planDuration.val()),
    25                 })
    26                 .done(function () {
    27                     location.reload();
    28  
    29                 })
    30 
    31         });
    32        
    33 
    34 
    35 
    36 
    37 
    38 
    39 
    40 
    41 
    42 
    43     });
    44 
    45 
    46 
    47 
    48 
    49 
    50      
     12        jQuery
     13            .post('#', {
     14                amount: planAmount.val(),
     15                name: planName.val(),
     16                interval: planInterval.val(),
     17                duration: parseInt(planDuration.val()),
     18            })
     19            .done(function () {
     20                location.reload();
     21            });
     22    });
     23});
  • rave-payment-forms/trunk/readme.md

    r2749184 r2913754  
    7676## Support
    7777
    78 For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:developers@flutterwavego.com) or on [slack](https://bit.ly/34Vkzcg). 
     78For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:developers@flutterwavego.com) or on [slack](https://bit.ly/34Vkzcg).
    7979
    80 You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
     80You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
    8181
    8282### Configure the plugin
     
    132132```
    133133[flw-pay-button amount="1290" email="customer@email.com" ]Button Text[/flw-pay-button]
     134
     135or
     136
     137[flw-pay-button amount="1290" email="customer@email.com" split_name=1 ]Button Text[/flw-pay-button]
     138
     139
     140```
     141
     142With custom and excluded fields.
     143```
     144[flw-pay-form amount=1234 fullname="Abraham Olaobaju" currency="USD,UGX,NGN" custom_fields='age:number,color:select|black:#000|white:#fff' exclude="phone"]
     145
     146```
     147
     148With order rearranged.
     149```
     150[flw-pay-form amount=1234 fullname="Abraham Olaobaju" currency="USD,UGX,NGN" order="currency,fullname,amount,phone,email"]
     151```
     152
     153Donation Form.
     154```
     155[flw-donation-form]
    134156```
    135157
     
    139161
    140162* On Visual Composer __Add Element__ dialog, click on "__Rave Forms__" and select the type of form you want to include on your page.
    141 ![Visual Composer Screenshot 1](https://cloud.githubusercontent.com/assets/8383666/21606192/20887a10-d1ae-11e6-85f7-6f8771cb8688.png)
     163  ![Visual Composer Screenshot 1](https://cloud.githubusercontent.com/assets/8383666/21606192/20887a10-d1ae-11e6-85f7-6f8771cb8688.png)
    142164###
    143165
    144166* On the "Form Settings" dialog, fill in the form attributes and click "__Save Changes__".
    145 ![Visual Composer Screenshot 2](https://cloud.githubusercontent.com/assets/8383666/21606210/381994b6-d1ae-11e6-8731-810be5550f55.png)
     167  ![Visual Composer Screenshot 2](https://cloud.githubusercontent.com/assets/8383666/21606210/381994b6-d1ae-11e6-8731-810be5550f55.png)
    146168###
    147169
    148170* Payment Form successfully added to the page.
    149 ![Visual Composer Screenshot 3](https://cloud.githubusercontent.com/assets/8383666/21606217/46200ed2-d1ae-11e6-812b-7d5a2c1f6b43.png)
     171  ![Visual Composer Screenshot 3](https://cloud.githubusercontent.com/assets/8383666/21606217/46200ed2-d1ae-11e6-812b-7d5a2c1f6b43.png)
    150172###
    151173
  • rave-payment-forms/trunk/readme.txt

    r2908142 r2913754  
    33Tags: rave, payment form, payment gateway, bank account, credit card, debit card, nigeria, kenya, international, mastercard, visa, flutterwave
    44Donate link: http://rave.flutterwave.com/
    5 Requires at least: 6.0
    6 Tested up to: 6.2
    7 Requires PHP: 5.4
     5Requires at least: 4.4
     6Tested up to: 6.0
     7Requires PHP: 7.4
    88Stable tag: 1.0.6
    99License: MIT
     
    5050For FTP manual installation, [check here](http://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation).
    5151
    52 = Configuration options = 
     52= Configuration options =
    5353
    5454* Pay Button Public Key (live/Test) - Enter your public key which can be retrieved from Settings > API on your Rave account dashboard.
     
    119119* b. Visual Composer
    120120The shortcode can be added via Visual Composer elements.
    121 On Visual Composer Add Element dialog, click on "Rave Forms" and select the type of form you want to include on your page. 
     121On Visual Composer Add Element dialog, click on "Rave Forms" and select the type of form you want to include on your page.
    122122
    123123
    124124On the "Form Settings" dialog, fill in the form attributes and click "Save Changes".
    125125
    126 Payment Form successfully added to the page. 
     126Payment Form successfully added to the page.
    127127
    128128= Best Practices =
     
    141141= Support =
    142142
    143 For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:developers@flutterwavego.com) or on [slack](https://bit.ly/34Vkzcg). 
     143For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:developers@flutterwavego.com) or on [slack](https://bit.ly/34Vkzcg).
    144144
    145 You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
     145You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.
    146146
    147147= Contribution guidelines =
     
    149149We love to get your input. Read more about our community contribution guidelines [here](/CONTRIBUTING.md)
    150150
    151 = License = 
     151= License =
    152152
    153153By contributing to the Flutterwave WooCommerce, you agree that your contributions will be licensed under its [MIT license](/LICENSE).
     
    1571571. To configure the plugin, go to Rave > Settings from the left menu.
    1581582. On Visual Composer Add Element dialog, click on "Rave Forms" and select the type of form you want to include on your page.
    159 3. On the "Form Settings" dialog, fill in the form attributes and click "Save Changes". 
     1593. On the "Form Settings" dialog, fill in the form attributes and click "Save Changes".
    1601604. Payment Form successfully added to the page.
    1611615. All the payments made through the forms to Rave can be accessed on Rave > Transactions page.
  • rave-payment-forms/trunk/views/admin-settings-page.php

    r2589854 r2913754  
    11<?php
    2 
    3   if ( ! defined( 'ABSPATH' ) ) { exit; }
     2/**
     3 * Flutterwave Payments Settings Page
     4 *
     5 * @package Flutterwave\Payments\Views
     6 * @version 1.0.6
     7 */
     8
     9defined( 'ABSPATH' ) || exit;
     10
     11$settings = FLW_Admin_Settings::get_instance();
    412
    513?>
    6 <?php global $admin_settings; ?>
    714
    815  <div class="wrap">
    9     <h1>Rave Payment Forms Settings</h1>
    10     <form id="rave-pay" action="options.php" method="post" enctype="multipart/form-data">
    11       <?php settings_fields( 'flw-rave-settings-group' ); ?>
    12       <?php do_settings_sections( 'flw-rave-settings-group' ); ?>
    13       <table class="form-table">
    14         <tbody>
    15 
    16           <!-- Public Key -->
    17           <tr valign="top">
    18             <th scope="row">
    19               <label for="flw_rave_options[public_key]"><?php _e( 'Pay Button Public Key', 'rave-pay' ); ?></label>
    20             </th>
    21             <td class="forminp forminp-text">
    22               <input class="regular-text code" type="text" name="flw_rave_options[public_key]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'public_key' ) ); ?>" />
    23               <p class="description">Your Pay Button public key</p>
    24             </td>
    25           </tr>
    26           <!-- Secret Key -->
    27           <tr valign="top">
    28             <th scope="row">
    29               <label for="flw_rave_options[secret_key]"><?php _e( 'Pay Button Secret Key', 'rave-pay' ); ?></label>
    30             </th>
    31             <td class="forminp forminp-text">
    32               <input class="regular-text code" type="text" name="flw_rave_options[secret_key]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'secret_key' ) ); ?>" />
    33               <p class="description">Your Pay Button secret key</p>
    34             </td>
    35           </tr>
    36 
    37           <!-- Switch to Live -->
    38           <tr valign="top">
    39             <th scope="row">
    40               <label for="flw_rave_options[go_live]"><?php _e( 'Go Live', 'rave-pay' ); ?></label>
    41             </th>
    42             <td class="forminp forminp-checkbox">
    43               <fieldset>
    44                 <?php $go_live = esc_attr( $admin_settings->get_option_value( 'go_live' ) ); ?>
    45                 <label>
    46                   <input type="checkbox" name="flw_rave_options[go_live]" <?php checked( $go_live, 'yes' ); ?> value="yes" />
    47                   <?php _e( 'Switch to live account', 'rave-pay' ); ?>
    48                 </label>
    49               </fieldset>
    50             </td>
    51           </tr>
    52           <!-- Method -->
    53           <tr valign="top">
    54             <th scope="row">
    55               <label for="flw_rave_options[method]"><?php _e( 'Payment Method', 'rave-pay' ); ?></label>
    56             </th>
    57             <td class="forminp forminp-text">
    58               <select class="regular-text code" name="flw_rave_options[method]">
    59                 <?php $method = esc_attr( $admin_settings->get_option_value( 'method' ) ); ?>
    60                 <option value="both" <?php selected( $method, 'both' ) ?>>Card and Account</option>
    61                 <option value="card" <?php selected( $method, 'card' ) ?>>Card Only</option>
    62                 <option value="account" <?php selected( $method, 'account' ) ?>>Account Only</option>
    63                 <option value="barter" <?php selected( $method, 'barter' ) ?>>Barter Only</option>
    64                 <option value="mpesa" <?php selected( $method, 'mpesa' ) ?>>Mpesa Only (for KES)</option>
    65                 <option value="ussd" <?php selected( $method, 'ussd' ) ?>>USSD Only</option>
    66                 <option value="mobilemoneyuganda" <?php selected( $method, 'mobilemoneyuganda' ) ?>>MobileMoney UGX Only</option>
    67                 <option value="mobilemoneyrwanda" <?php selected( $method, 'mobilemoneyrwanda' ) ?>>MobileMoney RWD Only</option>
    68                 <option value="mobilemoneyzambia" <?php selected( $method, 'mobilemoneyzambia' ) ?>>MobileMoney ZMB Only</option>
    69                 <option value="mobilemoneytanzania" <?php selected( $method, 'mobilemoneytanzania' ) ?>>MobileMoney TZS Only</option>
    70               </select>
    71               <p class="description">(Optional) default: Card and Account</p>
    72             </td>
    73           </tr>
    74 
    75           <!-- Modal title -->
    76           <tr valign="top">
    77             <th scope="row">
    78               <label for="flw_rave_options[modal_title]"><?php _e( 'Modal Title', 'rave-pay' ); ?></label>
    79             </th>
    80             <td class="forminp forminp-text">
    81               <input class="regular-text code" type="text" name="flw_rave_options[modal_title]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'modal_title' ) ); ?>" />
    82               <p class="description">(Optional) default: FLW PAY</p>
    83             </td>
    84           </tr>
    85           <!-- Modal Description -->
    86           <tr valign="top">
    87             <th scope="row">
    88               <label for="flw_rave_options[modal_desc]"><?php _e( 'Modal Description', 'rave-pay' ); ?></label>
    89             </th>
    90             <td class="forminp forminp-text">
    91               <input class="regular-text code" type="text" name="flw_rave_options[modal_desc]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'modal_desc' ) ); ?>" />
    92               <p class="description">(Optional) default: FLW PAY MODAL</p>
    93             </td>
    94           </tr>
    95           <!-- Modal Logo -->
    96           <tr valign="top">
    97             <th scope="row">
    98               <label for="flw_rave_options[modal_logo]"><?php _e( 'Modal Logo', 'rave-pay' ); ?></label>
    99             </th>
    100             <td class="forminp forminp-text">
    101               <input class="regular-text code" type="text" name="flw_rave_options[modal_logo]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'modal_logo' ) ); ?>" />
    102               <p class="description">(Optional) - Full URL (with 'http') to the custom logo. default: Rave logo</p>
    103             </td>
    104           </tr>
    105           <!-- Successful Redirect URL -->
    106           <tr valign="top">
    107             <th scope="row">
    108               <label for="flw_rave_options[success_redirect_url]"><?php _e( 'Success Redirect URL', 'rave-pay' ); ?></label>
    109             </th>
    110             <td class="forminp forminp-text">
    111               <input class="regular-text code" type="text" name="flw_rave_options[success_redirect_url]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'success_redirect_url' ) ); ?>" />
    112               <p class="description">(Optional) Full URL (with 'http') to redirect to for successful transactions. default: ""</p>
    113             </td>
    114           </tr>
    115           <!-- Failed Redirect URL -->
    116           <tr valign="top">
    117             <th scope="row">
    118               <label for="flw_rave_options[failed_redirect_url]"><?php _e( 'Failed Redirect URL', 'rave-pay' ); ?></label>
    119             </th>
    120             <td class="forminp forminp-text">
    121               <input class="regular-text code" type="text" name="flw_rave_options[failed_redirect_url]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'failed_redirect_url' ) ); ?>" />
    122               <p class="description">(Optional) Full URL (with 'http') to redirect to for failed transactions. default: ""</p>
    123             </td>
    124           </tr>
    125           <!-- Pay Button Text -->
    126           <tr valign="top">
    127             <th scope="row">
    128               <label for="flw_rave_options[btn_text]"><?php _e( 'Pay Button Text', 'rave-pay' ); ?></label>
    129             </th>
    130             <td class="forminp forminp-text">
    131               <input class="regular-text code" type="text" name="flw_rave_options[btn_text]" value="<?php echo esc_attr( $admin_settings->get_option_value( 'btn_text' ) ); ?>" />
    132               <p class="description">(Optional) default: PAY NOW</p>
    133             </td>
    134           </tr>
    135           <!-- Currency -->
    136           <tr valign="top">
    137             <th scope="row">
    138               <label for="flw_rave_options[currency]"><?php _e( 'Charge Currency', 'rave-pay' ); ?></label>
    139             </th>
    140             <td class="forminp forminp-text">
    141               <select class="regular-text code" name="flw_rave_options[currency]">
    142                 <?php $currency = esc_attr( $admin_settings->get_option_value( 'currency' ) ); ?>
    143                 <option value="" <?php selected($currency, '') ?>>Any (Let Customer decide or use Shortcode)</option>
    144                 <option value="NGN" <?php selected($currency, 'NGN') ?>>NGN</option>
    145                 <option value="GHS" <?php selected( $currency, 'GHS' ) ?>>GHS</option>
    146                 <option value="KES" <?php selected( $currency, 'KES' ) ?>>KES</option>
    147                 <option value="USD" <?php selected( $currency, 'USD' ) ?>>USD</option>
    148                 <option value="GBP" <?php selected( $currency, 'GBP' ) ?>>GBP</option>
    149                 <option value="EUR" <?php selected($currency, 'EUR') ?>>EUR</option>
    150                 <option value="ZAR" <?php selected($currency, 'ZAR') ?>>ZAR</option>
    151                 <option value="UGX" <?php selected($currency, 'UGX') ?>>UGX</option>
    152                 <option value="RWF" <?php selected($currency, 'RWF') ?>>RWF</option>
    153                 <option value="TZS" <?php selected($currency, 'TZS') ?>>TZS</option>
    154                 <option value="ZMW" <?php selected($currency, 'ZMW') ?>>ZMW</option>
    155                 <option value="XOF" <?php selected($currency, 'XOF') ?>>XOF</option>
    156                 <option value="XAF" <?php selected($currency, 'XAF') ?>>XAF</option>
    157               </select>
    158               <p class="description">(Optional) default: NGN</p>
    159             </td>
    160           </tr>
    161           <!-- Country -->
    162           <tr valign="top">
    163             <th scope="row">
    164               <label for="flw_rave_options[country]"><?php _e( 'Charge Country', 'rave-pay' ); ?></label>
    165             </th>
    166             <td class="forminp forminp-text">
    167               <select class="regular-text code" name="flw_rave_options[country]">
    168                 <?php $country = esc_attr( $admin_settings->get_option_value( 'country' ) ); ?>
    169                 <option value="NG" <?php selected( $country, 'NG' ) ?>>NG: Nigeria</option>
    170                 <option value="GH" <?php selected( $country, 'GH' ) ?>>GH: Ghana</option>
    171                 <option value="KE" <?php selected($country, 'KE') ?>>KE: Kenya</option>
    172                 <option value="UG" <?php selected($country, 'UG') ?>>UG: Uganda</option>
    173                 <option value="ZA" <?php selected($country, 'ZA') ?>>ZA: South Africa</option>
    174                 <option value="US" <?php selected( $country, 'US' ) ?>>All (Worldwide)</option>
    175               </select>
    176               <p class="description">(Optional) default: NG</p>
    177             </td>
    178           </tr>
    179 
    180           <!-- Styling -->
    181           <tr valign="top">
    182             <th scope="row">
    183               <label for="flw_rave_options[theme_style]"><?php _e( 'Form Style', 'rave-pay' ); ?></label>
    184             </th>
    185             <td class="forminp forminp-checkbox">
    186               <fieldset>
    187                 <?php $theme_style = esc_attr( $admin_settings->get_option_value( 'theme_style' ) ); ?>
    188                 <label>
    189                   <input type="checkbox" name="flw_rave_options[theme_style]" <?php checked( $theme_style, 'yes' ); ?> value="yes" />
    190                   <?php _e( 'Use default theme style', 'rave-pay' ); ?>
    191                 </label>
    192                 <p class="description">Override the form style and use the default theme's style</p>
    193               </fieldset>
    194             </td>
    195           </tr>
    196 
    197         </tbody>
    198       </table>
    199       <?php submit_button(); ?>
    200     </form>
     16    <h1>Flutterwave Settings</h1>
     17    <form id="rave-pay" action="options.php" method="post" enctype="multipart/form-data">
     18      <?php settings_fields( 'flw-rave-settings-group' ); ?>
     19      <?php do_settings_sections( 'flw-rave-settings-group' ); ?>
     20      <table class="form-table">
     21        <tbody>
     22
     23          <!-- Public Key -->
     24          <tr valign="top">
     25            <th scope="row">
     26              <label for="flw_rave_options[public_key]"><?php esc_attr_e( 'Pay Button Public Key', 'flutterwave-payments' ); ?></label>
     27            </th>
     28            <td class="forminp forminp-text">
     29              <input class="regular-text code" type="text" name="flw_rave_options[public_key]" value="<?php echo esc_attr( $settings->get_option_value( 'public_key' ) ); ?>" />
     30              <p class="description">Flutterwave public key</p>
     31            </td>
     32          </tr>
     33          <!-- Secret Key -->
     34          <tr valign="top">
     35            <th scope="row">
     36              <label for="flw_rave_options[secret_key]"><?php esc_attr_e( 'Pay Button Secret Key', 'flutterwave-payments' ); ?></label>
     37            </th>
     38            <td class="forminp forminp-text">
     39              <input class="regular-text code" type="text" name="flw_rave_options[secret_key]" value="<?php echo esc_attr( $settings->get_option_value( 'secret_key' ) ); ?>" />
     40              <p class="description">Flutterwave secret key</p>
     41            </td>
     42          </tr>
     43
     44        <!-- Secret Key -->
     45        <tr valign="top">
     46            <th scope="row">
     47              <label for="flw_rave_options[secret_hash]"><?php esc_attr_e( 'Secret Hash', 'flutterwave-payments' ); ?></label>
     48            </th>
     49            <td class="forminp forminp-text">
     50              <input class="regular-text code" type="text" name="flw_rave_options[secret_hash]" value="<?php echo esc_attr( $settings->get_option_value( 'secret_hash' ) ); ?>" />
     51              <p class="description">Flutterwave secret Hash</p>
     52            </td>
     53          </tr>
     54
     55        <!-- Webhook -->
     56        <tr valign="top">
     57            <th scope="row">
     58              <label><?php esc_attr_e( 'Webhook URL', 'flutterwave-payments' ); ?></label>
     59            </th>
     60            <td class="forminp forminp-text">
     61              <p class="description">
     62              <?php esc_attr_e( 'Please copy this webhook URL and paste on the webhook section on your dashboard', 'flutterwave-payments' ); ?><strong style="color: red"><pre><code><?php echo esc_attr( get_site_url() ) . '/wp-json/flutterwave/v1/webhook'; ?></code></pre></strong><a href="https://app.flutterwave.com/dashboard/settings/webhooks" target="_blank">Flutterwave Account</a>
     63              </p>
     64            </td>
     65          </tr>
     66
     67          <!-- Switch to Live -->
     68          <tr valign="top">
     69            <th scope="row">
     70              <label for="flw_rave_options[go_live]"><?php esc_attr_e( 'Go Live', 'flutterwave-payments' ); ?></label>
     71            </th>
     72            <td class="forminp forminp-checkbox">
     73              <fieldset>
     74                <?php $go_live = esc_attr( $settings->get_option_value( 'go_live' ) ); ?>
     75                <label>
     76                  <input type="checkbox" name="flw_rave_options[go_live]" <?php checked( $go_live, 'yes' ); ?> value="yes" />
     77                  <?php esc_attr_e( 'Switch to live account', 'flutterwave-payments' ); ?>
     78                </label>
     79              </fieldset>
     80            </td>
     81          </tr>
     82          <!-- Method -->
     83          <tr valign="top">
     84            <th scope="row">
     85              <label for="flw_rave_options[method]"><?php esc_attr_e( 'Payment Method', 'flutterwave-payments' ); ?></label>
     86            </th>
     87            <td class="forminp forminp-text">
     88              <select class="regular-text code" name="flw_rave_options[method]">
     89                <?php $method = esc_attr( $settings->get_option_value( 'method' ) ); ?>
     90                <option value="all" <?php selected( $method, 'all' ); ?>>All Payment Options</option>
     91                <option value="both" <?php selected( $method, 'both' ); ?>>Card and Account</option>
     92                <option value="card" <?php selected( $method, 'card' ); ?>>Card Only</option>
     93                <option value="account" <?php selected( $method, 'account' ); ?>>Account Only</option>
     94              </select>
     95              <p class="description">(Optional) default: All Payment Options</p>
     96            </td>
     97          </tr>
     98
     99          <!-- Modal title -->
     100          <tr valign="top">
     101            <th scope="row">
     102              <label for="flw_rave_options[modal_title]"><?php esc_attr_e( 'Modal Title', 'flutterwave-payments' ); ?></label>
     103            </th>
     104            <td class="forminp forminp-text">
     105              <input class="regular-text code" type="text" name="flw_rave_options[modal_title]" value="<?php echo esc_attr( $settings->get_option_value( 'modal_title' ) ); ?>" />
     106              <p class="description">(Optional) default: FLW PAY</p>
     107            </td>
     108          </tr>
     109          <!-- Modal Description -->
     110          <tr valign="top">
     111            <th scope="row">
     112              <label for="flw_rave_options[modal_desc]"><?php esc_attr_e( 'Modal Description', 'flutterwave-payments' ); ?></label>
     113            </th>
     114            <td class="forminp forminp-text">
     115              <input class="regular-text code" type="text" name="flw_rave_options[modal_desc]" value="<?php echo esc_attr( $settings->get_option_value( 'modal_desc' ) ); ?>" />
     116              <p class="description">(Optional) default: FLW PAY MODAL</p>
     117            </td>
     118          </tr>
     119          <!-- Modal Logo -->
     120          <tr valign="top">
     121            <th scope="row">
     122              <label for="flw_rave_options[modal_logo]"><?php esc_attr_e( 'Modal Logo', 'flutterwave-payments' ); ?></label>
     123            </th>
     124            <td class="forminp forminp-text">
     125              <input class="regular-text code" type="text" name="flw_rave_options[modal_logo]" value="<?php echo esc_attr( $settings->get_option_value( 'modal_logo' ) ); ?>" />
     126              <p class="description">(Optional) - Full URL (with 'https') to the custom logo. default: Flutterwave logo</p>
     127            </td>
     128          </tr>
     129          <!--  Donation Title -->
     130          <tr valign="top">
     131            <th scope="row">
     132              <label for="flw_rave_options[donation_title]"><?php esc_attr_e( 'Donation Title', 'flutterwave-payments' ); ?></label>
     133            </th>
     134            <td class="forminp forminp-text">
     135              <input class="regular-text code" type="text" name="flw_rave_options[donation_title]" value="<?php echo esc_attr( $settings->get_option_value( 'donation_title' ) ); ?>" />
     136              <p class="description">(Optional) default: Donation Title</p>
     137            </td>
     138          </tr>
     139          <!--  Donation Description -->
     140          <tr valign="top">
     141            <th scope="row">
     142              <label for="flw_rave_options[donation_desc]"><?php esc_attr_e( 'Donation Description', 'flutterwave-payments' ); ?></label>
     143            </th>
     144            <td class="forminp forminp-text">
     145              <input class="regular-text code" type="text" name="flw_rave_options[donation_desc]" value="<?php echo esc_attr( $settings->get_option_value( 'donation_desc' ) ); ?>" />
     146              <p class="description">(Optional) default: Donation Desc</p>
     147            </td>
     148          </tr>
     149          <!--  Donation Phone -->
     150          <tr valign="top">
     151            <th scope="row">
     152              <label for="flw_rave_options[donation_phone]"><?php esc_attr_e( 'Donation Phone', 'flutterwave-payments' ); ?></label>
     153            </th>
     154            <td class="forminp forminp-text">
     155              <input class="regular-text code" type="text" name="flw_rave_options[donation_phone]" value="<?php echo esc_attr( $settings->get_option_value( 'donation_phone' ) ); ?>" />
     156              <p class="description">(Optional) default: 08000000000</p>
     157            </td>
     158          </tr>
     159         <!-- Pending Redirect URL -->
     160          <tr valign="top">
     161            <th scope="row">
     162              <label for="flw_rave_options[pending_redirect_url]"><?php esc_attr_e( 'Pending Redirect URL', 'flutterwave-payments' ); ?></label>
     163            </th>
     164            <td class="forminp forminp-text">
     165              <input class="regular-text code" type="text" name="flw_rave_options[pending_redirect_url]" value="<?php echo esc_attr( $settings->get_option_value( 'pending_redirect_url' ) ); ?>" />
     166              <p class="description">(Optional) Full URL (with 'http') to redirect to for pending transactions. default: ""</p>
     167            </td>
     168          </tr>
     169          <!-- Successful Redirect URL -->
     170          <tr valign="top">
     171            <th scope="row">
     172              <label for="flw_rave_options[success_redirect_url]"><?php esc_attr_e( 'Success Redirect URL', 'flutterwave-payments' ); ?></label>
     173            </th>
     174            <td class="forminp forminp-text">
     175              <input class="regular-text code" type="text" name="flw_rave_options[success_redirect_url]" value="<?php echo esc_attr( $settings->get_option_value( 'success_redirect_url' ) ); ?>" />
     176              <p class="description">(Optional) Full URL (with 'http') to redirect to for successful transactions. default: ""</p>
     177            </td>
     178          </tr>
     179          <!-- Failed Redirect URL -->
     180          <tr valign="top">
     181            <th scope="row">
     182              <label for="flw_rave_options[failed_redirect_url]"><?php esc_attr_e( 'Failed Redirect URL', 'flutterwave-payments' ); ?></label>
     183            </th>
     184            <td class="forminp forminp-text">
     185              <input class="regular-text code" type="text" name="flw_rave_options[failed_redirect_url]" value="<?php echo esc_attr( $settings->get_option_value( 'failed_redirect_url' ) ); ?>" />
     186              <p class="description">(Optional) Full URL (with 'http') to redirect to for failed transactions. default: ""</p>
     187            </td>
     188          </tr>
     189          <!-- Failed Redirect URL -->
     190          <tr valign="top">
     191            <th scope="row">
     192              <label for="flw_rave_options[donation_payment_plan]"><?php esc_attr_e( 'Donation Plan Id', 'flutterwave-payments' ); ?></label>
     193            </th>
     194            <td class="forminp forminp-text">
     195              <input class="regular-text code" type="text" name="flw_rave_options[donation_payment_plan]" value="<?php echo esc_attr( $settings->get_option_value( 'donation_payment_plan' ) ); ?>" />
     196            </td>
     197          </tr>
     198          <!-- Pay Button Text -->
     199          <tr valign="top">
     200            <th scope="row">
     201              <label for="flw_rave_options[btn_text]"><?php esc_attr_e( 'Pay Button Text', 'flutterwave-payments' ); ?></label>
     202            </th>
     203            <td class="forminp forminp-text">
     204              <input class="regular-text code" type="text" name="flw_rave_options[btn_text]" value="<?php echo esc_attr( $settings->get_option_value( 'btn_text' ) ); ?>" />
     205              <p class="description">(Optional) default: PAY NOW</p>
     206            </td>
     207          </tr>
     208          <!-- Currency -->
     209          <tr valign="top">
     210            <th scope="row">
     211              <label for="flw_rave_options[currency]"><?php esc_attr_e( 'Charge Currency', 'flutterwave-payments' ); ?></label>
     212            </th>
     213            <td class="forminp forminp-text">
     214              <select class="regular-text code" name="flw_rave_options[currency]">
     215                <?php $currency = esc_attr( $settings->get_option_value( 'currency' ) ); ?>
     216                <option value="any" <?php selected( $currency, 'any' ); ?>>Any (Let Customer decide or use Shortcode)</option>
     217                <option value="NGN" <?php selected( $currency, 'NGN' ); ?>>NGN</option>
     218                <option value="GHS" <?php selected( $currency, 'GHS' ); ?>>GHS</option>
     219                <option value="KES" <?php selected( $currency, 'KES' ); ?>>KES</option>
     220                <option value="USD" <?php selected( $currency, 'USD' ); ?>>USD</option>
     221                <option value="GBP" <?php selected( $currency, 'GBP' ); ?>>GBP</option>
     222                <option value="EUR" <?php selected( $currency, 'EUR' ); ?>>EUR</option>
     223                <option value="ZAR" <?php selected( $currency, 'ZAR' ); ?>>ZAR</option>
     224              </select>
     225              <p class="description">(Optional) default: NGN</p>
     226            </td>
     227          </tr>
     228          <!-- Country -->
     229          <tr valign="top">
     230            <th scope="row">
     231              <label for="flw_rave_options[country]"><?php esc_attr_e( 'Charge Country', 'flutterwave-payments' ); ?></label>
     232            </th>
     233            <td class="forminp forminp-text">
     234              <select class="regular-text code" name="flw_rave_options[country]">
     235                <?php $country = esc_attr( $settings->get_option_value( 'country' ) ); ?>
     236                <option value="NG" <?php selected( $country, 'NG' ); ?>>NG: Nigeria</option>
     237                <option value="GH" <?php selected( $country, 'GH' ); ?>>GH: Ghana</option>
     238                <option value="KE" <?php selected( $country, 'KE' ); ?>>KE: Kenya</option>
     239                <option value="ZA" <?php selected( $country, 'ZA' ); ?>>ZA: South Africa</option>
     240                <option value="US" <?php selected( $country, 'US' ); ?>>All (Worldwide)</option>
     241              </select>
     242              <p class="description">(Optional) default: NG</p>
     243            </td>
     244          </tr>
     245
     246          <!-- Styling -->
     247          <tr valign="top">
     248            <th scope="row">
     249              <label for="flw_rave_options[theme_style]"><?php esc_attr_e( 'Form Style', 'flutterwave-payments' ); ?></label>
     250            </th>
     251            <td class="forminp forminp-checkbox">
     252              <fieldset>
     253                <?php $theme_style = esc_attr( $settings->get_option_value( 'theme_style' ) ); ?>
     254                <label>
     255                  <input type="checkbox" name="flw_rave_options[theme_style]" <?php checked( $theme_style, 'yes' ); ?> value="yes" />
     256                  <?php esc_attr_e( 'Use default theme style', 'flutterwave-payments' ); ?>
     257                </label>
     258                <p class="description">Override the form style and use the default theme's style</p>
     259              </fieldset>
     260            </td>
     261          </tr>
     262
     263        </tbody>
     264      </table>
     265      <?php submit_button(); ?>
     266    </form>
    201267
    202268  </div>
  • rave-payment-forms/trunk/views/pay-now-form.php

    r2589854 r2913754  
    11<?php
     2/**
     3 * Flutterwave Payments Form Page
     4 *
     5 * @package Flutterwave\Payments\Views
     6 * @version 1.0.6
     7 */
    28
    3   if ( ! defined( 'ABSPATH' ) ) { exit; }
     9defined( 'ABSPATH' ) || exit;
    410
    5   global $payment_forms;
     11$form_id = Flutterwave_Payments::gen_rand_string();
    612
    7   $form_id = FLW_Rave_Pay::gen_rand_string();
    8 
    9   if (!empty($atts['custom_currency'])) {
    10     if (preg_match('/^[a-z\d]* [a-z\d]*$/', $atts['custom_currency'])) {
    11       $currencies = explode(", ", $atts['custom_currency']);
    12     } else{
    13       $currencies = explode(",", $atts['custom_currency']);
    14     }
    15   }
    16 
    17 
    18 
    19 
    20   // print_r($atts);
    21   // exit();
    22 
    23 
     13if ( ! empty( $atts['custom_currency'] ) ) {
     14    if ( preg_match( '/^[a-z\d]* [a-z\d]*$/', $atts['custom_currency'] ) ) {
     15        $currencies = explode( ', ', $atts['custom_currency'] );
     16    } else {
     17        $currencies = explode( ',', $atts['custom_currency'] );
     18    }
     19}
    2420
    2521?>
    2622
    27 <div>
    28   <form id="<?php echo $form_id ?>" class="flw-simple-pay-now-form" <?php echo $data_attr; ?> >
    29     <div id="notice"></div>
    30     <?php if ( empty( $atts['email'] ) ) : ?>
    31 
    32       <label class="pay-now"><?php _e( 'Email', 'rave-pay' ) ?></label>
    33       <input class="flw-form-input-text" id="flw-customer-email" type="email" placeholder="<?php _e( 'Email', 'rave-pay' ) ?>" required /><br>
    34 
    35     <?php endif; ?>
    36 
    37     <?php if ( empty( $atts['firstname'] ) ) : ?>
    38 
    39       <label class="pay-now"><?php _e( 'First Name', 'rave-pay' ) ?> (Optional) </label>
    40       <input class="flw-form-input-text" id="flw-first-name" type="text" placeholder="<?php _e( 'First Name', 'rave-pay' ) ?>" /><br>
    41 
    42     <?php endif; ?>
    43 
    44     <?php if ( empty( $atts['lastname'] ) ) : ?>
    45 
    46       <label class="pay-now"><?php _e( 'Last Name', 'rave-pay' ) ?> (Optional) </label>
    47       <input class="flw-form-input-text" id="flw-last-name" type="text" placeholder="<?php _e( 'Last Name', 'rave-pay' ) ?>" /><br>
    48 
    49     <?php endif; ?>
    50 
    51     <?php if ( empty( $atts['amount'] ) ) : ?>
    52 
    53       <label class="pay-now"><?php _e( 'Amount', 'rave-pay' ); ?></label>
    54       <input class="flw-form-input-text" id="flw-amount" type="text" placeholder="<?php _e( 'Amount', 'rave-pay' ); ?>" required /><br>
    55 
    56     <?php endif; ?>
    57 
    58 
    59 <?php    if (!empty($atts['extra_count'] && $atts['extra_count'] > 0)) {
    60   //  print_r($atts);
    61   //  exit();
    62 if(empty(explode(",",$payment_forms->get_option_value('extra_field_1'))[0])){
    63       $extra_fields = [];
    64 }else{
    65   $extra_fields = explode(",", $payment_forms->get_option_value('extra_field_1'));
    66   if(count($extra_fields) == 1){
    67     $extra_fields = $extra_fields[0];
    68   }
    69 }
    70 foreach ($extra_fields as $key => $value) {?>
    71 
    72 <?php  if (strstr($value, '-h') === false ) : ?>
    73 <?php if(array_key_exists($value, $atts) && empty( $atts[$value])){ ?>
    74 
    75 <label class="pay-now"><?php _e( $value, 'rave-pay' ); ?></label>
    76 <input class="flw-form-input-text" id="flw-meta" type="text" placeholder="<?php _e( $value, 'rave-pay' ); ?>" required /><br>
    77 
    78 <?php }?>
    79 <?php endif; ?>
    80 
    81 <?php }
    82 }?>
    83 
    84 <?php if(!empty($atts['extra_checkbox_count'] && $atts['extra_checkbox_count'] > 0)) {
    85 
    86 
    87 if(empty(explode(",",$payment_forms->get_option_value('extra_field_2'))[0])){
    88   $extra_fields_checkbox = [];
    89 }else{
    90   $extra_fields_checkbox = explode(",", $payment_forms->get_option_value('extra_field_2'));
    91   if(count($extra_fields_checkbox) == 1){
    92     $extra_fields_checkbox = $extra_fields_checkbox[0];
    93   }
    94 }
    95 foreach ($extra_fields_checkbox as $key => $value) {?>
    96 
    97 <?php if(array_key_exists($value, $atts) && empty( $atts[$value] )){ ?>
    98 
    99 <label class="pay-now"><?php _e( $value, 'rave-pay' ); ?></label>
    100 <input class="" id="flw-meta" type="checkbox" placeholder="<?php _e( $value, 'rave-pay' ); ?>" required /><br>
    101 
    102 <?php }}}?>
    103 
    104    
    105     <?php
    106          
    107         //  print_r($atts);
    108    
    109     if ( !empty( $atts['recurring_payment'] ) ) : ?>
    110 
    111       <label class="pay-now"><?php _e( 'Recurring Payment', 'rave-pay' ) ?></label>
    112       <select class="flw-form-select" id="flw-payment-plan" required>
    113         <option value="">-- Select Interval --</option>
    114         <?php
    115           foreach($atts['paymentplans'] as $key => $value){
    116             if ($atts['paymentplansenable'][$key] == 'yes')
    117               echo '<option value="'.$key.'">'.$value.'</option>';
    118           }
    119         ?>
    120       </select><br>
    121 
    122     <?php endif; ?>
    123 
    124     <?php if (empty($atts['currency'])) : ?>
    125       <label class="pay-now"><?php _e('Currency', 'rave-pay'); ?></label>
    126       <?php if (!empty($atts['custom_currency'])){ ?>
    127 
    128       <select class="flw-form-select" id="flw-currency" required>
    129         <?php foreach ($currencies as $currency): ?>
    130           <option value="<?php echo $currency ?>"><?php echo $currency ?></option>
    131         <?php endforeach; ?>
    132       </select>
    133 
    134       <?php } else{ ?>
    135 
    136 
    137       <?php if ($atts['country'] == "NG") : ?>
    138         <select class="flw-form-select" id="flw-currency" required>
    139           <option value="NGN">NGN</option>
    140           <option value="USD">USD</option>
    141           <option value="KES">KES</option>
    142           <option value="EUR">EUR</option>
    143           <option value="GBP">GBP</option>
    144         </select>
    145       <?php endif; ?>
    146 
    147       <?php if ($atts['country'] == "KE") : ?>
    148         <select class="flw-form-select" id="flw-currency" required>
    149           <option value="KES">KES</option>
    150           <option value="NGN">NGN</option>
    151           <option value="UGX">UGX</option>
    152           <option value="USD">USD</option>
    153           <option value="KES">KES</option>
    154           <option value="EUR">EUR</option>
    155           <option value="GBP">GBP</option>
    156         </select>
    157       <?php endif; ?>
    158 
    159       <?php if ($atts['country'] == "GH") : ?>
    160         <select class="flw-form-select" id="flw-currency" required>
    161           <option value="GHS">GHS</option>
    162           <option value="USD">USD</option>
    163           <option value="NGN">NGN</option>
    164           <option value="UGX">UGX</option>
    165           <option value="USD">USD</option>
    166           <option value="KES">KES</option>
    167           <option value="EUR">EUR</option>
    168           <option value="GBP">GBP</option>
    169         </select>
    170       <?php endif; ?>
    171 
    172       <?php if ($atts['country'] == "UG") : ?>
    173         <select class="flw-form-select" id="flw-currency" required>
    174           <option value="UGX">UGX</option>
    175           <option value="NGN">NGN</option>
    176           <option value="UGX">UGX</option>
    177           <option value="USD">USD</option>
    178           <option value="KES">KES</option>
    179           <option value="EUR">EUR</option>
    180           <option value="GBP">GBP</option>
    181         </select>
    182       <?php endif; ?>
    183 
    184       <?php if ($atts['country'] == "ZA") : ?>
    185         <select class="flw-form-select" id="flw-currency" required>
    186           <option value="ZAR">ZAR</option>
    187           <option value="NGN">NGN</option>
    188           <option value="UGX">UGX</option>
    189           <option value="USD">USD</option>
    190           <option value="KES">KES</option>
    191           <option value="EUR">EUR</option>
    192           <option value="GBP">GBP</option>
    193         </select>
    194       <?php endif; ?>
    195 
    196       <?php if ($atts['country'] == "US") : ?>
    197         <select class="flw-form-select" id="flw-currency" required>
    198           <option value="NGN">NGN</option>
    199           <option value="USD">USD</option>
    200           <option value="KES">KES</option>
    201           <option value="GHS">GHS</option>
    202           <option value="EUR">EUR</option>
    203           <option value="ZAR">ZAR</option>
    204           <option value="GBP">GBP</option>
    205         </select>
    206       <?php endif; ?>
    207 
    208         <?php
    209       } ?>
    210 
    211     <?php endif; ?>
    212     <br>
    213 
    214     <?php wp_nonce_field( 'flw-rave-pay-nonce', 'flw_sec_code' ); ?>
    215     <button value="submit" class='flw-pay-now-button' href='#'><?php _e( $btn_text, 'rave-pay' ) ?></button>
    216   </form>
     23<div class="flutterwave-payment-form">
     24    <span class="flw-error"></span>
     25    <form id="<?php echo esc_attr( $form_id ); ?>" class="flw-simple-pay-now-form" <?php echo esc_attr( $data_attr ); ?>>
     26        <div id="notice"></div>
     27        <?php echo wp_kses( $input_fields_html, $allowed_html_elements ); ?>
     28        <?php wp_nonce_field( 'flw-rave-pay-nonce', 'flw_sec_code' ); ?>
     29        <button value="submit" id="flw-pay-now-button" class='flw-pay-now-button'>
     30            <?php
     31            echo esc_attr( $btn_text );
     32            ?>
     33        </button>
     34    </form>
    21735</div>
     36<div id="flutterwave-overlay" style="display:none">
     37    <div id="flw-overlay-text">You would be redirected to the payment page soon. please do not close this page.</div>
     38</div>
  • rave-payment-forms/trunk/views/payment-list-table.php

    r1862668 r2913754  
    11<?php
     2/**
     3 * Flutterwave Payments List Page
     4 *
     5 * @package Flutterwave\Payments\Views
     6 * @version 1.0.6
     7 */
    28
    3   global $payment_list;
     9$payment_list = FLW_Payment_List::get_instance();
    410
    511?>
    612
    713<div class="wrap">
    8   <h2>Rave Transactions</h2>
    9 
    10   <div id="poststuff">
    11     <div id="post-body" class="metabox-holder">
    12       <div id="post-body-content">
    13         <div class="meta-box-sortables ui-sortable">
    14           <form method="post">
    15             <?php
    16               $payment_list->prepare_items();
    17               $payment_list->display();
    18             ?>
    19           </form>
    20         </div>
    21       </div>
    22     </div>
    23     <br class="clear">
    24   </div>
     14    <h2>Flutterwave Transactions</h2>
     15    <div id="poststuff">
     16        <div id="post-body" class="metabox-holder">
     17            <div id="post-body-content">
     18                <div class="meta-box-sortables ui-sortable">
     19                    <form method="post">
     20                        <?php
     21                        $payment_list->prepare_items();
     22                        $payment_list->display();
     23                        ?>
     24                    </form>
     25                </div>
     26            </div>
     27        </div>
     28        <br class="clear">
     29    </div>
    2530</div>
Note: See TracChangeset for help on using the changeset viewer.