Git Product home page Git Product logo

bluepay-sample-code's Introduction

BluePay-Sample-Code

This sample code is meant for developers looking for a starting point to integrate their applications or website to the BluePay gateway.

Please carefully read the comments in the sample code files for more information on how to connect your sandbox or live gateway account. Before you can start processing transactions, you must enter in your BluePay gateway Account ID and Secret Key. This helpful video shows you how and where to grab these two values. Also, depending on the platform and language you choose to write in, you may need to install additional libraries in order to successfully implement this sample code.

Since this sample code only works with the BluePay gateway, you will need a gateway account to utilize the code. Click here if you'd like to request a sandbox account

Languages Supported

The list of programming languages that are included in this repository:

  • C#
  • C++
  • Java
  • Perl
  • PHP
  • Python
  • Ruby
  • VB

Usage

Every language is structured essentially the same and contains the following:

  • A library file that contains the methods necessary for processing transactions, pulling reports, querying the BluePay gateway, etc.
  • A directory, labeled 'Transactions', containing samples showing how to process transactions.
  • A directory, labeled 'Get Data', containing samples showing how to pull transactions from the BluePay gateway.
  • A directory, labeled 'Rebills', containing samples showing how to set up, modify, and delete BluePay rebillings.

As a very basic starting point in order to run the samples, you'll need to input your Account ID and Secret Key. In most circumstances, this is all you will need to run the sample code.

Disclaimer

The sample code is provided as-is; BluePay does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own web server configurations. It is entirely up to the developer to take this code and use it as they may. Resolving issues with the development environment is the responsibility of the developer performing the integration. If you are a merchant needing to implement an integration and are not a developer yourself, we highly recommend that you hire or get assistance from one.

bluepay-sample-code's People

Contributors

adduc avatar daum avatar ericmargules avatar evenflow58 avatar jslingerland avatar msleight avatar svvitale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bluepay-sample-code's Issues

No response from get_settled_transaction_report

I'm using the Ruby Libarary v 1.0.9

I'm getting no response when using the get_settled_transaction_report method. I've successfully used the auth, capture, and sale methods. Here are the params being sent:

MODE: TEST
ORDER_ID: 1
QUERY_BY_SETTLEMENT: 1
REPORT_START_DATE: 2018-04-20 00:00:00
REPORT_END_DATE: 2018-04-26 23:59:59
QUERY_BY_HIERARCHY: 1
DO_NOT_ESCAPE: 1
EXCLUDE_ERRORS: 0
TPS_HASH_TYPE: HMAC_SHA512
RESPONSEVERSION: 5
TAMPER_PROOF_SEAL: 7f9b497e49af220da9d3e73a3ae6a558c3ac9566f8fc10c7378c7457d13780486107d29c84da25f9f4977ce399ccb492576709ba55dd9b3ebe4c47937e0a21c6
ACCOUNT_ID: XXXXXXXXXXXXXXX

I've tried all types of date/time formats but always get an empty response.
Any help would be appreciated!

License of Code?

Could you clarify what license this code has been released under?

Unable to build VB solution after download

VS2017 would not build the vbnet project. This is from commit f13fe55. The two errors can be fixed as follow:

BluePay.vb: Added 'As String' to 'protectCustomID1' (line 706).

Public Function generateURL(Optional ByVal merchantName As String = "", Optional ByVal returnURL As String = "", Optional ByVal transactionType As String = "", Optional ByVal acceptDiscover As String = "", Optional ByVal acceptAmex As String = "", Optional ByVal amount As String = "", Optional ByVal protectAmount As String = "No", Optional ByVal rebilling As String = "No", Optional ByVal rebProtect As String = "Yes", Optional ByVal rebAmount As String = "", Optional ByVal rebCycles As String = "", Optional ByVal rebStartDate As String = "", Optional ByVal rebFrequency As String = "", Optional ByVal customID1 As String = "", Optional ByVal protectCustomID1 As String = "No", Optional ByVal customID2 As String = "", Optional ByVal protectCustomID2 As String = "No", Optional ByVal paymentTemplate As String = "mobileform01", Optional ByVal receiptTemplate As String = "mobileresult01", Optional ByVal receiptTempRemoteURL As String = "") As String

Charge_Customer_CC.vb: Added namespace 'BPVB' to 'BluePay' (line 22).

Dim payment As BPVB.BluePay = New BPVB.BluePay(

Php 7.0

This uses the same name for the class as the function (BluePay). Starting in php7.0, this is deprecated.

PHP 4 style constructors (methods that have the same name as the class they are defined in) are deprecated, and will be removed in the future. PHP 7 will emit E_DEPRECATED if a PHP 4 constructor is the only constructor defined within a class. Classes that implement a __construct() method are unaffected.

http://php.net/manual/en/migration70.deprecated.php

Split up repos

It would be a HUGE help if these code libraries were split into their own repos. At the moment the only way to keep up-to-date is to continually check for updates to whichever library is being used and manually downloading and replacing the original codebase. It would be fantastic to update by simply running bundle update blupay (for the ruby library for example).

C# Samples and TLS 1.2

It looks like on May 31st BP will be ending support for TLS 1.0 and 1.1. And I see that the C# sample project is using .Net 4.5. By default .Net 4.5 uses a TLS version prior to 1.2. I suggest upgrading the project to .Net 4.6 (this uses TLS 1.2 by default) or manually setting the SecurityProtocol to TLS 1.2 prior to making the connection in "PerformPost" in BluePay.cs. The exact code would look somthing like ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12.

Thank you, and thank you for keeping the samples up to date with the documentation.

Ruby RootCA

The RootCA path is set as "/" a constant in the class definition which means there's no way to set this to any other value unless the gem is modified directly. Was this intentional? I've created a fork to allow it to be set during initialization. I can create a PR if you like.

Swipe does not recognize asterisks as placeholders.

MagTek sent us iPad swipe devices that use asterisks as placeholders but this BluePay library expects zeros. The RegEx expressions need to be updated to handle this. PR #9 fixes the C# code to resolve this issue but I have not tested other languages.

c# SetParam method

What is the purpose of the c# SetParam Method, it doesn't appear to be used and it only sets local Name value.

public void SetParam(string Name, string Value) { Name = Value; }

Typo in BluePay.php

BluePay::queryByPaymentType() method has a typo, it looks like. The method argument is $payType, but the variable name used inside the method is $paymentType.

// Queries transactions by a specific Payment Type. Must be used with getSingleTransQuery
public function queryByPaymentType($payType) {
    $this->paymentType = $paymentType;
}

Getting an error in ruby gem during payment process

Hello,

I've got an error during calling process method:
"NoMethodError: undefined method gsub' for nil:NilClass" at .rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/uri/rfc2396_parser.rb:305:in escape'

I use ruby-2.4.2p198 in my project.

PHP - Transaction Report by Rebill ID

I would like to get the transaction history for a particular Rebill ID. Is this possible? Via getSettledTransactionReport

Something like this:
$this->rebid = $params['rebillID'];

Many issues with C# code

Now that I'm looking more in-depth into the C# code, there are quite a few issues with it:

  • Inconsistent Url encoding; sometimes with custom method, sometimes with HttpUtility.UrlEncode, and sometimes not at all
  • Custom-handling of failed connections, instead of using HttpClient with Polly to handle faults
  • Token generation is not cryptographically safe
  • Response values are not Url decoded
  • Ugly and inefficient response parsing
  • Lots of public methods that should be private
  • if the computer has multiple IP addresses, it may return the wrong one
  • Exceptions are completely ignored!!

I've rewritten the class using .NET Core 3.1 using Nullables and standard code conventions. What would be the best way to submit the updated version? It does depend on a few other utility classes so it will need to be edited a bit for a sample, and HttpClient needs to be configured with Polly separately.

Getting exception in ruby gem

I am trying to integrate Bluepay to my Rails application. I am getting the below error while executing the code. FYI I have copy pasted the code mentioned over here https://www.bluepay.com/developers/api-documentation/ruby/transactions/store-payment-information/ with my sandbox details.

irb(main):033:0* payment.process
TypeError: no implicit conversion of Fixnum into String
from /Users/Logan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bluepay-1.0.5/lib/api_request.rb:15:in +' from /Users/Logan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bluepay-1.0.5/lib/api_request.rb:15:incalc_tps'
from /Users/Logan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bluepay-1.0.5/lib/api_request.rb:100:in `process'

Wrong names mapping response

Hi, I found some error mapping in function assign_response_values (BluePay.py line 848)
There're some wrong names so the return value will blank. Can you check?

PHP: usage of null coalescing operator breaks PHP 5.6 support

Beginning on line 274:
'LV2_ITEM_TAX_RATE' => $params['taxRate'] ?? ''

Usage of the double question mark (null coalescing operator) is only supported on PHP 7 and higher, so any sites running 5.6 will not be able to use this code. If that is the intended behavior, then I can just update my version to not use the operator, but thought I'd bring this up in case anyone asks in the future. Thanks!

BluePay.py HMAC error

I updated to BluePay 3.0.2 but now I am getting an error everytime I try to process a payment:

Traceback (most recent call last):
File "/home/jlossada/.PyCharm2018.3/config/scratches/bluepay_test.py", line 42, in
payment.process()
File "apps/payments/libs/BluePay.py", line 745, in process
'TAMPER_PROOF_SEAL': self.calc_TPS(),
File "app/wms_iq/apps/payments/libs/BluePay.py", line 445, in calc_TPS
tps = self.create_tps_hash(tps_string, self.tps_hash_type)
File "apps/payments/libs/BluePay.py", line 437, in create_tps_hash
tps_hash = hmac.new(self.secret_key, string, hashlib.sha512).hexdigest()
File "/usr/lib/python3.6/hmac.py", line 144, in new
return HMAC(key, msg, digestmod)
File "/usr/lib/python3.6/hmac.py", line 42, in init
raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).name)
TypeError: key: expected bytes or bytearray, but got 'str'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.