Я хочу использовать Ruby MAP для получения данных:
PAYMENT_TYPE_TO_CURRENCY_AND_COUNTRY_MAPPING = {
zimpler: { 'EUR' => ['FI'], 'SEK' => ['SE'] },
qiwi: { 'EUR' => ['RU', 'KZ'], 'RUB' => ['RU'], 'KZT' => ['KZ'], 'USD' => ['UA'] },
payu: { 'CZK' => ['CZ'], 'PLN' => ['PL']},
entercash: { 'EUR' => ['AT', 'DE', 'FI'], 'SEK' => ['SE'] },
carulla: { 'USD' => ['CO'] }
}
Я хотел бы создать заглушку, используя указанные выше данные из MAP:
GirogateRequestBuilder::PAYMENT_TYPE_TO_CURRENCY_AND_COUNTRY_MAPPING.keys.each do |payment_method|
stub_request(:post, /.*/).
with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
<payment_transaction>\n
<transaction_type>#{payment_method.key}</transaction_type>\n
<transaction_id>/.*/</transaction_id>\n
<usage>New iPad</usage>\n
<currency>#{payment_method.get here currency}</currency>\n
<billing_address>\n
<first_name>Barney</first_name>\n
<country>#{payment_method.get here country}</country>\n
<state/>\n
</billing_address>\n
:headers => {'Accept'=>'*/*', 'Authorization'=>/.*/, 'Cache-Control'=>'no-cache', 'Content-Type'=>'application/xml'})
.to_return(status: 200, body: successful_response_file)
end
Как я могуполучить правильные значения с карты?