Module: DineroMail::Operations

Includes:
Security
Included in:
Client
Defined in:
lib/dinero_mail/operations.rb

Constant Summary collapse

KEYS_FOR_ACTION =
{
  get_balance: [:merchant_transaction_id, :unique_message_id],
  get_operations: [:merchant_transaction_id, :unique_message_id, :operation_id, :start_date, :end_date],
  send_money: [:merchant_transaction_id, :unique_message_id, :currency, :amount, :to_email, :pay_off, :subject, :message],
  get_payment_ticket: [:merchant_transaction_id, :unique_message_id, :currency, :amount, :provider]
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Security

#encrypt_with, #md5

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



15
16
17
# File 'lib/dinero_mail/operations.rb', line 15

def response
  @response
end

Instance Method Details

#do_payment_with_credit_card(options = {}) ⇒ Object

c.do_payment_with_credit_card merchant_transaction_id: ‘1’, items: [‘100.00’, code: ‘abc’, currency: ‘MXN’, description: ‘descricion’, name: ‘nombre’, quantity: ‘1’], buyer: ‘abraham’, last_name: ‘kuri’, email: ‘[email protected]’, provider: ‘MX_BANORTE_TD’, credit_card: ‘2’, credit_card_number: ‘123456’, holder: ‘adrian’, expiration_date: ‘12/16’, security_code: ‘1234’, document_number: ‘1’, unique_message_id: ‘1’



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/dinero_mail/operations.rb', line 96

def do_payment_with_credit_card(options = {})
  response_for :do_payment_with_credit_card, {
    'Credential' => self.credential,
    'Crypt' => 'false',
    'MerchantTransactionId' => options[:merchant_transaction_id],
    'Items' => options[:items],
    'Buyer' => options[:buyer],
    'Provider' => options[:provider],
    'CreditCard' => options[:credit_card],
    'Subject' => options[:subject],
    'Message' => options[:message],
    'UniqueMessageID' => options[:unique_message_id],
    'Hash' => do_payment_with_credit_card_hash(options)
  } 
end

#do_payment_with_reference(options = {}) ⇒ Object

client.do_payment_with_reference merchant_transaction_id: ‘1’, unique_message_id: ‘1’, subject: ‘hola’, message: ‘mensaje’, provider: ‘oxxo’, items: [‘100.00’, code: ‘abc’, currency: ‘MXN’, description: ‘descricion’, name: ‘nombre’, quantity: ‘1’], buyer: ‘abraham’, last_name: ‘kuri’, email: ‘[email protected]



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/dinero_mail/operations.rb', line 63

def do_payment_with_reference(options = {})
  response_for :do_payment_with_reference, {
   'Credential' => self.credential,
   'Crypt' => 'false',
   'MerchantTransactionId' => options[:merchant_transaction_id],
   'Items' => options[:items],
   'Buyer' => options[:buyer],
   'Provider' => options[:provider],
   'Subject' => options[:subject],
   'Message' => options[:message],
   'UniqueMessageID' => options[:unique_message_id],
   'Hash' => do_payment_with_reference_hash(options)
  }
end

#do_with_draw(options = {}) ⇒ Object

c.do_with_draw merchant_transaction_id: ‘1’, method: ‘POSTAL’, currency: ‘MXN’, amount: ‘100.00’, address_detail: ‘mordor’, number: ‘666’, floor: ‘1’, appartment: ‘5’, zip: ‘666’, city: ‘inferno’, state: ‘mordorTown’, bank_account_detail: Santander’, bank_number: ‘300’, type: ‘CC’, name: ‘Abraham’, last_name: ‘Kuri’, document_type: ‘RFC’, document_number: ‘2019029’, branch: ‘1’, unique_message_id: ‘1’ Methods: transaction_id, status, merchant_transaction_id, message



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/dinero_mail/operations.rb', line 80

def do_with_draw(options = {})
  response_for :do_with_draw, {
    'Credential' => self.credential,
    'Crypt' => 'false',
    'MerchantTransactionId' => options[:merchant_transaction_id],
    'Method' => options[:method],
    'Currency' => options[:currency],
    'Amount' => options[:amount],
    'AddressDetail' => options[:address_detail],
    'BankAccountDetail' => options[:bank_account_detail],
    'UniqueMessageID' => options[:unique_message_id],
    'Hash' => do_with_draw_hash(options)
  }
end

#get_balance(options = {}) ⇒ Object

client.get_balance unique_message_id: ‘1’, merchant_transaction_id: ‘1’ Methods: currency, status, transaction_id, merchant_transaction_id, message, amount



19
20
21
22
23
24
25
26
27
# File 'lib/dinero_mail/operations.rb', line 19

def get_balance(options = {})    
  response_for :get_balance, { 
    'Credential' => self.credential, 
    'Crypt' => 'false', 
    'UniqueMessageID' => options[:unique_message_id], 
    'MerchantTransactionId' => options[:merchant_transaction_id], 
    'Hash' => build_hash_for(:get_balance, options) 
  }
end

#get_operations(options = {}) ⇒ Object

client.get_operations unique_message_id: ‘1’, merchant_transaction_id: ‘1’, operation_id: ‘1’, start_date: ‘2012-10-6’, end_date: ‘2012-10-10’ Methods: operations, status, merchant_transaciont_id, message



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/dinero_mail/operations.rb', line 31

def get_operations(options = {})
     response_for :get_operations, { 
       'Credential' => self.credential,
       'Crypt' => 'false',  
       'UniqueMessageID' => options[:unique_message_id], 
       'MerchantTransactionId' => options[:merchant_transaction_id], 
       'OperationId' => options[:operation_id], 
       'StartDate' => options[:start_date], 
       'EndDate' => options[:end_date], 
       'Hash' => build_hash_for(:get_operations, options) 
     }
end

#get_payment_ticket(options = {}) ⇒ Object

c.get_payment_ticket currency: “MXN”, amount: “100.0”, provider: “oxxo”, merchant_transaction_id: “1”, unique_message_id: “1”



113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/dinero_mail/operations.rb', line 113

def get_payment_ticket(options = {})
  response_for :get_payment_ticket, {
    'Credential' => self.credential,
    'Crypt' => 'false',
    'Currency' => options[:currency],
    'Amount' => options[:amount],
    'MerchantTransactionId' => options[:merchant_transaction_id],
    'Provider' => options[:provider],
    'UniqueMessageID' => options[:unique_message_id],
    'Hash' => build_hash_for(:get_payment_ticket, options)
  } 
end

#send_money(options = {}) ⇒ Object

client.send_money currency: ‘MXN’, amount: ‘100.00’, to_email: ‘[email protected]’, pay_off: ‘Producto’, subject: ‘Pago becalia’, message: ‘Hola mundo’, merchant_transaction_id: ‘1’, unique_message_id: ‘1’ Methods: transaction_id, status, merchant_transaction_id, message



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/dinero_mail/operations.rb', line 46

def send_money(options = {})
  response_for :send_money, {
    'Credential' => self.credential,
    'Crypt' => 'false',
    'Currency' => options[:currency],
    'Amount' => options[:amount],
    'ToEmail' => options[:to_email],
    'PayOff' => options[:pay_off],
    'Subject' => options[:subject],
    'Message' => options[:message],
    'MerchantTransactionId' => options[:merchant_transaction_id],
    'UniqueMessageID' => options[:unique_message_id],
    'Hash' => build_hash_for(:send_money, options)
  }
end