Passing form data to gateway

This topic contains 4 replies, has 2 voices, and was last updated by  Stephen Harris 11 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5853

    Hi,

    I am adding a new gateway to the plugin and for the gateway I want to include it is also mandatory to include bookee surname and event end date. I would also like to pass on some information from the form fields. How can I do that? Would it look something like this?

    $booking_data['firstname'] = eo_get_booking_meta( $booking_id, 'bookee_display_name' );
    $booking_data['surname'] = eo_get_booking_meta( $booking_id, 'bookee_display_surname' );

    Thanks

    Vilius Metelionis
    #5866

    Assuming $booking_data is the an array you’re giving to the gateway then yes.

    I’ll be updating the site with some documentation on (part of) the booking API (including eo_get_booking_meta(). But you can use the following keys:

      • bookee – The bookee ID. 0 if its a guest booking.
      • bookee_first_name – The bookee’s first name
      • bookee_last_name – The bookee’s last name (if provided).
      • bookee_display_name – The bookee’s display name (as selected in profile).
      • bookee_email – The bookee’s email address
      • booking_notes – The booking notes
      • event_id – The ID of the event the booking is for
      • occurrence_id The ID of the occurrence the booking is for
      • date – The date the booking was made
      • ticket_quantity – The number of tickets contained in the booking
      • booking_amount – The total amount the booking came to (as a float)
      • meta_{$ID} – The value entered for booking form element with ID $ID.
    Stephen Harris
    #5878

    Hi Stephen,
    Sorry to bug you again about this, but I’m struggling a bit with getting Address form values. I’m using eo_get_booking_meta( $booking_id, 'meta_10', false); to get the array from the address form. Every time it returns values in different order:

    Array (
    [0] => City
    [1] => Line1
    [2] => Province
    [3] => Post Code )

    Array (
    [0] => Post Code
    [1] => Line1
    [2] => City
    [3] => Province )

    For some reason it also doesn’t include Country.

    Thanks for your help.

    Vilius Metelionis
    #5910

    Hi Vilius,

    I’ve fixed the country data not saving bug, and will update this in the next version.

    I’m surprised by the re-ordering, but the way the address is saved could be handled better. Either it should be stored as serialised (associative) array, or else, retrieved by specifying the part of the address: meta_10_street-address, meta_10_2nd-line, meta_10_city, meta_10_state etc.

    I’ll have think an include the fix(es) in 2.1.1 sometime next week.

    Stephen Harris
    #5942

    I’ve tried to ensure that the array returns the address in the correct order, but it cannot be guaranteed (though I’ve been able to replicate the bug).

    However in the next update you can use meta_10_street-address etc as key to access specifically the street address (for example).

    I’ll be releasing 1.1.1 in the next day or two.

    Stephen Harris
Viewing 5 posts - 1 through 5 (of 5 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.