Skip to content

Commit

Permalink
Merge pull request #1 from KTCNigeria/test-go-live
Browse files Browse the repository at this point in the history
Test go live
  • Loading branch information
Preciousomonze authored Jul 5, 2018
2 parents 7e74533 + 2944edc commit 06f5978
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
7 changes: 7 additions & 0 deletions assets/js/flw.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ var buildConfigObj = function( form ) {
var email = formData.email || jQuery(form).find('#flw-customer-email').val();
var formCurrency = formData.currency || jQuery(form).find('#flw-currency').val();
var txref = 'WP_' + form.id.toUpperCase() + '_' + new Date().valueOf();
//WHERE was added
var phonenumber = formData.phone || jQuery(form).find('#flw-customer-phone').val();
var firstname = formData.firstname || jQuery(form).find('#flw-customer-firstname').val();
var lastname = formData.lastname || jQuery(form).find('#flw-customer-lastname').val();

if (formCurrency == '') {
formCurrency = flw_rave_options.currency;
Expand All @@ -38,6 +42,9 @@ var buildConfigObj = function( form ) {
custom_logo: flw_rave_options.logo,
custom_title: flw_rave_options.title,
customer_email: email,
customer_phone: phonenumber,
customer_firstname: firstname,
customer_lastname: lastname,
payment_method: flw_rave_options.method,
PBFPubKey: flw_rave_options.pbkey,
txref: txref,
Expand Down
7 changes: 6 additions & 1 deletion includes/rave-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public function pay_button_shortcode( $attr, $content="" ) {

$btn_text = empty( $content ) ? $this->pay_button_text() : $content;
$email = $this->use_current_user_email( $attr ) ? wp_get_current_user()->user_email : '';
$fname = wp_get_current_user()->user_firstname;
$lname = wp_get_current_user()->user_lastname;
if (!empty($this->get_logo_url($attr))) {
$attr['logo'] = $this->get_logo_url($attr);
}
Expand All @@ -63,7 +65,10 @@ public function pay_button_shortcode( $attr, $content="" ) {
$atts = shortcode_atts( array(
'amount' => '',
'custom_currency' => [],
'email' => $email,
'firstname' => $fname,
'lastname' => $lname,
'phone' => '',
'email' => $email,
'country' => $admin_settings->get_option_value('country'),
'currency' => $admin_settings->get_option_value('currency')
), $attr );
Expand Down
14 changes: 12 additions & 2 deletions views/pay-now-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@
<div>
<form id="<?php echo $form_id ?>" class="flw-simple-pay-now-form" <?php echo $data_attr; ?> >
<div id="notice"></div>
<?php if ( empty( $atts['email'] ) ) : ?>

<label class="pay-now"><?php _e( 'First name', 'rave-pay' ) ?></label>
<input class="flw-form-input-text" id="flw-customer-firstname" type="text" placeholder="<?php _e( 'First name', 'rave-pay' ) ?>" required value="<?php echo $atts['firstname']; ?>"/><br>

<label class="pay-now"><?php _e( 'last name', 'rave-pay' ) ?></label>
<input class="flw-form-input-text" id="flw-customer-lastname" type="text" placeholder="<?php _e( 'Last name', 'rave-pay' ) ?>" required value="<?php echo $atts['lastname']; ?>"/><br>

<label class="pay-now"><?php _e( 'Phone number', 'rave-pay' ) ?></label>
<input class="flw-form-input-text" id="flw-customer-phone" type="tel" placeholder="<?php _e( 'Phone number', 'rave-pay' ) ?>" required /><br>

<?php if ( empty( $atts['email'] ) ) : ?>

<label class="pay-now"><?php _e( 'Email', 'rave-pay' ) ?></label>
<input class="flw-form-input-text" id="flw-customer-email" type="email" placeholder="<?php _e( 'Email', 'rave-pay' ) ?>" required /><br>
<input class="flw-form-input-text" id="flw-customer-email" type="email" placeholder="<?php _e( 'Email', 'rave-pay' ) ?>" required value="<?php echo $atts['email']; ?>"/><br>

<?php endif; ?>

Expand Down

0 comments on commit 06f5978

Please sign in to comment.