Welcome to membersync’s documentation!

This documentation covers the basics of how to use the membersync library. For details on configuration, refer to the README.

class membersync.events.Event(data={})

The Event class represents a NetForum service, method, and parameters.

The Event class itself (not an instance) can serve as an event relay, pushing messages from an SQS queue into NetForum:

from membersync.events import Event

Event.poll(wait=10)

Instances of Event subclasses can be used to read data from NetForum:

from membersync import events as nf

event = nf.MyCustomEvent({'Foo': 'Bar'})
resp = event.send_soap()

Instances of Event subclasses can also be used to write data to SQS:

from membersync import events as nf

event = nf.MyCustomEvent({'Foo': 'Bar'})
event.send_sqs()
send_soap()

Sends an XML SOAP message to the target SOAP service.

Returns

A dictionary or list of dictionaries containing the data parsed from the SOAP response.

send_sqs(message_group_id='default')
Sends a JSON-serialized event to the target SQS queue in the format:
{

‘meta:event’: <EventClass>, **message

}

Parameters

message_group_id – ID that determines FIFO blocking groups. Setting this value to ‘donor:123’ would block all other ‘donor:123’ events from processing until the first is complete, but would not affect SQS messages for ‘donor:456’.

Returns

None

serialize_results(results)

Override this method to return results in a friendlier format.

Parameters

results – A list of lxml.etree._Element objects.

Returns

A JSON-compatible native python data structure.

class membersync.events.CustomerUpdate(data={})

Updates a donor’s information based on the provided PledgeID:

CustomerUpdate({
    'NewAddrLine1': str,
    'NewAddrLine2': str,
    'NewAddrLine3': str,
    'NewCity': str,
    'NewCountry': str,
    'NewEmail': str,
    'NewFirstName': str,
    'NewLastName': str,
    'NewState': str,
    'NewStreet': str,
    'NewZip': str,
    'PledgeID': str,  # required
})
class membersync.events.DonorLookup(data={})

Retrieves a list of donors based on the provided information:

DonorLookup({
    'address_line_1': str,
    'charge_card_alias': str,
    'city': str,
    'country': str,
    'email_address': str,
    'external_pledge_number': str,
    'first_name': str,
    'fund_group': str,
    'last_name': str,
    'nf_order_code': str,
    'page_num': str,
    'state': str,
    'telephone_number': str,
    'zip_code': str,
})

The return format:

[
    {
        'account-id-1': str,
        'cust-key1': str,
        'first-name-1': str,
        'middle-name-1': str,
        'last-name-1': str,
        'suffix-1': str,
        'account-id-2': str,
        'first-name-2': str,
        'middle-name-2': str,
        'last-name-2': str,
        'suffix-2': str,
        'address-line1': str,
        'address-line2': str,
        'address-line3': str,
        'city': str,
        'state': str,
        'country': str,
        'zip-code': str,
        'email-address': str,
        'telephone_number': str,
        'sustainer-flag': str,
        'sustainer-last-payment-amount': str,
        'sustainer-plg-ord-code': str,
        'sustainer-plg-external-id': str,
        'sustainer-charge-card-alias': str,
        'onetime-last-pledge-amount': str,
        'onetime-last-gift-date': str,
        'onetime-plg-ord-code': str,
        'onetime-plg-external-id': str,
        'onetime-charge-card-alias': str,
        'query-starting-offset': str,
        'query-page-size': str,
        'query-total-rows': str,
        'has-more': str,
    }
]
class membersync.events.GetCustomerInfo(data={})

Retrieves a dictionary of customer info based on provided OrderId:

GetCustomerInfo({
    'OrderId': str,
})

The return format:

{
    'ind-first-name': str,
    'ind-last-name': str,
    'cst-eml-address-dn': str,
    'adr-state': str,
    'adr-country': str,
    'adr-city': str,
    'adr-line1': str,
    'adr-post-code': str,
    'ord-type': str,
    'odd-amount-cp': str,
    'cst-key': str,
    'cst-recno': str,
    'ord-code': str,
    'ord-key': str,
    'is-open': str,
}
class membersync.events.InteractionAdd(data={})

Notifies NetForum about an interaction.:

InteractionAdd({
    'ActivityTypeCode': str,
    'Detail': str,
    'InteractionDate': str,
    'OriginCode': str,
    'PledgeID': str,  # required
    'PriorityCode': str,
    'ReasonCode': str,
    'RequestType': str,
    'RequestTypeDetail': str,
    'StatusCode': str,
    'Summary': str,
})
class membersync.events.LookupInvoiceKey(data={})

Retrieves an InvoiceKey from a PledgeID:

LookupInvoiceKey({
    'PledgeID': str,  # required
})

The return format:

{
    'InvoiceKey': str,
}
class membersync.events.PaymentReceived(data={})

Notifies NetForum about a new payment.:

PaymentReceived({
    'Amount': str,  # required
    'PaymentMethod': str,  # required
    'PledgeID': str,  # required
})
class membersync.events.PledgeListOfOrders(data={})

Retrieves the order history for a given email address:

PledgeListOfOrders({
    'Email1': str,  # required
    'Email2': str,
})

The return format:

[
    {
        'charge-card-alias': str,
        'credit-card-last-4-digits': str,
        'credit-card-type': str,
        'cst-key': str,
        'cst-recno': str,
        'cst-sort-name-dn': str,
        'external-pledge-number': str,
        'fund': str,
        'id': str,
        'is-active-member': str,
        'is-payment': str,
        'is-sustaining': str,
        'order-code': str,
        'order-date': str,
        'order-key': str,
        'order-price': str,
        'order-type': str,
        'premium': str,
    }
]
class membersync.events.RefundPayment(data={})

Notifies NetForum about an issued refund:

RefundPayment({
    'PledgeID': str,  # required,
    'REfundAmount': str,  # required,
})
class membersync.events.StripePaymentError(data={})

Notifies NetForum about a payment error:

StripePaymentError({
    'ErrorCode': str,
    'ErrorDate': str,
    'ErrorMessage': str,
    'ErrorText': str,
    'PaymentInfo': str,  # required
})

In this case, “PaymentInfo” refers to the Stripe ID.

class membersync.events.SustainerCancel(data={})

Notifies NetForum about a cancelled sustaining donation:

SustainerCancel({
    'PledgeID': str,  # required
})

Indices and tables