Halaman

Kamis, 23 September 2010

[shared] paypal recurring with activemerchant

add this file:
from http://github.com/rayvinly/active_merchant/blob/master/lib/active_merchant/billing/gateways/paypal_express_recurring.rb


read:
- https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_WPRecurringPayments
- and PP_RecurringPaymentsAPI.pdf

Credit Card







allowed credit card type (not all country support all type):
  • Visa
  • MasterCard
  • Discover
  • Amex
  • Maestro
  • Solo


test credit card obtained from:
http://www.darkcoding.net/credit-card-numbers/
you can generate it yourself using MOD 10 algorithm (Luhn formula) or so they said =P
http://www.darkcoding.net/credit-card/luhn-formula/

Error! DPRP is disabled for this merchant ?
- Only US & UK sandbox business accounts can be enabled for WPP
- use preconfigured account using Website Payments Pro
- or read https://www.x.com/docs/DOC-1603

Paypal Account





Additional



ActiveMerchant::Billing::CreditCard patch to support paypal recurring:

libmysql.dll is missing

copy [mysql installation directory]/bin/libmysql.dll to [ruby installation directory]/bin/

Rabu, 22 September 2010

ruby installer development kit

a note to self for devkit problem

error:

"Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers."

or

"You have to install development tools first."

see:
http://github.com/oneclick/rubyinstaller/wiki/development-kit

Rabu, 04 Agustus 2010

[shared] pac file for developing site using subdomain

saat ini saia mengerjakan site yg menggunakan subdomain tersendiri untuk setiap usernya, karenanya setiap saia meregistrasi user baru saia harus menambahkan line baru di hosts file saia:

127.0.1.1 localhost
127.0.1.2 mysite.local
127.0.1.3 www.mysite.local
127.0.1.5 user1.mysite.local
127.0.1.6 user2.mysite.local
...

hal tersebut cukup merepotkan terutama untuk testing.

sedikit googling saia menemukan site yang menjelaskan penggunaan pac (proxy auto-config) file untuk mempermudah develop subdomain site:
http://www.taylorluk.com/2009/08/hey-pac-man-sup-subdomains

tambahan, isi pac file yg saia gunakan saat ini untuk rails:

function FindProxyForURL(url, host) {
if (shExpMatch(host, "*.local")) {
return "PROXY 127.0.0.1:3000";
}
if (shExpMatch(host, "*.example.com")){
return "PROXY 127.0.0.1:3000";
}
return "DIRECT";
}

[shared] javascript arrayCompact

di RoR saia biasa menggunakan array.compact untuk memastikan di dalam suatu array tidak terdapat elemen nil. masalahnya javascript tidak mempunyai fungsi tersebut, untuk itu saia membuat fungsi kecil untuk melakukan hal td + sedikit tambahan untuk membuang bukan hanya null tetapi jg string kosong atau false:


/* return a copy of array with all null and optionally blank or false elements removed
* example:
* - arrayCompact(['a',null, 0, '', false]) //=> [ 'a', 0, '', false ] (only null removed)
* - arrayCompact(['a',null, 0, '', false], 1) //=> [ 'a', 0, false ] (only null and empty string removed)
* - arrayCompact(['a',null, 0, '', false], 2) //=> [ 'a' ] (all that equal to false removed)
*/
function arrayCompact(array, remove_level){
var new_array = new Array();
for(k in array)
if(typeof(array[k]) != 'undefined' &&
array[k] != null &&
!(remove_level > 0 &&
(typeof(array[k]) == 'string' || remove_level > 1) &&
array[k] == ''))
new_array.push(array[k]);
return new_array;
}


fungsi tersebut menggunakan plain javascript jadi dapat digunakan tanpa js framework apapun