Esempio n. 1
0
def offsite_amazon_fps(request):
    url_scheme = "http"
    if request.is_secure():
        url_scheme = "https"
    fields = {
        "transactionAmount":
        "100",
        "pipelineName":
        "SingleUse",
        "paymentReason":
        "Merchant Test",
        "paymentPage":
        request.build_absolute_uri(),
        "returnURL":
        "%s://%s%s" %
        (url_scheme, RequestSite(request).domain, reverse("fps_return_url"))
    }
    # Save the fps.fields["callerReference"] in the db along with
    # the amount to be charged or use the user's unique id as
    # the callerReference so that the amount to be charged is known
    # Or save the callerReference in the session and send the user
    # to FPS and then use the session value when the user is back.
    amazon_fps_obj.add_fields(fields)
    fields.update({
        "transactionAmount": "100",
        "pipelineName": "Recurring",
        "recurringPeriod": "1 Hour",
    })
    fps_recur_obj.add_fields(fields)
    template_vars = {
        'title': 'Amazon Flexible Payment Service',
        "fps_recur_obj": fps_recur_obj,
        "fps_obj": amazon_fps_obj
    }
    return render(request, 'app/amazon_fps.html', template_vars)
Esempio n. 2
0
def offsite_amazon_fps(request):
    url_scheme = "http"
    if request.is_secure():
        url_scheme = "https"
    fields = {"transactionAmount": "100",
              "pipelineName": "SingleUse",
              "paymentReason": "Merchant Test",
              "paymentPage": request.build_absolute_uri(),
              "returnURL": "%s://%s%s" % (url_scheme,
                                          RequestSite(request).domain,
                                          reverse("fps_return_url"))
              }
    # Save the fps.fields["callerReference"] in the db along with
    # the amount to be charged or use the user's unique id as
    # the callerReference so that the amount to be charged is known
    # Or save the callerReference in the session and send the user
    # to FPS and then use the session value when the user is back.
    amazon_fps_obj.add_fields(fields)
    fields.update({"transactionAmount": "100",
                   "pipelineName": "Recurring",
                   "recurringPeriod": "1 Hour",
                   })
    fps_recur_obj.add_fields(fields)
    template_vars = {'title': 'Amazon Flexible Payment Service',
                     "fps_recur_obj": fps_recur_obj,
                     "fps_obj": amazon_fps_obj}
    return render(request, 'app/amazon_fps.html', template_vars)